Documentation ¶
Index ¶
- type FullRT
- func (dht *FullRT) Bootstrap(ctx context.Context) error
- func (dht *FullRT) CheckPeers(ctx context.Context, peers ...peer.ID) (int, int)
- func (dht *FullRT) Close() error
- func (dht *FullRT) FindLocal(id peer.ID) peer.AddrInfo
- func (dht *FullRT) FindPeer(ctx context.Context, id peer.ID) (_ peer.AddrInfo, err error)
- func (dht *FullRT) FindProviders(ctx context.Context, c cid.Cid) ([]peer.AddrInfo, error)
- func (dht *FullRT) FindProvidersAsync(ctx context.Context, key cid.Cid, count int) <-chan peer.AddrInfo
- func (dht *FullRT) GetClosestPeers(ctx context.Context, key string) ([]peer.ID, error)
- func (dht *FullRT) GetValue(ctx context.Context, key string, opts ...routing.Option) (_ []byte, err error)
- func (dht *FullRT) Host() host.Host
- func (dht *FullRT) Provide(ctx context.Context, key cid.Cid, brdcst bool) (err error)
- func (dht *FullRT) ProvideMany(ctx context.Context, keys []multihash.Multihash) error
- func (dht *FullRT) PutMany(ctx context.Context, keys []string, values [][]byte) error
- func (dht *FullRT) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) (err error)
- func (dht *FullRT) Ready() bool
- func (dht *FullRT) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error)
- func (dht *FullRT) Stat() map[string]peer.ID
- func (dht *FullRT) TriggerRefresh(ctx context.Context) error
- type Option
- func DHTOption(opts ...kaddht.Option) Option
- func WithBulkSendParallelism(b int) Option
- func WithCrawlInterval(i time.Duration) Option
- func WithCrawler(c crawler.Crawler) Option
- func WithProviderManagerOptions(pmOpts ...providers.Option) Option
- func WithSuccessWaitFraction(f float64) Option
- func WithTimeoutPerOperation(t time.Duration) Option
- type RecvdVal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FullRT ¶
type FullRT struct { Validator record.Validator ProviderManager *providers.ProviderManager // contains filtered or unexported fields }
FullRT is an experimental DHT client that is under development. Expect breaking changes to occur in this client until it stabilizes.
func NewFullRT ¶
NewFullRT creates a DHT client that tracks the full network. It takes a protocol prefix for the given network, For example, the protocol /ipfs/kad/1.0.0 has the prefix /ipfs.
FullRT is an experimental DHT client that is under development. Expect breaking changes to occur in this client until it stabilizes.
Not all of the standard DHT options are supported in this DHT.
func (*FullRT) CheckPeers ¶
CheckPeers return (success, total)
func (*FullRT) FindLocal ¶
FindLocal looks for a peer with a given ID connected to this dht and returns the peer and the table it was found in.
func (*FullRT) FindProviders ¶
FindProviders searches until the context expires.
func (*FullRT) FindProvidersAsync ¶
func (dht *FullRT) FindProvidersAsync(ctx context.Context, key cid.Cid, count int) <-chan peer.AddrInfo
FindProvidersAsync is the same thing as FindProviders, but returns a channel. Peers will be returned on the channel as soon as they are found, even before the search query completes. If count is zero then the query will run until it completes. Note: not reading from the returned channel may block the query from progressing.
func (*FullRT) GetClosestPeers ¶
func (*FullRT) GetValue ¶
func (dht *FullRT) GetValue(ctx context.Context, key string, opts ...routing.Option) (_ []byte, err error)
GetValue searches for the value corresponding to given Key.
func (*FullRT) Provide ¶
Provide makes this node announce that it can provide a value for the given key
func (*FullRT) ProvideMany ¶
func (*FullRT) PutValue ¶
func (dht *FullRT) PutValue(ctx context.Context, key string, value []byte, opts ...routing.Option) (err error)
PutValue adds value corresponding to given Key. This is the top level "Store" operation of the DHT
type Option ¶
type Option func(opt *config) error
func WithBulkSendParallelism ¶
WithBulkSendParallelism sets the maximum degree of parallelism at which messages are sent to other peers. It must be at least 1. Defaults to 20 if unspecified.
func WithCrawlInterval ¶
WithCrawlInterval sets the interval at which the DHT is crawled to refresh peer store. Defaults to 1 hour if unspecified.
func WithCrawler ¶
WithCrawler sets the crawler.Crawler to use in order to crawl the DHT network. Defaults to crawler.DefaultCrawler with parallelism of 200.
func WithProviderManagerOptions ¶
WithProviderManagerOptions sets the options to use when instantiating providers.ProviderManager.
func WithSuccessWaitFraction ¶
WithSuccessWaitFraction sets the fraction of peers to wait for before considering an operation a success defined as a number between (0, 1]. Defaults to 30% if unspecified.
func WithTimeoutPerOperation ¶
WithTimeoutPerOperation sets the timeout per operation, where operations include putting providers and querying the DHT. Defaults to 5 seconds if unspecified.