Documentation
¶
Index ¶
- type Client
- func (c *Client) Find(ctx context.Context, m multihash.Multihash) (*model.FindResponse, error)
- func (c *Client) FindBatch(ctx context.Context, mhs []multihash.Multihash) (*model.FindResponse, error)
- func (c *Client) GetProvider(ctx context.Context, providerID peer.ID) (*model.ProviderInfo, error)
- func (c *Client) GetStats(ctx context.Context) (*model.Stats, error)
- func (c *Client) ListProviders(ctx context.Context) ([]*model.ProviderInfo, error)
- type DHashClient
- type Interface
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.2.0
type Client struct {
// contains filtered or unexported fields
}
Client is an http client for the indexer find API
func (*Client) FindBatch ¶ added in v0.2.0
func (c *Client) FindBatch(ctx context.Context, mhs []multihash.Multihash) (*model.FindResponse, error)
FindBatch looks up content entries for a batch of multihashes
func (*Client) GetProvider ¶ added in v0.2.0
func (*Client) ListProviders ¶ added in v0.2.0
type DHashClient ¶ added in v0.2.0
type DHashClient struct {
// contains filtered or unexported fields
}
func NewDHashClient ¶ added in v0.2.0
func NewDHashClient(dhstoreURL, stiURL string, options ...Option) (*DHashClient, error)
NewDHashClient instantiates a new client that uses Reader Privacy API for querying data. It requires more roundtrips to fullfill one query however it also protects the user from a passive observer. dhstoreURL specifies the URL of the double hashed store that can respond to find encrypted multihash and find encrypted metadata requests. stiURL specifies the URL of indexer that can respond to find provider requests. dhstoreURL and stiURL are expected to be the same when these services are deployed behing a proxy - indexstar.
func (*DHashClient) Find ¶ added in v0.2.0
func (c *DHashClient) Find(ctx context.Context, mh multihash.Multihash) (*model.FindResponse, error)
Find launches FindAsync in a separate go routine and assembles the result into FindResponse as if it was a synchronous invocation.
func (*DHashClient) FindAsync ¶ added in v0.2.0
func (c *DHashClient) FindAsync(ctx context.Context, mh multihash.Multihash, resChan chan<- model.ProviderResult) error
FindAsync implements double hashed lookup workflow. FindAsync returns results on resChan until there are no more results or error. When finished, resChan is closed and the error or nil is returned.
type Interface ¶
type Interface interface {
// Find queries for provider content records for a single multihash.
Find(context.Context, multihash.Multihash) (*model.FindResponse, error)
// FindBatch queries for provider content records for a batch of multihashes.
FindBatch(context.Context, []multihash.Multihash) (*model.FindResponse, error)
// GetProvider gets information about the provider identified by peer.ID.
GetProvider(context.Context, peer.ID) (*model.ProviderInfo, error)
// ListPrividers gets information about all providers known to the indexer.
ListProviders(ctx context.Context) ([]*model.ProviderInfo, error)
// GetStats get statistics for indexer.
GetStats(context.Context) (*model.Stats, error)
}
Interface is the interface implemented by all find clients.