Documentation ¶
Index ¶
- type Bootstrap
- type Compose
- func (cr *Compose) Bootstrap(ctx context.Context) error
- func (cr *Compose) FindPeer(ctx context.Context, p peer.ID) (pstore.PeerInfo, error)
- func (cr *Compose) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan pstore.PeerInfo
- func (cr *Compose) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error)
- func (cr *Compose) GetValue(ctx context.Context, key string, opts ...ropts.Option) ([]byte, error)
- func (cr *Compose) Provide(ctx context.Context, c cid.Cid, local bool) error
- func (cr *Compose) PutValue(ctx context.Context, key string, value []byte, opts ...ropts.Option) error
- func (cr *Compose) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)
- type LimitedValueStore
- func (lvs *LimitedValueStore) Bootstrap(ctx context.Context) error
- func (lvs *LimitedValueStore) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error)
- func (lvs *LimitedValueStore) GetValue(ctx context.Context, key string, opts ...ropts.Option) ([]byte, error)
- func (lvs *LimitedValueStore) KeySupported(key string) bool
- func (lvs *LimitedValueStore) PutValue(ctx context.Context, key string, value []byte, opts ...ropts.Option) error
- func (lvs *LimitedValueStore) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)
- type Null
- func (nr Null) Bootstrap(context.Context) error
- func (nr Null) FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error)
- func (nr Null) FindProvidersAsync(context.Context, cid.Cid, int) <-chan pstore.PeerInfo
- func (nr Null) GetValue(context.Context, string, ...ropts.Option) ([]byte, error)
- func (nr Null) Provide(context.Context, cid.Cid, bool) error
- func (nr Null) PutValue(context.Context, string, []byte, ...ropts.Option) error
- func (nr Null) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)
- type Parallel
- func (r Parallel) Bootstrap(ctx context.Context) error
- func (r Parallel) FindPeer(ctx context.Context, p peer.ID) (pstore.PeerInfo, error)
- func (r Parallel) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan pstore.PeerInfo
- func (r Parallel) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error)
- func (r Parallel) GetValue(ctx context.Context, key string, opts ...ropts.Option) ([]byte, error)
- func (r Parallel) Provide(ctx context.Context, c cid.Cid, local bool) error
- func (r Parallel) PutValue(ctx context.Context, key string, value []byte, opts ...ropts.Option) error
- func (r Parallel) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)
- type Tiered
- func (r Tiered) Bootstrap(ctx context.Context) error
- func (r Tiered) FindPeer(ctx context.Context, p peer.ID) (pstore.PeerInfo, error)
- func (r Tiered) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan pstore.PeerInfo
- func (r Tiered) GetPublicKey(ctx context.Context, p peer.ID) (ci.PubKey, error)
- func (r Tiered) GetValue(ctx context.Context, key string, opts ...ropts.Option) ([]byte, error)
- func (r Tiered) Provide(ctx context.Context, c cid.Cid, local bool) error
- func (r Tiered) PutValue(ctx context.Context, key string, value []byte, opts ...ropts.Option) error
- func (r Tiered) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bootstrap ¶
type Bootstrap interface { // Bootstrap bootstraps the router. Bootstrap(ctx context.Context) error }
Bootstrap is an interface that should be implemented by any routers wishing to be bootstrapped.
type Compose ¶
type Compose struct { ValueStore routing.ValueStore PeerRouting routing.PeerRouting ContentRouting routing.ContentRouting }
Compose composes the components into a single router. Not specifying a component (leaving it nil) is equivalent to specifying the Null router.
It also implements Bootstrap. All *distinct* components implementing Bootstrap will be bootstrapped in parallel. Identical components will not be bootstrapped twice.
func (*Compose) FindPeer ¶
FindPeer searches for a peer with given ID, returns a pstore.PeerInfo with relevant addresses.
func (*Compose) FindProvidersAsync ¶
func (cr *Compose) FindProvidersAsync(ctx context.Context, c cid.Cid, count int) <-chan pstore.PeerInfo
FindProvidersAsync searches for peers who are able to provide a given key
func (*Compose) GetPublicKey ¶
GetPublicKey returns the public key for the given peer.
func (*Compose) Provide ¶
Provide adds the given cid to the content routing system. If 'true' is passed, it also announces it, otherwise it is just kept in the local accounting of which objects are being provided.
type LimitedValueStore ¶
type LimitedValueStore struct { routing.ValueStore Namespaces []string }
LimitedValueStore limits the internal value store to the given namespaces.
func (*LimitedValueStore) Bootstrap ¶
func (lvs *LimitedValueStore) Bootstrap(ctx context.Context) error
func (*LimitedValueStore) GetPublicKey ¶
GetPublicKey returns the public key for the given peer.
func (*LimitedValueStore) GetValue ¶
func (lvs *LimitedValueStore) GetValue(ctx context.Context, key string, opts ...ropts.Option) ([]byte, error)
GetValue returns routing.ErrNotFound if key isn't supported
func (*LimitedValueStore) KeySupported ¶
func (lvs *LimitedValueStore) KeySupported(key string) bool
KeySupported returns true if the passed key is supported by this value store.
func (*LimitedValueStore) PutValue ¶
func (lvs *LimitedValueStore) PutValue(ctx context.Context, key string, value []byte, opts ...ropts.Option) error
PutValue returns ErrNotSupported
func (*LimitedValueStore) SearchValue ¶
func (lvs *LimitedValueStore) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)
SearchValue returns empty channel if key isn't supported or calls SearchValue on the underlying ValueStore
type Null ¶
type Null struct{}
Null is a router that doesn't do anything.
func (Null) FindProvidersAsync ¶
FindProvidersAsync always returns a closed channel
type Parallel ¶
type Parallel struct { Routers []routing.IpfsRouting Validator record.Validator }
Parallel operates on the slice of routers in parallel.
func (Parallel) FindProvidersAsync ¶
func (Parallel) GetPublicKey ¶
type Tiered ¶
type Tiered struct { Routers []routing.IpfsRouting Validator record.Validator }
Tiered is like the Parallel except that GetValue and FindPeer are called in series.