client

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0, MIT Imports: 37 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RetrievalQueryProtocol = "/fil/retrieval/qry/1.0.0"
)

Variables

View Source
var (
	Tracer = otel.Tracer("retrieve-client")
)

Functions

func RetrievalProposalForAsk

func RetrievalProposalForAsk(ask *retrievalmarket.QueryResponse, c cid.Cid, optionalSelector ipld.Node) (*retrievalmarket.DealProposal, error)

Types

type Client

type Client struct {
	ClientAddr address.Address
	// contains filtered or unexported fields
}

func NewClient

func NewClient(h host.Host, api api.Gateway, w *wallet.LocalWallet, addr address.Address, bs blockstore.Blockstore, ds datastore.Batching, ddir string, opts ...func(*Config)) (*Client, error)

func NewClientWithConfig

func NewClientWithConfig(cfg *Config) (*Client, error)

func (*Client) ConnectToMiner

func (c *Client) ConnectToMiner(ctx context.Context, maddr address.Address) (peer.ID, error)

func (*Client) MinerPeer

func (c *Client) MinerPeer(ctx context.Context, miner address.Address) (peer.AddrInfo, error)

func (*Client) RetrievalQuery

func (c *Client) RetrievalQuery(ctx context.Context, maddr address.Address, pcid cid.Cid) (*retrievalmarket.QueryResponse, error)

func (*Client) RetrieveContentWithProgressCallback

func (c *Client) RetrieveContentWithProgressCallback(
	ctx context.Context,
	miner address.Address,
	proposal *retrievalmarket.DealProposal,
	progressCallback func(bytesReceived uint64),
) (*RetrievalStats, error)

type Config

type Config struct {
	DataDir                    string
	GraphsyncOpts              []gsimpl.Option
	Api                        api.Gateway
	Wallet                     *wallet.LocalWallet
	Addr                       address.Address
	Blockstore                 blockstore.Blockstore
	Datastore                  datastore.Batching
	Host                       host.Host
	ChannelMonitorConfig       channelmonitor.Config
	RetrievalConfigurer        datatransfer.TransportConfigurer
	LogRetrievalProgressEvents bool
}

type RetrievalStats

type RetrievalStats struct {
	Peer         peer.ID
	Size         uint64
	Duration     time.Duration
	AverageSpeed uint64
	TotalPayment abi.TokenAmount
	NumPayments  int
	AskPrice     abi.TokenAmount
}

Jump to

Keyboard shortcuts

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