Documentation ¶
Index ¶
- type Opts
- type RetrievalManager
- func (mgr *RetrievalManager) CleanIncomingProcesses(ctx context.Context) error
- func (mgr *RetrievalManager) CleanOutgoingProcesses(ctx context.Context) error
- func (mgr *RetrievalManager) CleanRetrievalCache(ctx context.Context) error
- func (mgr *RetrievalManager) GetRetrievalCacheSize(ctx context.Context) (uint64, error)
- func (mgr *RetrievalManager) OnNetworkErrorListener(p peer.ID, request gs.RequestData, err error)
- func (mgr *RetrievalManager) OnRequestorCancelledListener(p peer.ID, request gs.RequestData)
- func (mgr *RetrievalManager) Retrieve(ctx context.Context, pieceOffer fcroffer.PieceOffer, ...) (<-chan gs.ResponseProgress, <-chan error)
- func (mgr *RetrievalManager) RetrieveFromCache(ctx context.Context, root cid.Cid, outPath string) (bool, error)
- func (mgr *RetrievalManager) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opts ¶
type Opts struct { // The retrieval cache path. CachePath string // The temp path to store incoming retrieval states. TempPath string // The timeout for every network io operation. IOTimeout time.Duration // The timeout for every internal operation. OpTimeout time.Duration }
Opts is the options for retrieval manager.
type RetrievalManager ¶
type RetrievalManager struct {
// contains filtered or unexported fields
}
RetrievalManager manages data retrieval.
func NewRetrievalManager ¶
func NewRetrievalManager( ctx context.Context, h host.Host, addrProto *addrproto.AddrProtocol, payProto *payproto.PayProtocol, signer crypto.Signer, peerMgr peermgr.PeerManager, pieceMgr piecemgr.PieceManager, opts Opts, ) (*RetrievalManager, error)
NewRetrievalManager creates a new retrieval manager.
@input - context, host, addr protocol, pay protocol, signer, peer manager, piece manager, options.
@output - retrieval manager, error.
func (*RetrievalManager) CleanIncomingProcesses ¶
func (mgr *RetrievalManager) CleanIncomingProcesses(ctx context.Context) error
CleanIncomingProcesses will clean the incoming processes.
@input - context.
@output - error.
func (*RetrievalManager) CleanOutgoingProcesses ¶
func (mgr *RetrievalManager) CleanOutgoingProcesses(ctx context.Context) error
CleanOutgoingProcesses will clean the outgoing processes.
@input - context.
@output - error.
func (*RetrievalManager) CleanRetrievalCache ¶
func (mgr *RetrievalManager) CleanRetrievalCache(ctx context.Context) error
CleanRetrievalCache will clean the cache DB.
@output - error.
func (*RetrievalManager) GetRetrievalCacheSize ¶
func (mgr *RetrievalManager) GetRetrievalCacheSize(ctx context.Context) (uint64, error)
GetRetrievalCacheSize gets the current cache DB size in bytes.
@output - size, error.
func (*RetrievalManager) OnNetworkErrorListener ¶
func (mgr *RetrievalManager) OnNetworkErrorListener(p peer.ID, request gs.RequestData, err error)
OnNetworkErrorListener is the hook called when retrieval has network error.
func (*RetrievalManager) OnRequestorCancelledListener ¶
func (mgr *RetrievalManager) OnRequestorCancelledListener(p peer.ID, request gs.RequestData)
OnRequestorCancelledListener is the hook called when retrieval is cancelled.
func (*RetrievalManager) Retrieve ¶
func (mgr *RetrievalManager) Retrieve(ctx context.Context, pieceOffer fcroffer.PieceOffer, payOffer *fcroffer.PayOffer, resCh string, resID uint64, outPath string) (<-chan gs.ResponseProgress, <-chan error)
Retrieve is used to retrieve a piece based on a given piece offer and a given reserved channel to given path.
@input - context, piece offer, optional pay offer, reserved channel id, reservation id, output path.
@output - response progress chan out, error chan out.
func (*RetrievalManager) RetrieveFromCache ¶
func (mgr *RetrievalManager) RetrieveFromCache(ctx context.Context, root cid.Cid, outPath string) (bool, error)
RetrieveFromCache is used to retrieve a piece from given root id to given path.
@input - context, root id, output path.
@output - if found in cache, error.
func (*RetrievalManager) Shutdown ¶
func (mgr *RetrievalManager) Shutdown()
Shutdown safely shuts down the component.