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
- 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
- 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
- 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
- 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
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.
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 ErrNotSupported
func (*LimitedValueStore) KeySupported ¶
func (lvs *LimitedValueStore) KeySupported(key string) bool
KeySupported returns true if the passed key is supported by this value store.
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 []routing.IpfsRouting
Parallel operates on the slice of routers in parallel.
func (Parallel) FindProvidersAsync ¶
func (Parallel) GetPublicKey ¶
type Tiered ¶
type Tiered []routing.IpfsRouting
Tiered is like the Parallel except that GetValue and FindPeer are called in series.