Documentation ¶
Index ¶
- Constants
- Variables
- func GetAllPieceInfoForPayload(dagStore stores.DAGStoreWrapper, pieceStore piecestore.PieceStore, ...) ([]piecestore.PieceInfo, error)
- func GetBestPieceInfoMatch(ctx context.Context, sa retrievalmarket.SectorAccessor, ...) (piecestore.PieceInfo, bool)
- func GetCommonPiecesFromIdentityCidLinks(piecesWithCid func(c cid.Cid) ([]cid.Cid, error), payloadCID cid.Cid) ([]cid.Cid, error)
- func LinksFromIdentityCid(identityCid cid.Cid) ([]cid.Cid, error)
- func PieceInUnsealedSector(ctx context.Context, sa retrievalmarket.SectorAccessor, ...) bool
- type AskGetter
- type GraphsyncUnpaidRetrieval
- func (g *GraphsyncUnpaidRetrieval) CancelTransfer(ctx context.Context, id datatransfer.TransferID, p *peer.ID) error
- func (g *GraphsyncUnpaidRetrieval) List() []retrievalState
- func (g *GraphsyncUnpaidRetrieval) RegisterBlockSentListener(listener graphsync.OnBlockSentListener) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) RegisterIncomingRequestHook(hook graphsync.OnIncomingRequestHook) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) RegisterIncomingRequestQueuedHook(hook graphsync.OnIncomingRequestQueuedHook) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) RegisterOutgoingBlockHook(hook graphsync.OnOutgoingBlockHook) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc
- func (g *GraphsyncUnpaidRetrieval) Start(ctx context.Context)
- func (g *GraphsyncUnpaidRetrieval) SubscribeToDataTransferEvents(subscriber datatransfer.Subscriber) datatransfer.Unsubscribe
- func (g *GraphsyncUnpaidRetrieval) SubscribeToMarketsEvents(subscriber retrievalmarket.ProviderSubscriber) retrievalmarket.Unsubscribe
- func (g *GraphsyncUnpaidRetrieval) SubscribeToValidationEvents(sub retrievalmarket.ProviderValidationSubscriber) retrievalmarket.Unsubscribe
- type ValidationDeps
Constants ¶
const MaxIdentityCIDBytes = 2 << 10
MaxIdentityCIDBytes is the largest identity CID as a PayloadCID that we are willing to decode
const MaxIdentityCIDLinks = 32
MaxIdentityCIDLinks is the maximum number of links contained within an identity CID that we are willing to check for matching pieces
Variables ¶
var EmptyChannelState = channelState{}
EmptyChannelState is the zero value for channel state, meaning not present
Functions ¶
func GetAllPieceInfoForPayload ¶
func GetAllPieceInfoForPayload(dagStore stores.DAGStoreWrapper, pieceStore piecestore.PieceStore, payloadCID cid.Cid) ([]piecestore.PieceInfo, error)
GetAllPieceInfoForPayload returns all of the pieces containing the requested Payload CID. If the Payload CID is an identity CID, then we use getCommonPiecesFromIdentityCidLinks to find pieces containing all of the links within that identity CID. Note that it is possible to receive a non-nil error as well as a non-zero length PieceInfo slice as a return from this function. In that case, there was at least one error encountered querying the piece store.
func GetBestPieceInfoMatch ¶
func GetBestPieceInfoMatch(ctx context.Context, sa retrievalmarket.SectorAccessor, pieces []piecestore.PieceInfo, clientPieceCID cid.Cid) (piecestore.PieceInfo, bool)
GetBestPieceInfoMatch will take a list of pieces, and an optional PieceCID from a client, and will find the best piece to use for a retrieval. If a specific PieceCID is provided and that piece is included in the list of pieces, that is used. Otherwise the first unsealed piece is used and if there are no unsealed pieces, the first sealed piece is used. Failure to find a matching piece will result in a piecestore.PieceInfoUndefined being returned.
func GetCommonPiecesFromIdentityCidLinks ¶
func GetCommonPiecesFromIdentityCidLinks(piecesWithCid func(c cid.Cid) ([]cid.Cid, error), payloadCID cid.Cid) ([]cid.Cid, error)
GetCommonPiecesFromIdentityCidLinks will inspect a payloadCID and if it has an identity multihash, will determine which pieces contain all of the links within the decoded identity multihash block
func LinksFromIdentityCid ¶
func LinksFromIdentityCid(identityCid cid.Cid) ([]cid.Cid, error)
LinksFromIdentityCid will extract zero or more CIDs contained within a valid identity CID. If the CID is not an identity CID, an empty list is returned. If the CID is an identity CID and cannot be decoded, an error is returned.
func PieceInUnsealedSector ¶
func PieceInUnsealedSector(ctx context.Context, sa retrievalmarket.SectorAccessor, pieceInfo piecestore.PieceInfo) bool
Types ¶
type AskGetter ¶
type AskGetter interface {
GetAsk() *retrievalmarket.Ask
}
type GraphsyncUnpaidRetrieval ¶
type GraphsyncUnpaidRetrieval struct { graphsync.GraphExchange // contains filtered or unexported fields }
GraphsyncUnpaidRetrieval intercepts incoming requests to Graphsync. If the request is for a paid retrieval, it is forwarded to the existing Graphsync implementation. If the request is a simple unpaid retrieval, it is handled by this class.
func NewGraphsyncUnpaidRetrieval ¶
func NewGraphsyncUnpaidRetrieval(peerID peer.ID, gs graphsync.GraphExchange, dtnet network.DataTransferNetwork, vdeps ValidationDeps) (*GraphsyncUnpaidRetrieval, error)
func (*GraphsyncUnpaidRetrieval) CancelTransfer ¶
func (g *GraphsyncUnpaidRetrieval) CancelTransfer(ctx context.Context, id datatransfer.TransferID, p *peer.ID) error
func (*GraphsyncUnpaidRetrieval) List ¶
func (g *GraphsyncUnpaidRetrieval) List() []retrievalState
func (*GraphsyncUnpaidRetrieval) RegisterBlockSentListener ¶
func (g *GraphsyncUnpaidRetrieval) RegisterBlockSentListener(listener graphsync.OnBlockSentListener) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) RegisterCompletedResponseListener ¶
func (g *GraphsyncUnpaidRetrieval) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) RegisterIncomingRequestHook ¶
func (g *GraphsyncUnpaidRetrieval) RegisterIncomingRequestHook(hook graphsync.OnIncomingRequestHook) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) RegisterIncomingRequestQueuedHook ¶
func (g *GraphsyncUnpaidRetrieval) RegisterIncomingRequestQueuedHook(hook graphsync.OnIncomingRequestQueuedHook) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) RegisterNetworkErrorListener ¶
func (g *GraphsyncUnpaidRetrieval) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) RegisterOutgoingBlockHook ¶
func (g *GraphsyncUnpaidRetrieval) RegisterOutgoingBlockHook(hook graphsync.OnOutgoingBlockHook) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) RegisterRequestorCancelledListener ¶
func (g *GraphsyncUnpaidRetrieval) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc
func (*GraphsyncUnpaidRetrieval) Start ¶
func (g *GraphsyncUnpaidRetrieval) Start(ctx context.Context)
func (*GraphsyncUnpaidRetrieval) SubscribeToDataTransferEvents ¶
func (g *GraphsyncUnpaidRetrieval) SubscribeToDataTransferEvents(subscriber datatransfer.Subscriber) datatransfer.Unsubscribe
func (*GraphsyncUnpaidRetrieval) SubscribeToMarketsEvents ¶
func (g *GraphsyncUnpaidRetrieval) SubscribeToMarketsEvents(subscriber retrievalmarket.ProviderSubscriber) retrievalmarket.Unsubscribe
func (*GraphsyncUnpaidRetrieval) SubscribeToValidationEvents ¶
func (g *GraphsyncUnpaidRetrieval) SubscribeToValidationEvents(sub retrievalmarket.ProviderValidationSubscriber) retrievalmarket.Unsubscribe
type ValidationDeps ¶
type ValidationDeps struct { DealDecider retrievalimpl.DealDecider DagStore stores.DAGStoreWrapper PieceStore piecestore.PieceStore SectorAccessor retrievalmarket.SectorAccessor AskStore AskGetter }