Documentation ¶
Index ¶
- Variables
- func RetrievalProposalForAsk(ask *retrievalmarket.QueryResponse, c cid.Cid, optionalSelector ipld.Node) (*retrievalmarket.DealProposal, error)
- type CandidateCallback
- type CandidateErrorCallback
- type CandidateFinder
- type CounterCallback
- type Executor
- type GetStorageProviderTimeout
- type IsAcceptableQueryResponse
- type IsAcceptableStorageProvider
- type MinerConfig
- type RetrievalCandidateFinder
- type RetrievalClient
- type Retriever
- func (retriever *Retriever) RegisterSubscriber(subscriber types.RetrievalEventSubscriber) func()
- func (retriever *Retriever) Retrieve(ctx context.Context, request types.RetrievalRequest, ...) (*types.RetrievalStats, error)
- func (retriever *Retriever) Start()
- func (retriever *Retriever) Stop() chan struct{}
- type RetrieverConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrRetrieverNotStarted = errors.New("retriever not started") ErrDealProposalFailed = errors.New("deal proposal failed") ErrNoCandidates = errors.New("no candidates") ErrUnexpectedRetrieval = errors.New("unexpected active retrieval") ErrHitRetrievalLimit = errors.New("hit retrieval limit") ErrProposalCreationFailed = errors.New("proposal creation failed") ErrRetrievalRegistrationFailed = errors.New("retrieval registration failed") ErrRetrievalFailed = errors.New("retrieval failed") ErrAllRetrievalsFailed = errors.New("all retrievals failed") ErrQueryFailed = errors.New("query failed") ErrAllQueriesFailed = errors.New("all queries failed") ErrRetrievalTimedOut = errors.New("retrieval timed out") ErrRetrievalAlreadyRunning = errors.New("retrieval already running for CID") )
Functions ¶
func RetrievalProposalForAsk ¶
func RetrievalProposalForAsk(ask *retrievalmarket.QueryResponse, c cid.Cid, optionalSelector ipld.Node) (*retrievalmarket.DealProposal, error)
Types ¶
type CandidateCallback ¶
type CandidateCallback func(types.RetrievalCandidate) error
type CandidateErrorCallback ¶
type CandidateErrorCallback func(types.RetrievalCandidate, error)
type CandidateFinder ¶
type CandidateFinder interface {
FindCandidates(context.Context, cid.Cid) ([]types.RetrievalCandidate, error)
}
type CounterCallback ¶
type Executor ¶ added in v0.3.0
type Executor struct { GetStorageProviderTimeout GetStorageProviderTimeout IsAcceptableStorageProvider IsAcceptableStorageProvider IsAcceptableQueryResponse IsAcceptableQueryResponse Client RetrievalClient // contains filtered or unexported fields }
func (*Executor) RetrieveFromCandidates ¶ added in v0.3.0
func (cfg *Executor) RetrieveFromCandidates( ctx context.Context, retrievalRequest types.RetrievalRequest, candidates []types.RetrievalCandidate, eventsCallback func(types.RetrievalEvent), ) (*types.RetrievalStats, error)
RetrieveFromCandidates performs a retrieval for a given CID by querying the indexer, then attempting to query all candidates and attempting to perform a full retrieval from the best and fastest storage provider as the queries are received.
type IsAcceptableQueryResponse ¶
type IsAcceptableQueryResponse func(peer peer.ID, req types.RetrievalRequest, queryResponse *retrievalmarket.QueryResponse) bool
type MinerConfig ¶
type RetrievalCandidateFinder ¶ added in v0.3.0
type RetrievalCandidateFinder struct {
// contains filtered or unexported fields
}
RetrievalCandidateFinder finds and filters candidates for a given retrieval
func NewRetrievalCandidateFinder ¶ added in v0.3.0
func NewRetrievalCandidateFinder(candidateFinder CandidateFinder, isAcceptableStorageProvider IsAcceptableStorageProvider) *RetrievalCandidateFinder
func (*RetrievalCandidateFinder) FindCandidates ¶ added in v0.3.0
func (rcf *RetrievalCandidateFinder) FindCandidates(ctx context.Context, request types.RetrievalRequest, eventsCallback func(types.RetrievalEvent)) ([]types.RetrievalCandidate, error)
type RetrievalClient ¶
type RetrievalClient interface { RetrievalQueryToPeer( ctx context.Context, minerPeer peer.AddrInfo, cid cid.Cid, onConnected func(), ) (*retrievalmarket.QueryResponse, error) RetrieveFromPeer( ctx context.Context, linkSystem ipld.LinkSystem, peerID peer.ID, minerWallet address.Address, proposal *retrievalmarket.DealProposal, eventsCallback datatransfer.Subscriber, gracefulShutdownRequested <-chan struct{}, ) (*types.RetrievalStats, error) }
type Retriever ¶
type Retriever struct {
// contains filtered or unexported fields
}
func NewRetriever ¶
func NewRetriever( ctx context.Context, config RetrieverConfig, client RetrievalClient, candidateFinder CandidateFinder, ) (*Retriever, error)
func (*Retriever) RegisterSubscriber ¶ added in v0.3.0
func (retriever *Retriever) RegisterSubscriber(subscriber types.RetrievalEventSubscriber) func()
RegisterSubscriber registers a subscriber to receive all events fired during the process of making a retrieval, including the process of querying available storage providers to find compatible ones to attempt retrieval from.
func (*Retriever) Retrieve ¶
func (retriever *Retriever) Retrieve( ctx context.Context, request types.RetrievalRequest, eventsCB func(types.RetrievalEvent), ) (*types.RetrievalStats, error)
Retrieve attempts to retrieve the given CID using the configured CandidateFinder to find storage providers that should have the CID.
type RetrieverConfig ¶
type RetrieverConfig struct { MinerBlacklist map[peer.ID]bool MinerWhitelist map[peer.ID]bool DefaultMinerConfig MinerConfig MinerConfigs map[peer.ID]MinerConfig PaidRetrievals bool }
All config values should be safe to leave uninitialized