client

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an http client for the indexer ingest API

func New

func New(baseURL string, options ...Option) (*Client, error)

New creates a new ingest http client. If an http.Client is not provide by the WithClient option, then the default client is used.

func (*Client) Announce

func (c *Client) Announce(ctx context.Context, provider *peer.AddrInfo, root cid.Cid) error

Announce announces a new root CID directly to the indexer.

func (*Client) IndexContent

func (c *Client) IndexContent(ctx context.Context, providerID peer.ID, privateKey p2pcrypto.PrivKey, m multihash.Multihash, contextID []byte, metadata []byte, addrs []string) error

IndexContent creates an index directly on the indexer. This bypasses the process of ingesting advertisements. It is used to index special one-off content that is outside of an advertisement chain, and is intentionally limited to indexing a single multihash.

func (*Client) Register

func (c *Client) Register(ctx context.Context, providerID peer.ID, privateKey p2pcrypto.PrivKey, addrs []string) error

Register registers a provider directly with an indexer. The primary use is update an indexer with new provider addresses without having to wait until a new advertisement is ingested.

type Interface

type Interface interface {
	// Announce announces a new head CID directly to the indexer.
	Announce(ctx context.Context, provider *peer.AddrInfo, root cid.Cid) error
	// IndexContent creates an index directly on the indexer.
	IndexContent(ctx context.Context, providerID peer.ID, privateKey crypto.PrivKey, m multihash.Multihash, contextID []byte, metadata []byte, addrs []string) error
	// Register registers a provider directly with an indexer.
	Register(ctx context.Context, providerID peer.ID, privateKey crypto.PrivKey, addrs []string) error
}

Interface is the interface implemented by all ingest clients.

type Option

type Option func(*config) error

Option is a function that sets a value in a config.

func WithClient

func WithClient(c *http.Client) Option

WithClient allows creation of the http client using an underlying network round tripper / client.

Jump to

Keyboard shortcuts

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