providers

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddProviderNotSupported

func AddProviderNotSupported(backend providers.ProviderStore) providers.ProviderStore

func CombineProviders

func CombineProviders(backend ...providers.ProviderStore) providers.ProviderStore

func NewAsyncProvidersFinder

func NewAsyncProvidersFinder(timeout time.Duration, queueSize int, negativeCacheTTL time.Duration) *asyncProvidersFinder

func NewDynamoDBProviderStore

func NewDynamoDBProviderStore(self peer.ID, peerstore peerStore, ddbClient ddbClient, tableName string, ttl time.Duration, queryLimit int32) *dynamoDBProviderStore

func NewReframeProviderStore

func NewReframeProviderStore(httpClient *http.Client, endpointURL string) (*reframeProvider, error)

Types

type AddProviderNotSupportedProviderStore

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

func (*AddProviderNotSupportedProviderStore) AddProvider

func (s *AddProviderNotSupportedProviderStore) AddProvider(ctx context.Context, key []byte, prov peer.AddrInfo) error

func (*AddProviderNotSupportedProviderStore) GetProviders

func (s *AddProviderNotSupportedProviderStore) GetProviders(ctx context.Context, key []byte) ([]peer.AddrInfo, error)

type CachingProviderStore

type CachingProviderStore struct {
	ReadProviderStore  providers.ProviderStore
	WriteProviderStore providers.ProviderStore
	Finder             ProvidersFinder
	Router             ReadContentRouting
	// contains filtered or unexported fields
}

CachingProviderStore checks the ReadProviderStore for providers. If no providers are returned, then the Finder is used to find providers, which are then added to the WriteProviderStore.

func NewCachingProviderStore

func NewCachingProviderStore(getDelegate providers.ProviderStore, addDelegate providers.ProviderStore, finder ProvidersFinder, router ReadContentRouting) *CachingProviderStore

func (*CachingProviderStore) AddProvider

func (s *CachingProviderStore) AddProvider(ctx context.Context, key []byte, prov peer.AddrInfo) error

func (*CachingProviderStore) GetProviders

func (d *CachingProviderStore) GetProviders(ctx context.Context, key []byte) ([]peer.AddrInfo, error)

GetProviders gets providers for the given key from the providerstore. If the providerstore does not have providers for the key, then the ProvidersFinder is queried and the results are cached.

type CombinedProviderStore

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

func (*CombinedProviderStore) AddProvider

func (s *CombinedProviderStore) AddProvider(ctx context.Context, key []byte, prov peer.AddrInfo) error

func (*CombinedProviderStore) GetProviders

func (s *CombinedProviderStore) GetProviders(ctx context.Context, key []byte) ([]peer.AddrInfo, error)

type ProvidersFinder

type ProvidersFinder interface {
	Find(ctx context.Context, router ReadContentRouting, key []byte, onProvider onProviderFunc) error
}

ProvidersFinder finds providers for the given key using the given content router, passing each to the callback.

type ReadContentRouting

type ReadContentRouting interface {
	FindProvidersAsync(ctx context.Context, cid cid.Cid, numResults int) <-chan peer.AddrInfo
}

Jump to

Keyboard shortcuts

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