Documentation ¶
Index ¶
- func SetProviderSearchDelay(newProvSearchDelay time.Duration)
- type PeerManager
- type RequestSplitter
- type Session
- func (s *Session) GetAverageLatency() time.Duration
- func (s *Session) GetBlock(parent context.Context, k cid.Cid) (blocks.Block, error)
- func (s *Session) GetBlocks(ctx context.Context, keys []cid.Cid) (<-chan blocks.Block, error)
- func (s *Session) InterestedIn(c cid.Cid) bool
- func (s *Session) ReceiveBlockFrom(from peer.ID, blk blocks.Block)
- func (s *Session) SetBaseTickDelay(baseTickDelay time.Duration)
- func (s *Session) UpdateReceiveCounters(blk blocks.Block)
- type WantManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetProviderSearchDelay ¶
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 ¶
func New(ctx context.Context, id uint64, wm WantManager, pm PeerManager, srs RequestSplitter) *Session
New creates a new bitswap session whose lifetime is bounded by the given context.
func (*Session) GetAverageLatency ¶
GetAverageLatency returns the average latency for block requests.
func (*Session) GetBlocks ¶
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 ¶
InterestedIn returns true if this session is interested in the given Cid.
func (*Session) ReceiveBlockFrom ¶
ReceiveBlockFrom receives an incoming block from the given peer.
func (*Session) SetBaseTickDelay ¶
SetBaseTickDelay changes the rate at which ticks happen.
func (*Session) UpdateReceiveCounters ¶
UpdateReceiveCounters updates receive counters for a block, which may be a duplicate and adjusts the split factor based on that.