session

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: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetProviderSearchDelay

func SetProviderSearchDelay(newProvSearchDelay time.Duration)

SetProviderSearchDelay overwrites the global provider search delay

Types

type PeerManager

type PeerManager interface {
	FindMorePeers(context.Context, cid.Cid)
	GetOptimizedPeers() []peer.ID
	RecordPeerRequests([]peer.ID, []cid.Cid)
	RecordPeerResponse(peer.ID, cid.Cid)
}

PeerManager provides an interface for tracking and optimize peers, and requesting more when neccesary.

type RequestSplitter

type RequestSplitter interface {
	SplitRequest([]peer.ID, []cid.Cid) []*bssrs.PartialRequest
	RecordDuplicateBlock()
	RecordUniqueBlock()
}

RequestSplitter provides an interface for splitting a request for Cids up among peers.

type Session

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

Session holds state for an individual bitswap transfer operation. This allows bitswap to make smarter decisions about who to send wantlist info to, and who to request blocks from.

func New

New creates a new bitswap session whose lifetime is bounded by the given context.

func (*Session) GetAverageLatency

func (s *Session) GetAverageLatency() time.Duration

GetAverageLatency returns the average latency for block requests.

func (*Session) GetBlock

func (s *Session) GetBlock(parent context.Context, k cid.Cid) (blocks.Block, error)

GetBlock fetches a single block.

func (*Session) GetBlocks

func (s *Session) GetBlocks(ctx context.Context, keys []cid.Cid) (<-chan blocks.Block, error)

GetBlocks fetches a set of blocks within the context of this session and returns a channel that found blocks will be returned on. No order is guaranteed on the returned blocks.

func (*Session) InterestedIn

func (s *Session) InterestedIn(c cid.Cid) bool

InterestedIn returns true if this session is interested in the given Cid.

func (*Session) ReceiveBlockFrom

func (s *Session) ReceiveBlockFrom(from peer.ID, blk blocks.Block)

ReceiveBlockFrom receives an incoming block from the given peer.

func (*Session) SetBaseTickDelay

func (s *Session) SetBaseTickDelay(baseTickDelay time.Duration)

SetBaseTickDelay changes the rate at which ticks happen.

func (*Session) UpdateReceiveCounters

func (s *Session) UpdateReceiveCounters(blk blocks.Block)

UpdateReceiveCounters updates receive counters for a block, which may be a duplicate and adjusts the split factor based on that.

type WantManager

type WantManager interface {
	WantBlocks(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)
	CancelWants(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)
}

WantManager is an interface that can be used to request blocks from given peers.

Jump to

Keyboard shortcuts

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