Documentation
¶
Overview ¶
Package dspinner implements structures and methods to keep track of which objects a user wants to keep stored locally. This implementation stores pin data in a datastore.
Index ¶
- func New(ctx context.Context, dstore ds.Datastore, dserv ipld.DAGService, ...) (*pinner, error)
- func NewPinnedEntityRootsProvider(pinning ipfspinner.Pinner, bs blockstore.Blockstore, ...) provider.KeyChanFunc
- func NewPinnedProvider(onlyRoots bool, pinning ipfspinner.Pinner, fetchConfig fetcher.Factory) provider.KeyChanFunc
- func NewUniquePinnedProvider(pinning ipfspinner.Pinner, bs blockstore.Blockstore, ...) provider.KeyChanFunc
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(ctx context.Context, dstore ds.Datastore, dserv ipld.DAGService, opts ...Option) (*pinner, error)
New creates a new pinner and loads its keysets from the given datastore. If there is no data present in the datastore, then an empty pinner is returned.
By default, changes are automatically flushed to the datastore. This can be disabled by calling SetAutosync(false), which will require that Flush be called explicitly.
func NewPinnedEntityRootsProvider ¶ added in v0.38.0
func NewPinnedEntityRootsProvider( pinning ipfspinner.Pinner, bs blockstore.Blockstore, tracker walker.VisitedTracker, ) provider.KeyChanFunc
NewPinnedEntityRootsProvider returns a provider.KeyChanFunc that emits entity roots (files, directories, HAMT shards) reachable from pinned roots, skipping internal file chunks. Uses walker.WalkEntityRoots with the shared walker.VisitedTracker for cross-pin deduplication.
Same processing order as NewUniquePinnedProvider: recursive pins first, direct pins second.
func NewPinnedProvider ¶ added in v0.34.0
func NewPinnedProvider(onlyRoots bool, pinning ipfspinner.Pinner, fetchConfig fetcher.Factory) provider.KeyChanFunc
NewPinnedProvider returns a KeyChanFunc supplying pinned keys. The Provider will block when writing to the channel and there are no readers.
func NewUniquePinnedProvider ¶ added in v0.38.0
func NewUniquePinnedProvider( pinning ipfspinner.Pinner, bs blockstore.Blockstore, tracker walker.VisitedTracker, ) provider.KeyChanFunc
NewUniquePinnedProvider returns a provider.KeyChanFunc that emits all blocks reachable from pinned roots, with bloom filter cross-pin deduplication via the shared walker.VisitedTracker.
Processing order: recursive pin DAGs first (via walker.WalkDAG), then direct pins. This order ensures that by the time direct pins are processed, all recursive DAGs have been walked and their CIDs are in the tracker.
The existing NewPinnedProvider is unchanged. This function is used only when the +unique strategy modifier is active.
Types ¶
type Option ¶ added in v0.34.0
type Option struct {
// contains filtered or unexported fields
}
func WithPinnedProvider ¶ added in v0.34.0
func WithPinnedProvider(prov provider.MultihashProvider) Option
WithPinnedProvider sets a provider for all pinned CIDs to be provided (directly or recursively).
func WithRootsProvider ¶ added in v0.34.0
func WithRootsProvider(prov provider.MultihashProvider) Option
WithRootsProvider sets a provider for root CIDs and direct pins to be provided.