sheltie

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProviderTimeout = 20 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Sheltie

type Sheltie struct {
	// contains filtered or unexported fields
}

Sheltie represents a reusable retrieval client.

func NewSheltie

func NewSheltie(ctx context.Context, opts ...SheltieOption) (*Sheltie, error)

NewSheltie creates a new Sheltie instance.

func NewSheltieWithConfig

func NewSheltieWithConfig(ctx context.Context, cfg *SheltieConfig) (*Sheltie, error)

NewSheltieWithConfig creates a new Sheltie instance with a custom configuration.

func (*Sheltie) Fetch

Fetch initiates a retrieval request and returns either some details about the retrieval or an error. The request should contain all of the parameters of the requested retrieval, including the LinkSystem where the blocks are intended to be stored.

func (*Sheltie) RegisterSubscriber

func (l *Sheltie) RegisterSubscriber(subscriber types.RetrievalEventSubscriber) func()

RegisterSubscriber registers a subscriber to receive retrieval events. The returned function can be called to unregister the subscriber.

type SheltieConfig

type SheltieConfig struct {
	Source            types.CandidateSource
	ProviderTimeout   time.Duration
	GlobalTimeout     time.Duration
	ProviderBlockList map[peer.ID]bool
	ProviderAllowList map[peer.ID]bool
}

SheltieConfig customizes the behavior of a Sheltie instance.

func NewSheltieConfig

func NewSheltieConfig(opts ...SheltieOption) *SheltieConfig

NewSheltieConfig creates a new SheltieConfig instance with the given SheltieOptions.

type SheltieOption

type SheltieOption func(cfg *SheltieConfig)

func WithCandidateSource

func WithCandidateSource(finder types.CandidateSource) SheltieOption

WithCandidateSource allows you to specify a custom candidate finder.

func WithGlobalTimeout

func WithGlobalTimeout(timeout time.Duration) SheltieOption

WithGlobalTimeout allows you to specify a custom timeout for the entire retrieval process.

func WithProviderAllowList

func WithProviderAllowList(providerAllowList map[peer.ID]bool) SheltieOption

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

func WithProviderBlockList(providerBlockList map[peer.ID]bool) SheltieOption

WithProviderBlockList allows you to specify a custom provider block list.

func WithProviderTimeout

func WithProviderTimeout(timeout time.Duration) SheltieOption

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