feat(client/rpc): add provide stat and dag import support#11069
Draft
feat(client/rpc): add provide stat and dag import support#11069
provide stat and dag import support#11069Conversation
add FastProvideRoot and FastProvideWait options to UnixfsAddSettings, allowing RPC clients to control immediate DHT providing of root CIDs for faster content discovery these options default to server config (Import.FastProvideRoot and Import.FastProvideWait) when not explicitly set by the client
adds Import method to APIDagService interface and RPC client implementation - new DagImportResult, DagImportRoot, DagImportStats types in coreiface - DagImportOptions with uniform Set pattern for all params (PinRoots, Stats, FastProvideRoot, FastProvideWait) - streaming channel API for handling multiple roots and stats - tests covering basic import, stats, offline mode, and blocking wait
6e89063 to
833c3de
Compare
adds RPC client support for: - ipfs provide stat (with --lan flag for dual DHT) - ipfs dag import (with --fast-provide-root/--fast-provide-wait) client/rpc changes: - dag.go: add Import() method (~70 lines) - dag_test.go: 4 test cases for Import (new file) - routing.go: add ProvideStats() method (~25 lines) - routing_test.go: 3 test cases for ProvideStats (new file) to enable RPC client, refactored commands to use CoreAPI: - add ProvideStats() to RoutingAPI interface and implementation - add Import() to APIDagService interface and implementation - commands delegate to CoreAPI (provide.go, dag/import.go)
833c3de to
45d17e7
Compare
address code review feedback for PR #11069: - fix: propagate decode errors in client/rpc dag import (was silently dropping errors) - fix: acquire pinlock before spawning goroutine to prevent race with GC - fix: update fast-provide test to always expect failure in isolated environment - test: add proper json compatibility test for provide stats (replaces compile-time check) - docs: add educational comments explaining batch config defaults - style: standardize error messages to use consistent "failed to X: %w" pattern the pinlock fix is critical - moving acquisition before goroutine spawn prevents blocks from being garbage collected before the lock is held. the error handling fix ensures RPC clients receive decode errors instead of empty results.
Member
Author
|
This PR illustrated deeper problem with Kubo maintainers should not burn time on this. Instead of landing this, I'm marking it as blocked draft until we rework how |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Warning
Not ready yet, opening draft PR to see if there are any test failures. I will work on this is spare time, but likely 0.40.
This PR adds
client/rpc(RPC library for GO) support for:ipfs provide statipfs dag import(with--fast-provide-root/--fast-provide-wait)To enable this, refactored commands to use
CoreAPI, which is reusable layer shared between commands (cli/rpc) and client/rpc (remote rpc client library for go):We shoul've done that when we added original commands / flags, making sure things end up in CoreAPI to work with
client/rpc, but we do this very rarely so we forgot. This PR cleans this up.