delegatedrouting

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0, MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetryWithBackoff

func RetryWithBackoff(f func() error, initialInterval time.Duration, times int) error

Types

type Listener

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

func New

func New(ctx context.Context, engine provider.Interface,
	cidTtl time.Duration,
	chunkSize int,
	snapshotSize int,
	providerId string,
	addresses []string,
	ds datastore.Datastore,
	nonceGen func() []byte,
	opts ...Option,
) (*Listener, error)

New creates a delegated routing listener and initialises its state from the provided datastore.

func (*Listener) FindIPNSRecord added in v0.14.0

func (listener *Listener) FindIPNSRecord(ctx context.Context, name ipns.Name) (*ipns.Record, error)

func (*Listener) FindPeers added in v0.14.3

func (listener *Listener) FindPeers(ctx context.Context, pid peer.ID, limit int) (iter.ResultIter[*types.PeerRecord], error)

func (*Listener) FindProviders

func (listener *Listener) FindProviders(ctx context.Context, key cid.Cid, limit int) (iter.ResultIter[types.Record], error)

func (*Listener) GetIPNS added in v0.14.3

func (listener *Listener) GetIPNS(ctx context.Context, name ipns.Name) (*ipns.Record, error)

func (*Listener) ProvideBitswap

func (listener *Listener) ProvideBitswap(ctx context.Context, req *server.BitswapWriteProvideRequest) (time.Duration, error)

func (*Listener) ProvideIPNSRecord added in v0.14.0

func (listener *Listener) ProvideIPNSRecord(ctx context.Context, name ipns.Name, record *ipns.Record) error

func (*Listener) PutIPNS added in v0.14.3

func (listener *Listener) PutIPNS(ctx context.Context, name ipns.Name, record *ipns.Record) error

func (*Listener) Shutdown

func (listener *Listener) Shutdown()

type MultihashLister

type MultihashLister struct {
	CidFetcher func(contextID []byte) (map[cid.Cid]struct{}, error)
}

func (*MultihashLister) MultihashLister

func (lister *MultihashLister) MultihashLister(ctx context.Context, p peer.ID, contextID []byte) (provider.MultihashIterator, error)

type Option

type Option func(*Options)

func WithAdFlushFrequency added in v0.13.1

func WithAdFlushFrequency(d time.Duration) Option

func WithPageSize

func WithPageSize(i int) Option

func WithSnapshotMaxChunkSize

func WithSnapshotMaxChunkSize(i int) Option

type Options

type Options struct {
	// SnapshotMaxChunkSize defines a size of a chunk that CID snapshot is
	// going to be split into before stored in the datastore. Needed as leveldb
	// can't handle binary payloads above a certain threshold
	SnapshotMaxChunkSize int
	// PageSize defines a maximum number of results that can be returned by a
	// query during datastore initialisation
	PageSize int
	// AdFlushFrequency defines a frequency of a flush operation that is going
	// to be performed on the current chunk. In other words a non empty current
	// chunk will be converted to an ad and published.
	AdFlushFrequency time.Duration
}

func ApplyOptions

func ApplyOptions(opt ...Option) Options

Jump to

Keyboard shortcuts

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