Documentation ¶
Index ¶
- Variables
- func ParseNodeAddresses(n *proto.Peer) peer.AddrInfo
- func ToProtoPeer(ai peer.AddrInfo) *proto.Peer
- type Client
- func (fp *Client) FindProviders(ctx context.Context, key cid.Cid) ([]peer.AddrInfo, error)
- func (fp *Client) FindProvidersAsync(ctx context.Context, key cid.Cid) (<-chan FindProvidersAsyncResult, error)
- func (fp *Client) GetIPNS(ctx context.Context, id []byte) ([]byte, error)
- func (fp *Client) GetIPNSAsync(ctx context.Context, id []byte) (<-chan GetIPNSAsyncResult, error)
- func (c *Client) GetValue(ctx context.Context, key string, opts ...routing.Option) ([]byte, error)
- func (fp *Client) Provide(ctx context.Context, keys []cid.Cid, ttl time.Duration) (time.Duration, error)
- func (fp *Client) ProvideAsync(ctx context.Context, keys []cid.Cid, ttl time.Duration) (<-chan time.Duration, error)
- func (fp *Client) ProvideSignedRecord(ctx context.Context, req *ProvideRequest) (<-chan ProvideAsyncResult, error)
- func (fp *Client) PutIPNS(ctx context.Context, id []byte, record []byte) error
- func (fp *Client) PutIPNSAsync(ctx context.Context, id []byte, record []byte) (<-chan PutIPNSAsyncResult, error)
- func (c *Client) PutValue(ctx context.Context, key string, val []byte, opts ...routing.Option) error
- func (c *Client) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error)
- type ContentRoutingClient
- func (c *ContentRoutingClient) FindProvidersAsync(ctx context.Context, key cid.Cid, numResults int) <-chan peer.AddrInfo
- func (c *ContentRoutingClient) Provide(ctx context.Context, key cid.Cid, announce bool) error
- func (c *ContentRoutingClient) ProvideMany(ctx context.Context, keys []multihash.Multihash) error
- func (c *ContentRoutingClient) Ready() bool
- type DelegatedRoutingClient
- type FindProvidersAsyncResult
- type GetIPNSAsyncResult
- type GraphSyncFILv1
- type ProvideAsyncResult
- type ProvideRequest
- type Provider
- type PutIPNSAsyncResult
- type TransferProtocol
Constants ¶
This section is empty.
Variables ¶
var (
DefaultViews = []*view.View{
durationView,
requestsView,
}
)
Functions ¶
func ParseNodeAddresses ¶ added in v0.2.0
ParseNodeAddresses parses peer node addresses from the protocol structure Peer.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶ added in v0.2.0
func NewClient(c proto.DelegatedRouting_Client, p *Provider, identity crypto.PrivKey) (*Client, error)
NewClient creates a client. The Provider and identity parameters are option. If they are nil, the `Provide` method will not function.
func (*Client) FindProviders ¶
func (*Client) FindProvidersAsync ¶
func (fp *Client) FindProvidersAsync(ctx context.Context, key cid.Cid) (<-chan FindProvidersAsyncResult, error)
FindProvidersAsync processes the stream of raw protocol async results into a stream of parsed results. Specifically, FindProvidersAsync converts protocol-level provider descriptions into peer address infos.
func (*Client) GetIPNSAsync ¶ added in v0.2.0
func (*Client) GetValue ¶ added in v0.2.1
GetValue searches for the value corresponding to given Key.
func (*Client) ProvideAsync ¶ added in v0.4.0
func (*Client) ProvideSignedRecord ¶ added in v0.4.0
func (fp *Client) ProvideSignedRecord(ctx context.Context, req *ProvideRequest) (<-chan ProvideAsyncResult, error)
ProvideAsync makes a provide request to a delegated router
func (*Client) PutIPNSAsync ¶ added in v0.2.0
func (*Client) PutValue ¶ added in v0.2.1
func (c *Client) PutValue(ctx context.Context, key string, val []byte, opts ...routing.Option) error
PutValue adds value corresponding to given Key.
func (*Client) SearchValue ¶ added in v0.2.1
func (c *Client) SearchValue(ctx context.Context, key string, opts ...routing.Option) (<-chan []byte, error)
SearchValue searches for better and better values from this value store corresponding to the given Key. By default implementations must stop the search after a good value is found. A 'good' value is a value that would be returned from GetValue.
Useful when you want a result *now* but still want to hear about better/newer results.
Implementations of this methods won't return ErrNotFound. When a value couldn't be found, the channel will get closed without passing any results
type ContentRoutingClient ¶ added in v0.2.0
type ContentRoutingClient struct {
// contains filtered or unexported fields
}
func NewContentRoutingClient ¶ added in v0.2.0
func NewContentRoutingClient(c DelegatedRoutingClient) *ContentRoutingClient
func (*ContentRoutingClient) FindProvidersAsync ¶ added in v0.2.0
func (*ContentRoutingClient) Provide ¶ added in v0.2.0
func (c *ContentRoutingClient) Provide(ctx context.Context, key cid.Cid, announce bool) error
func (*ContentRoutingClient) ProvideMany ¶ added in v0.5.0
func (c *ContentRoutingClient) ProvideMany(ctx context.Context, keys []multihash.Multihash) error
func (*ContentRoutingClient) Ready ¶ added in v0.5.0
func (c *ContentRoutingClient) Ready() bool
Ready is part of the existing `ProvideMany` interface, but can be used more generally to determine if the routing client has a working connection.
type DelegatedRoutingClient ¶ added in v0.2.0
type DelegatedRoutingClient interface { FindProviders(ctx context.Context, key cid.Cid) ([]peer.AddrInfo, error) FindProvidersAsync(ctx context.Context, key cid.Cid) (<-chan FindProvidersAsyncResult, error) GetIPNS(ctx context.Context, id []byte) ([]byte, error) GetIPNSAsync(ctx context.Context, id []byte) (<-chan GetIPNSAsyncResult, error) PutIPNS(ctx context.Context, id []byte, record []byte) error PutIPNSAsync(ctx context.Context, id []byte, record []byte) (<-chan PutIPNSAsyncResult, error) Provide(ctx context.Context, key []cid.Cid, ttl time.Duration) (time.Duration, error) ProvideAsync(ctx context.Context, key []cid.Cid, ttl time.Duration) (<-chan time.Duration, error) }
type GetIPNSAsyncResult ¶ added in v0.2.0
type GraphSyncFILv1 ¶ added in v0.4.0
GraphSyncFILv1 is the current filecoin storage provider protocol.
type ProvideAsyncResult ¶ added in v0.4.0
type ProvideRequest ¶ added in v0.4.0
type ProvideRequest struct { Key []cid.Cid *Provider Timestamp int64 AdvisoryTTL time.Duration Signature []byte }
ProvideRequest is a message indicating a provider can provide a Key for a given TTL
func ParseProvideRequest ¶ added in v0.4.0
func ParseProvideRequest(req *proto.ProvideRequest) (*ProvideRequest, error)
func (*ProvideRequest) IsSigned ¶ added in v0.4.0
func (pr *ProvideRequest) IsSigned() bool
IsSigned indicates if the ProvideRequest has been signed
func (*ProvideRequest) Sign ¶ added in v0.4.0
func (pr *ProvideRequest) Sign(key crypto.PrivKey) error
Sign a provide request
func (*ProvideRequest) Verify ¶ added in v0.4.0
func (pr *ProvideRequest) Verify() error
type Provider ¶ added in v0.4.0
type Provider struct { Peer peer.AddrInfo ProviderProto []TransferProtocol }
Provider represents the source publishing one or more CIDs
type PutIPNSAsyncResult ¶ added in v0.2.0
type PutIPNSAsyncResult struct {
Err error
}
type TransferProtocol ¶ added in v0.4.0
type TransferProtocol struct { Codec multicodec.Code Payload []byte }
TransferProtocol represents a data transfer protocol
func (*TransferProtocol) ToProto ¶ added in v0.4.0
func (tp *TransferProtocol) ToProto() proto.TransferProtocol
ToProto converts a TransferProtocol to the wire representation