Repository navigation
v0.40.0
What's Changed
Added
retrieval: addedState.Snapshot,State.Apply, andState.Notifyso consumers can streamStateacross a process boundary, e.g. to drive a live progress bar in Kubo'scat,get, ordag export. #1153- 🛠
pinning/pinner: addedPinner.Close() error. Close cancels every in-flight operation's context, including streaming goroutines fromRecursiveKeys,DirectKeys, andInternalPins, and waits for them to return. A scalar method that observes the cancellation may returncontext.Canceled; a stream interrupted by Close may surfaceErrClosedon the channel before it closes. After Close returns, every other method returns the newErrClosedsentinel; streaming methods deliver it asStreamedPin.Erron a single entry, then close the channel. Close is idempotent and goroutine-safe. Action required: downstreamPinnerimplementations must addClose. #1150 pinning/pinner/dspinner: implementsClose. Close cancels the contexts of in-flight operations, so snapshot iteration inRecursiveKeys/DirectKeysand DAG fetches inPinbail out promptly instead of draining to completion. Close returns as soon as those operations honor their ctx. Hosts owning the datastore should callCloseon the pinner before closing the datastore to avoid the use-after-close panic path in stores such as pebble. #1150routing/http/types/iter: addedLimit, an iterator that caps another iterator at a fixed number of values. #1157routing/providerquerymanager: newWithFindPeerFallbackoption. When set, a one-shotFindPeerfallback runs if the first dial to a provider fails; the manager retries the dial with the freshAddrInfo, but only ifFindPeersurfaced at least one address that wasn't already in the routing-record set just tried. Rescues providers whose routing-record snapshot is thin or stale but whose actual addresses are still reachable, without wasting a retry on a duplicate address set. Disabled by default; passWithFindPeerFallback(myDHT)to enable.
Changed
-
upgrade to
go-libp2p-kad-dhtv0.40.0 -
🛠
files: theFileinterface no longer embedsio.Seeker. Seekability is now explicit in the type system instead of implied by an always-presentSeekmethod that returnedErrNotSupportedat runtime for non-seekable inputs. Callers that need to seek type-assert toio.Seeker; the assertion is an honest capability check rather than a guess. Seekable implementations (ReaderFilewrapping a seekable reader,Symlink, UnixFS files returned from the gateway and importer) still satisfy the assertion. Non-seekable implementations (HTTP multipart streams,WebFile) now fail the assertion at compile-aware sites instead of producing runtime errors deep in third-party code. The previous behavior forced downstream workarounds: e.g. ipfs/kubo#11253 had to wrapfiles.Filein a plainio.Reader/io.Closerto stripSeekand forcego-car's forward-only fallback, becausego-car'sNewBlockReadertrusted the interface and calledSeek, which failed with "operation not supported" on CARv2 imports over the HTTP API. With this change the trap stops existing.Action required. Replace direct
Seekcalls onfiles.Filewith a type assertion:// before n, err := f.Seek(offset, io.SeekStart) // after seeker, ok := f.(io.Seeker) if !ok { return fmt.Errorf("file does not support seeking") } n, err := seeker.Seek(offset, io.SeekStart)
See ipfs/kubo#11254 for a worked example of the call-site update. #1128
-
✨
routing/http/server: the Delegated Routing server now passeslimit=0(unbounded) toDelegatedRouter.FindProviders/FindPeersand applies the configured records limit itself, after filtering. Filtered requests now return a full page of results instead of fewer than requested. The server reads the delegate's iterator lazily and closes it once it has enough records. Action required: delegate implementations should return results lazily and stop work onClose. A delegate that previously used thelimitargument to end its walk early should now end the walk onCloseinstead. #1157 -
path/resolver:ResolveToLastNode,ResolvePath, andResolvePathComponentsnow populateretrieval.Stateon the request context when one is attached. They advance the state toPhasePathResolution, record the root CID from the input path, and record the terminal CID once resolution completes. Until now only the gateway backends populated these fields, leaving non-gateway callers (CLIs, custom tools) without phase or CID diagnostics on retrieval errors. The new calls are idempotent with the existing gateway-side ones, so behavior on the gateway path is unchanged.
Fixed
files: now builds underGOOS=js GOARCH=wasmandGOOS=wasip1 GOARCH=wasm. #935routing/http/server: filtered/routing/v1/providersand/routing/v1/peersrequests now return up to the configured records limit. Previously the limit was applied beforefilter-addrs/filter-protocolsran, so records dropped by the filters shrank the response below the limit. The limit now applies after filtering. #1157routing/http/types/iter:Filter.Nextnow iterates instead of recursing on rejected values, so the goroutine stack stays flat even when a long run of records is filtered out. This matters now that the server pulls unbounded results from the delegate. #1157
Full Changelog: v0.39.0...v0.40.0
Note
This release was brought to you by the Shipyard team.
