fullrt

package
v0.12.1-0...-f386612 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2021 License: MIT Imports: 34 Imported by: 0

Documentation

Index

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

func NewFullRT(h host.Host, protocolPrefix protocol.ID, options ...Option) (*FullRT, error)

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) Bootstrap

func (dht *FullRT) Bootstrap(ctx context.Context) error

func (*FullRT) CheckPeers

func (dht *FullRT) CheckPeers(ctx context.Context, peers ...peer.ID) (int, int)

CheckPeers return (success, total)

func (*FullRT) Close

func (dht *FullRT) Close() error

func (*FullRT) FindLocal

func (dht *FullRT) FindLocal(id peer.ID) peer.AddrInfo

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) FindPeer

func (dht *FullRT) FindPeer(ctx context.Context, id peer.ID) (_ peer.AddrInfo, err error)

FindPeer searches for a peer with given ID.

func (*FullRT) FindProviders

func (dht *FullRT) FindProviders(ctx context.Context, c cid.Cid) ([]peer.AddrInfo, error)

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 (dht *FullRT) GetClosestPeers(ctx context.Context, key string) ([]peer.ID, error)

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) GetValues

func (dht *FullRT) GetValues(ctx context.Context, key string, nvals int) (_ []RecvdVal, err error)

GetValues gets nvals values corresponding to the given key.

func (*FullRT) Host

func (dht *FullRT) Host() host.Host

func (*FullRT) Provide

func (dht *FullRT) Provide(ctx context.Context, key cid.Cid, brdcst bool) (err error)

Provide makes this node announce that it can provide a value for the given key

func (*FullRT) ProvideMany

func (dht *FullRT) ProvideMany(ctx context.Context, keys []multihash.Multihash) error

func (*FullRT) PutMany

func (dht *FullRT) PutMany(ctx context.Context, keys []string, values [][]byte) error

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

func (*FullRT) Ready

func (dht *FullRT) Ready() bool

func (*FullRT) SearchValue

func (dht *FullRT) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error)

SearchValue searches for the value corresponding to given Key and streams the results.

func (*FullRT) Stat

func (dht *FullRT) Stat() map[string]peer.ID

func (*FullRT) TriggerRefresh

func (dht *FullRT) TriggerRefresh(ctx context.Context) error

type Option

type Option func(opt *config) error

func DHTOption

func DHTOption(opts ...kaddht.Option) Option

type RecvdVal

type RecvdVal struct {
	Val  []byte
	From peer.ID
}

RecvdVal stores a value and the peer from which we got the value.

Jump to

Keyboard shortcuts

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