types

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const FilecoinPrecision = uint64(1_000_000_000_000_000_000)

Variables

This section is empty.

Functions

This section is empty.

Types

type CandidateRetriever added in v0.3.0

type CandidateRetriever func(ctx context.Context, request RetrievalRequest, candidates []RetrievalCandidate, events func(RetrievalEvent)) (*RetrievalStats, error)

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 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
}

func NewRetrievalCandidate added in v0.3.0

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

type RetrievalCandidateFinder added in v0.3.0

type RetrievalCandidateFinder func(ctx context.Context, request RetrievalRequest, events func(RetrievalEvent)) ([]RetrievalCandidate, 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
}

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 additionl 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 (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 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
}

type Retriever added in v0.3.0

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

func WithCandidates added in v0.3.0

func WithCandidates(retrievalCandidateFinder RetrievalCandidateFinder, childRetriever CandidateRetriever) Retriever

Jump to

Keyboard shortcuts

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