Documentation
¶
Index ¶
- 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) IsWanted(c cid.Cid) bool
- func (s *Session) ReceiveFrom(from peer.ID, ks []cid.Cid)
- func (s *Session) SetBaseTickDelay(baseTickDelay time.Duration)
- type WantManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerManager ¶
type PeerManager interface { FindMorePeers(context.Context, cid.Cid) GetOptimizedPeers() []bssd.OptimizedPeer RecordPeerRequests([]peer.ID, []cid.Cid) RecordPeerResponse(peer.ID, []cid.Cid) RecordCancels([]cid.Cid) }
PeerManager provides an interface for tracking and optimize peers, and requesting more when neccesary.
type RequestSplitter ¶
type RequestSplitter interface { SplitRequest([]bssd.OptimizedPeer, []cid.Cid) []bssd.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, notif notifications.PubSub, initialSearchDelay time.Duration, periodicSearchDelay delay.D) *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) IsWanted ¶
IsWanted returns true if this session is waiting to receive the given Cid.
func (*Session) ReceiveFrom ¶
ReceiveFrom receives incoming blocks from the given peer.
func (*Session) SetBaseTickDelay ¶
SetBaseTickDelay changes the rate at which ticks happen.