Documentation ¶
Index ¶
- type PeerProviderFinder
- type PeerTagger
- type SessionPeerManager
- func (spm *SessionPeerManager) FindMorePeers(ctx context.Context, c cid.Cid)
- func (spm *SessionPeerManager) GetOptimizedPeers() []bssd.OptimizedPeer
- func (spm *SessionPeerManager) RecordCancels(ks []cid.Cid)
- func (spm *SessionPeerManager) RecordPeerRequests(p []peer.ID, ks []cid.Cid)
- func (spm *SessionPeerManager) RecordPeerResponse(p peer.ID, ks []cid.Cid)
- func (spm *SessionPeerManager) SetTimeoutDuration(timeoutDuration time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerProviderFinder ¶
PeerProviderFinder is an interface for finding providers
type PeerTagger ¶
PeerTagger is an interface for tagging peers with metadata
type SessionPeerManager ¶
type SessionPeerManager struct {
// contains filtered or unexported fields
}
SessionPeerManager tracks and manages peers for a session, and provides the best ones to the session
func New ¶
func New(ctx context.Context, id uint64, tagger PeerTagger, providerFinder PeerProviderFinder) *SessionPeerManager
New creates a new SessionPeerManager
func (*SessionPeerManager) FindMorePeers ¶
func (spm *SessionPeerManager) FindMorePeers(ctx context.Context, c cid.Cid)
FindMorePeers attempts to find more peers for a session by searching for providers for the given Cid
func (*SessionPeerManager) GetOptimizedPeers ¶
func (spm *SessionPeerManager) GetOptimizedPeers() []bssd.OptimizedPeer
GetOptimizedPeers returns the best peers available for a session, along with a rating for how good they are, in comparison to the best peer.
func (*SessionPeerManager) RecordCancels ¶
func (spm *SessionPeerManager) RecordCancels(ks []cid.Cid)
RecordCancels records the fact that cancellations were sent to peers, so if blocks don't arrive, don't let it affect the peer's timeout
func (*SessionPeerManager) RecordPeerRequests ¶
func (spm *SessionPeerManager) RecordPeerRequests(p []peer.ID, ks []cid.Cid)
RecordPeerRequests records that a given set of peers requested the given cids.
func (*SessionPeerManager) RecordPeerResponse ¶
func (spm *SessionPeerManager) RecordPeerResponse(p peer.ID, ks []cid.Cid)
RecordPeerResponse records that a peer received some blocks, and adds the peer to the list of peers if it wasn't already added
func (*SessionPeerManager) SetTimeoutDuration ¶
func (spm *SessionPeerManager) SetTimeoutDuration(timeoutDuration time.Duration)
SetTimeoutDuration changes the length of time used to timeout recording of requests