Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorCode ¶
type ErrorCode string
const ( ErrorCodeNone ErrorCode = "" InvalidPeerID ErrorCode = "invalid_peerid" NoValidMultiAddrs ErrorCode = "no_valid_multiaddrs" CannotConnect ErrorCode = "cannot_connect" NotFound ErrorCode = "not_found" RetrievalFailure ErrorCode = "retrieval_failure" ProtocolNotSupported ErrorCode = "protocol_not_supported" Timeout ErrorCode = "timeout" DealRejectedPricePerByteTooLow ErrorCode = "deal_rejected_price_per_byte_too_low" DealRejectedUnsealPriceTooLow ErrorCode = "deal_rejected_unseal_price_too_low" Throttled ErrorCode = "throttled" NoAccess ErrorCode = "no_access" UnderMaintenance ErrorCode = "under_maintenance" NotOnline ErrorCode = "not_online" UnconfirmedBlockTransfer ErrorCode = "unconfirmed_block_transfer" CIDCodecNotSupported ErrorCode = "cid_codec_not_supported" ResponseRejected ErrorCode = "response_rejected" DealStateMissing ErrorCode = "deal_state_missing" )
type ModuleName ¶
type ModuleName string
const ( Stub ModuleName = "stub" GraphSync ModuleName = "graphsync" HTTP ModuleName = "http" Bitswap ModuleName = "bitswap" )
type Provider ¶
type Provider struct { // In case of attempting retrieval from any miner, this field will be empty ID string `bson:"id"` PeerID string `bson:"peer_id,omitempty"` Multiaddrs []string `bson:"multiaddrs,omitempty"` City string `bson:"city,omitempty"` Region string `bson:"region,omitempty"` Country string `bson:"country,omitempty"` Continent string `bson:"continent,omitempty"` }
type Result ¶
type Result struct { Task Retriever Retriever `bson:"retriever"` Result RetrievalResult `bson:"result"` CreatedAt time.Time `bson:"created_at"` }
type RetrievalResult ¶
type RetrievalResult struct { Success bool `bson:"success"` ErrorCode ErrorCode `bson:"error_code,omitempty"` ErrorMessage string `bson:"error_message,omitempty"` TTFB time.Duration `bson:"ttfb,omitempty"` Speed float64 `bson:"speed,omitempty"` Duration time.Duration `bson:"duration,omitempty"` Downloaded int64 `bson:"downloaded,omitempty"` }
func NewErrorRetrievalResult ¶
func NewErrorRetrievalResult(code ErrorCode, err error) *RetrievalResult
func NewErrorRetrievalResultWithErrorResolution ¶
func NewErrorRetrievalResultWithErrorResolution(code ErrorCode, err error) *RetrievalResult
type Task ¶
type Task struct { Requester string `bson:"requester"` Module ModuleName `bson:"module"` Metadata map[string]string `bson:"metadata,omitempty"` Provider Provider `bson:"provider"` Content Content `bson:"content"` Timeout time.Duration `bson:"timeout,omitempty"` CreatedAt time.Time `bson:"created_at"` }
type Worker ¶
type Worker interface {
DoWork(task Task) (*RetrievalResult, error)
}
type WorkerProcess ¶
type WorkerProcess struct {
// contains filtered or unexported fields
}
func NewTaskWorkerProcess ¶
func NewTaskWorkerProcess( ctx context.Context, module ModuleName, worker Worker) (*WorkerProcess, error)
func (WorkerProcess) Close ¶
func (t WorkerProcess) Close()
Click to show internal directories.
Click to hide internal directories.