session

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProviderBlockList  map[peer.ID]bool
	ProviderAllowList  map[peer.ID]bool
	DefaultMinerConfig MinerConfig
	MinerConfigs       map[peer.ID]MinerConfig
	PaidRetrievals     bool
}

All config values should be safe to leave uninitialized

type MinerConfig

type MinerConfig struct {
	RetrievalTimeout        time.Duration
	MaxConcurrentRetrievals uint
}

type Session

type Session struct {
	State
	// contains filtered or unexported fields
}

func NewSession

func NewSession(config Config, withState bool) *Session

func (*Session) FilterIndexerCandidate

func (s *Session) FilterIndexerCandidate(candidate types.RetrievalCandidate) (bool, types.RetrievalCandidate)

isAcceptableStorageProvider checks whether the storage provider in question is acceptable as a retrieval candidate. It checks the blacklists and whitelists, the miner monitor for failures and whether we are already at concurrency limit for this SP.

func (*Session) GetStorageProviderTimeout

func (s *Session) GetStorageProviderTimeout(storageProviderId peer.ID) time.Duration

func (*Session) IsAcceptableQueryResponse

func (s *Session) IsAcceptableQueryResponse(peer peer.ID, req types.RetrievalRequest, queryResponse *retrievaltypes.QueryResponse) bool

IsAcceptableQueryResponse determines whether a queryResponse is acceptable according to the current configuration. For now this is just checking whether PaidRetrievals is set and not accepting paid retrievals if so.

type State

type State interface {
	RecordFailure(storageProviderId peer.ID, retrievalId types.RetrievalID) error
	RemoveStorageProviderFromRetrieval(storageProviderId peer.ID, retrievalId types.RetrievalID) error
	IsSuspended(storageProviderId peer.ID) bool
	GetConcurrency(storageProviderId peer.ID) uint
	AddToRetrieval(retrievalId types.RetrievalID, storageProviderIds []peer.ID) error
	EndRetrieval(retrievalId types.RetrievalID) error
	RegisterRetrieval(retrievalId types.RetrievalID, cid cid.Cid, selector datamodel.Node) bool
}

Jump to

Keyboard shortcuts

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