types

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0, MIT Imports: 19 Imported by: 11

Documentation

Index

Constants

View Source
const (
	RaceCoordination       = "race"
	SequentialCoordination = "sequential"
)
View Source
const BitswapIndentifier = "Bitswap"
View Source
const FilecoinPrecision = uint64(1_000_000_000_000_000_000)

Variables

View Source
var ErrIncorrectContextValue = errors.New("context key does not point to a valid retrieval id")

ErrIncorrectContextValue indicates a value for the retrieval id context key that wasn't a retrieval id

View Source
var ErrMissingContextKey = errors.New("context key for retrieval is missing")

ErrMissingContextKey indicates no retrieval context key was present for a given context

Functions

func Identifier added in v0.4.0

func Identifier(event RetrievalEvent) string

func QueryResponseFromReader added in v0.4.0

func QueryResponseFromReader(r io.Reader) (*retrievalmarket.QueryResponse, error)

QueryResponseFromReader reads a QueryResponse object in dag-cbor form from a stream

func QueryToWriter added in v0.4.0

func QueryToWriter(q *retrievalmarket.Query, w io.Writer) error

QueryToWriter writes a Query object in dag-cbor form to a stream

func RegisterRetrievalIDToContext added in v0.4.0

func RegisterRetrievalIDToContext(parentCtx context.Context, id RetrievalID) context.Context

Types

type CandidateFinder added in v0.4.0

type CandidateFinder interface {
	FindCandidates(ctx context.Context, request RetrievalRequest, events func(RetrievalEvent)) ([]RetrievalCandidate, error)
}

type CandidateRetrieval added in v0.4.0

type CandidateRetrieval interface {
	RetrieveFromCandidates([]RetrievalCandidate) (*RetrievalStats, error)
}

type CandidateRetrievalCall added in v0.4.0

type CandidateRetrievalCall struct {
	Candidates         []RetrievalCandidate
	CandidateRetrieval CandidateRetrieval
}

type CandidateRetriever added in v0.3.0

type CandidateRetriever interface {
	Retrieve(ctx context.Context, request RetrievalRequest, events func(RetrievalEvent)) CandidateRetrieval
}

type CandidateSplitter added in v0.4.0

type CandidateSplitter interface {
	SplitRetrieval(ctx context.Context, request RetrievalRequest, events func(RetrievalEvent)) RetrievalSplitter
}

type CoordinationKind added in v0.4.0

type CoordinationKind string

type EventCode added in v0.3.0

type EventCode string
const (
	CandidatesFoundCode    EventCode = "candidates-found"
	CandidatesFilteredCode EventCode = "candidates-filtered"
	StartedCode            EventCode = "started"
	ConnectedCode          EventCode = "connected"
	QueryAskedCode         EventCode = "query-asked"
	QueryAskedFilteredCode EventCode = "query-asked-filtered"
	ProposedCode           EventCode = "proposed"
	AcceptedCode           EventCode = "accepted"
	FirstByteCode          EventCode = "first-byte-received"
	FailedCode             EventCode = "failure"
	SuccessCode            EventCode = "success"
)

type FIL

type FIL gostatetypesbig.Int

func (FIL) String

func (f FIL) String() string

func (FIL) Unitless

func (f FIL) Unitless() string

type FindCandidatesResult added in v0.4.0

type FindCandidatesResult struct {
	Candidate RetrievalCandidate
	Err       error
}

type Phase added in v0.3.0

type Phase string
const (
	// IndexerPhase involves a candidates-found|failure
	IndexerPhase Phase = "indexer"
	// QueryPhase involves a connect, query-asked|failure
	QueryPhase Phase = "query"
	// RetrievalPhase involves the full data retrieval: connect, proposed, accepted, first-byte-received, success|failure
	RetrievalPhase Phase = "retrieval"
)

type RetrievalCandidate added in v0.3.0

type RetrievalCandidate struct {
	MinerPeer peer.AddrInfo
	RootCid   cid.Cid
	Metadata  metadata.Metadata
}

func NewRetrievalCandidate added in v0.3.0

func NewRetrievalCandidate(pid peer.ID, rootCid cid.Cid, protocols ...metadata.Protocol) RetrievalCandidate

type RetrievalCoordinator added in v0.4.0

type RetrievalCoordinator func(context.Context, []CandidateRetrievalCall) (*RetrievalStats, error)

type RetrievalEvent added in v0.3.0

type RetrievalEvent interface {
	// Time returns the time that the event occurred
	Time() time.Time
	// RetrievalId returns the unique ID for this retrieval
	RetrievalId() RetrievalID
	// Code returns the type of event this is
	Code() EventCode
	// Phase returns what phase of a retrieval this even occurred on
	Phase() Phase
	// PhaseStartTime returns the time that the phase started for this storage provider
	PhaseStartTime() time.Time
	// PayloadCid returns the CID being requested
	PayloadCid() cid.Cid
	// StorageProviderId returns the peer ID of the storage provider if this
	// retrieval was requested via peer ID
	StorageProviderId() peer.ID
	// Protocol
	Protocols() []multicodec.Code
}

type RetrievalEventSubscriber added in v0.3.0

type RetrievalEventSubscriber func(event RetrievalEvent)

RetrievalEventSubscriber is a function that receives a stream of retrieval events from all retrievals that are in progress. Various different types implement the RetrievalEvent interface and may contain additional information about the event beyond what is available on the RetrievalEvent interface.

type RetrievalID added in v0.3.0

type RetrievalID uuid.UUID

func NewRetrievalID added in v0.3.0

func NewRetrievalID() (RetrievalID, error)

func RetrievalIDFromContext added in v0.4.0

func RetrievalIDFromContext(ctx context.Context) (RetrievalID, error)

func (RetrievalID) MarshalText added in v0.3.0

func (id RetrievalID) MarshalText() ([]byte, error)

func (RetrievalID) String added in v0.3.0

func (id RetrievalID) String() string

func (*RetrievalID) UnmarshalText added in v0.3.0

func (id *RetrievalID) UnmarshalText(data []byte) error

type RetrievalRequest added in v0.3.0

type RetrievalRequest struct {
	RetrievalID RetrievalID
	Cid         cid.Cid
	LinkSystem  ipld.LinkSystem
}

RetrievalRequest is the top level parameters for a request -- this should be left unchanged as you move down a retriever tree

type RetrievalResult added in v0.4.0

type RetrievalResult struct {
	Stats *RetrievalStats
	Err   error
}

type RetrievalSplitter added in v0.4.0

type RetrievalSplitter interface {
	SplitCandidates([]RetrievalCandidate) ([][]RetrievalCandidate, error)
}

type RetrievalStats added in v0.3.0

type RetrievalStats struct {
	StorageProviderId peer.ID
	RootCid           cid.Cid
	Size              uint64
	Blocks            uint64
	Duration          time.Duration
	AverageSpeed      uint64
	TotalPayment      abi.TokenAmount
	NumPayments       int
	AskPrice          abi.TokenAmount
	TimeToFirstByte   time.Duration
}

type Retriever added in v0.3.0

type Retriever interface {
	Retrieve(ctx context.Context, request RetrievalRequest, events func(RetrievalEvent)) (*RetrievalStats, error)
}

Jump to

Keyboard shortcuts

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