Documentation ¶
Index ¶
- type Lassie
- type LassieConfig
- type LassieOption
- func WithBitswapConcurrency(concurrency int) LassieOption
- func WithConcurrentSPRetrievals(maxConcurrentSPRtreievals uint) LassieOption
- func WithFinder(finder retriever.CandidateFinder) LassieOption
- func WithGlobalTimeout(timeout time.Duration) LassieOption
- func WithHost(host host.Host) LassieOption
- func WithLibp2pOpts(libp2pOptions ...libp2p.Option) LassieOption
- func WithProtocols(protocols []multicodec.Code) LassieOption
- func WithProviderAllowList(providerAllowList map[peer.ID]bool) LassieOption
- func WithProviderBlockList(providerBlockList map[peer.ID]bool) LassieOption
- func WithProviderTimeout(timeout time.Duration) LassieOption
- func WithTempDir(tempDir string) LassieOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lassie ¶
type Lassie struct {
// contains filtered or unexported fields
}
Lassie represents a reusable retrieval client.
func NewLassie ¶
func NewLassie(ctx context.Context, opts ...LassieOption) (*Lassie, error)
NewLassie creates a new Lassie instance.
func NewLassieWithConfig ¶
func NewLassieWithConfig(ctx context.Context, cfg *LassieConfig) (*Lassie, error)
NewLassieWithConfig creates a new Lassie instance with a custom configuration.
func (*Lassie) Fetch ¶
func (l *Lassie) Fetch(ctx context.Context, request types.RetrievalRequest, eventsCb func(types.RetrievalEvent)) (*types.RetrievalStats, error)
func (*Lassie) RegisterSubscriber ¶
func (l *Lassie) RegisterSubscriber(subscriber types.RetrievalEventSubscriber) func()
RegisterSubscriber registers a subscriber to receive retrieval events. The returned function can be called to unregister the subscriber.
type LassieConfig ¶
type LassieConfig struct { Finder retriever.CandidateFinder Host host.Host ProviderTimeout time.Duration ConcurrentSPRetrievals uint GlobalTimeout time.Duration Libp2pOptions []libp2p.Option Protocols []multicodec.Code ProviderBlockList map[peer.ID]bool ProviderAllowList map[peer.ID]bool TempDir string BitswapConcurrency int }
LassieConfig customizes the behavior of a Lassie instance.
type LassieOption ¶
type LassieOption func(cfg *LassieConfig)
func WithBitswapConcurrency ¶ added in v0.8.0
func WithBitswapConcurrency(concurrency int) LassieOption
WithBitswapConcurrency allows you to specify a custom concurrency for bitswap retrievals, applied using a preloader during traversals. The default is 6.
func WithConcurrentSPRetrievals ¶ added in v0.4.6
func WithConcurrentSPRetrievals(maxConcurrentSPRtreievals uint) LassieOption
WithConcurrentSPRetrievals allows you to specify a custom number of concurrent retrievals from a single storage provider.
func WithFinder ¶
func WithFinder(finder retriever.CandidateFinder) LassieOption
WithFinder allows you to specify a custom candidate finder.
func WithGlobalTimeout ¶ added in v0.4.0
func WithGlobalTimeout(timeout time.Duration) LassieOption
WithGlobalTimeout allows you to specify a custom timeout for the entire retrieval process.
func WithHost ¶ added in v0.4.0
func WithHost(host host.Host) LassieOption
WithHost allows you to specify a custom libp2p host.
func WithLibp2pOpts ¶ added in v0.4.4
func WithLibp2pOpts(libp2pOptions ...libp2p.Option) LassieOption
WithLibp2pOpts allows you to specify custom libp2p options.
func WithProtocols ¶ added in v0.6.8
func WithProtocols(protocols []multicodec.Code) LassieOption
WithProtocols allows you to specify a custom set of protocols to use for retrieval.
func WithProviderAllowList ¶ added in v0.6.8
func WithProviderAllowList(providerAllowList map[peer.ID]bool) LassieOption
WithProviderAllowList allows you to specify a custom set of providers to allow fetching from. If this is not set, all providers will be allowed unless they are in the block list.
func WithProviderBlockList ¶ added in v0.6.8
func WithProviderBlockList(providerBlockList map[peer.ID]bool) LassieOption
WithProviderBlockList allows you to specify a custom provider block list.
func WithProviderTimeout ¶ added in v0.4.0
func WithProviderTimeout(timeout time.Duration) LassieOption
WithProviderTimeout allows you to specify a custom timeout for retrieving data from a provider. Beyond this limit, when no data has been received, the retrieval will fail.
func WithTempDir ¶ added in v0.8.0
func WithTempDir(tempDir string) LassieOption
WithTempDir allows you to specify a custom temp directory for bitswap retrievals, used for a temporary block store for the preloader. The default is the system temp directory.