lassie

package
v0.6.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2023 License: Apache-2.0, MIT Imports: 11 Imported by: 7

Documentation

Index

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 (*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
	DisableGraphsync       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 WithGraphsyncDisabled added in v0.5.0

func WithGraphsyncDisabled() LassieOption

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 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL