server

package
v1.7.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0, MIT Imports: 34 Imported by: 5

Documentation

Index

Constants

View Source
const MaxIdentityCIDBytes = 2 << 10

MaxIdentityCIDBytes is the largest identity CID as a PayloadCID that we are willing to decode

View Source
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

View Source
var EmptyChannelState = channelState{}

EmptyChannelState is the zero value for channel state, meaning not present

View Source
var ErrRetrievalNotFound = fmt.Errorf("no transfer found")

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(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 (*GraphsyncUnpaidRetrieval) CancelTransfer

func (*GraphsyncUnpaidRetrieval) List

func (g *GraphsyncUnpaidRetrieval) List() []retrievalState

func (*GraphsyncUnpaidRetrieval) RegisterBlockSentListener

func (*GraphsyncUnpaidRetrieval) RegisterCompletedResponseListener

func (g *GraphsyncUnpaidRetrieval) RegisterCompletedResponseListener(listener graphsync.OnResponseCompletedListener) graphsync.UnregisterHookFunc

func (*GraphsyncUnpaidRetrieval) RegisterIncomingRequestHook

Called by graphsync when an incoming request is processed

func (*GraphsyncUnpaidRetrieval) RegisterIncomingRequestQueuedHook

Called when a transfer is received by graphsync and queued for processing

func (*GraphsyncUnpaidRetrieval) RegisterNetworkErrorListener

func (g *GraphsyncUnpaidRetrieval) RegisterNetworkErrorListener(listener graphsync.OnNetworkErrorListener) graphsync.UnregisterHookFunc

func (*GraphsyncUnpaidRetrieval) RegisterOutgoingBlockHook

func (*GraphsyncUnpaidRetrieval) RegisterRequestorCancelledListener

func (g *GraphsyncUnpaidRetrieval) RegisterRequestorCancelledListener(listener graphsync.OnRequestorCancelledListener) graphsync.UnregisterHookFunc

func (*GraphsyncUnpaidRetrieval) Start

func (*GraphsyncUnpaidRetrieval) SubscribeToDataTransferEvents

func (g *GraphsyncUnpaidRetrieval) SubscribeToDataTransferEvents(subscriber datatransfer.Subscriber) datatransfer.Unsubscribe

func (*GraphsyncUnpaidRetrieval) SubscribeToMarketsEvents

func (*GraphsyncUnpaidRetrieval) SubscribeToValidationEvents

type LinkSystemProvider added in v1.7.3

type LinkSystemProvider interface {
	LinkSys() *ipld.LinkSystem
}

type RetrievalType added in v1.7.3

type RetrievalType string
const RetrievalTypeDeal RetrievalType = "Deal"
const RetrievalTypeLegs RetrievalType = "Legs"

type ValidationDeps

type ValidationDeps struct {
	DealDecider    retrievalimpl.DealDecider
	DagStore       stores.DAGStoreWrapper
	PieceStore     piecestore.PieceStore
	SectorAccessor retrievalmarket.SectorAccessor
	AskStore       AskGetter
}

Jump to

Keyboard shortcuts

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