-
Notifications
You must be signed in to change notification settings - Fork 188
feat: integrate with go-f3 and implement F3 data export and import
#5886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 55 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
eef772f
feat: add `--v2` flag to `forest-cli snapshot export`
hanabi1224 972914f
snapshot metadata API for plain CAR
hanabi1224 6408398
forest-tool archive metadata
hanabi1224 d07fa89
fix link checker
hanabi1224 c370d04
fix typo
hanabi1224 246e3a0
Merge branch 'main' into hm/export-snapshot-v2
hanabi1224 5f8ecae
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 13e63dd
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 918d590
resolve comments
hanabi1224 b8f8e6d
address AI comment
hanabi1224 6d41c27
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 4a36686
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 6323cb7
Merge remote-tracking branch 'origin/main' into hm/export-snapshot-v2
hanabi1224 f3ccbdb
resolve comments
hanabi1224 2a28182
Merge branch 'main' into hm/export-snapshot-v2
hanabi1224 c60e6b1
resolve comments
hanabi1224 b6720fe
tests
hanabi1224 142d027
Merge branch 'main' into hm/export-snapshot-v2
hanabi1224 dc127ca
speed up snapshot export check
hanabi1224 0203c96
chore(deps): bump go-f3 and Go deps
hanabi1224 cec3d5c
Merge remote-tracking branch 'origin/hm/bump-go-deps' into hm/export-…
hanabi1224 f7c631f
integrate with go-f3
hanabi1224 fa83aaa
f3 snap import
hanabi1224 0a59dde
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 fb63dfa
integrity check of f3 data
hanabi1224 7713315
fix f3 snap import
hanabi1224 bdd6dc0
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 93c4d7c
bump go-f3
hanabi1224 9ffd7c9
bump go-f3
hanabi1224 de4aa85
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 d68fa83
bump go-f3
hanabi1224 963503f
Merge branch 'main' into hm/export-f3-data
hanabi1224 d1ad868
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 374c38d
no go mod replace
hanabi1224 0a1ca02
fix comments and small tweaks
hanabi1224 725f233
add tests
hanabi1224 baf3d42
changelog
hanabi1224 9181ead
unit test coverage for get_reader & resolve AI comments
hanabi1224 4996b33
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 e18e351
update doc gen script
hanabi1224 51b9f75
Merge branch 'main' into hm/export-f3-data
hanabi1224 e9b6572
print size and speed in `merge-f3` command output
hanabi1224 9b8395b
chore(ci): add go linter
hanabi1224 379633d
Potential fix for code scanning alert no. 63: Workflow does not conta…
hanabi1224 88b50d6
Merge remote-tracking branch 'origin/hm/go-linter' into hm/export-f3-…
hanabi1224 b481cf8
fix go lint errors
hanabi1224 5d4130d
use ProgressBar
hanabi1224 4e2b96d
resolve comments
hanabi1224 34910b1
Merge branch 'main' into hm/export-f3-data
hanabi1224 fefc3f2
update CI umbrella job
hanabi1224 faf4439
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 86bc855
Update src/tool/subcommands/archive_cmd.rs
hanabi1224 ca4e52d
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 5243383
resolve comments
hanabi1224 196c884
fix rpc endpoint in tests
hanabi1224 c42b224
Merge remote-tracking branch 'origin/main' into hm/export-f3-data
hanabi1224 c2621bc
Merge branch 'main' into hm/export-f3-data
hanabi1224 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Go code linters | ||
| permissions: | ||
| contents: read | ||
|
|
||
| # Cancel workflow if there is a new change to the branch. | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| merge_group: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| lint-go: | ||
| name: Go lint checks | ||
| runs-on: ubuntu-24.04-arm | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: "go.work" | ||
| - run: make lint-go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| version: "2" | ||
| linters: | ||
| default: standard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "bufio" | ||
| "context" | ||
| "errors" | ||
| "os" | ||
|
|
||
| "github.com/filecoin-project/go-f3/certstore" | ||
| "github.com/filecoin-project/go-f3/manifest" | ||
| "github.com/filecoin-project/go-jsonrpc" | ||
| "github.com/ipfs/go-datastore/namespace" | ||
| ) | ||
|
|
||
| func importSnap(ctx context.Context, rpcEndpoint string, f3Root string, snapshotPath string) (err error) { | ||
| logger.Infof("importing F3 snapshot at %s", snapshotPath) | ||
|
|
||
| f3api := F3Api{} | ||
| closer, err := jsonrpc.NewClient(ctx, rpcEndpoint, "F3", &f3api, nil) | ||
|
akaladarshi marked this conversation as resolved.
|
||
| if err != nil { | ||
| return err | ||
| } | ||
| defer closer() | ||
| rawNetworkName := waitRawNetworkName(ctx, &f3api) | ||
| networkName := getNetworkName(rawNetworkName) | ||
| m := Network2PredefinedManifestMappings[networkName] | ||
| if m == nil { | ||
| m2 := manifest.LocalDevnetManifest() | ||
| m = &m2 | ||
| m.NetworkName = networkName | ||
| } | ||
|
|
||
| ds, err := getDatastore(f3Root) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| defer func() { | ||
| if closeErr := ds.Close(); closeErr != nil { | ||
| err = errors.Join(err, closeErr) | ||
| } | ||
| }() | ||
| dsWrapper := namespace.Wrap(ds, m.DatastorePrefix()) | ||
| defer func() { | ||
| if closeErr := dsWrapper.Close(); closeErr != nil { | ||
| err = errors.Join(err, closeErr) | ||
| } | ||
| }() | ||
|
|
||
| f, err := os.Open(snapshotPath) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| defer func() { | ||
| if closeErr := f.Close(); closeErr != nil { | ||
| err = errors.Join(err, closeErr) | ||
| } | ||
| }() | ||
| return certstore.ImportSnapshotToDatastore(ctx, bufio.NewReader(f), dsWrapper) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.