Documentation ¶
Index ¶
- type Lassie
- type LassieConfig
- type 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
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) (*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 }
LassieConfig customizes the behavior of a Lassie instance.
type LassieOption ¶
type LassieOption func(cfg *LassieConfig)
func WithConcurrentSPRetrievals ¶ added in v0.4.6
func WithConcurrentSPRetrievals(maxConcurrentSPRtreievals uint) LassieOption
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
func WithProviderAllowList ¶ added in v0.6.8
func WithProviderAllowList(providerAllowList map[peer.ID]bool) LassieOption
func WithProviderBlockList ¶ added in v0.6.8
func WithProviderBlockList(providerBlockList map[peer.ID]bool) LassieOption
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.