sessionpeermanager

package
v0.0.0-...-8b9b725 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT, MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerProviderFinder

type PeerProviderFinder interface {
	FindProvidersAsync(context.Context, cid.Cid) <-chan peer.ID
}

PeerProviderFinder is an interface for finding providers

type PeerTagger

type PeerTagger interface {
	TagPeer(peer.ID, string, int)
	UntagPeer(p peer.ID, tag string)
}

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() []peer.ID

GetOptimizedPeers returns the best peers available for a session

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, k cid.Cid)

RecordPeerResponse records that a peer received a block, and adds to it the list of peers if it wasn't already added

Jump to

Keyboard shortcuts

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