Versions in this module Expand all Collapse all v0 v0.24.1 Oct 10, 2024 Changes in this version + type DefaultPeerLedger struct + func NewDefaultPeerLedger(maxEntriesPerPeer uint) *DefaultPeerLedger + func (l *DefaultPeerLedger) CancelWant(p peer.ID, k cid.Cid) bool + func (l *DefaultPeerLedger) CancelWantWithType(p peer.ID, k cid.Cid, typ pb.Message_Wantlist_WantType) + func (l *DefaultPeerLedger) ClearPeerWantlist(p peer.ID) + func (l *DefaultPeerLedger) CollectPeerIDs() []peer.ID + func (l *DefaultPeerLedger) PeerDisconnected(p peer.ID) + func (l *DefaultPeerLedger) Peers(k cid.Cid) []PeerEntry + func (l *DefaultPeerLedger) WantlistForPeer(p peer.ID) []wl.Entry + func (l *DefaultPeerLedger) WantlistSizeForPeer(p peer.ID) int + func (l *DefaultPeerLedger) Wants(p peer.ID, e wl.Entry) bool + type DefaultScoreLedger struct + func NewDefaultScoreLedger() *DefaultScoreLedger + func NewTestScoreLedger(peerSampleInterval time.Duration, sampleCh chan struct{}, clock clock.Clock) *DefaultScoreLedger + func (dsl *DefaultScoreLedger) AddToReceivedBytes(p peer.ID, n int) + func (dsl *DefaultScoreLedger) AddToSentBytes(p peer.ID, n int) + func (dsl *DefaultScoreLedger) GetReceipt(p peer.ID) *Receipt + func (dsl *DefaultScoreLedger) PeerConnected(p peer.ID) + func (dsl *DefaultScoreLedger) PeerDisconnected(p peer.ID) + func (dsl *DefaultScoreLedger) Start(scorePeer ScorePeerFunc) + func (dsl *DefaultScoreLedger) Stop() + type Engine struct + func NewEngine(ctx context.Context, bs bstore.Blockstore, peerTagger PeerTagger, self peer.ID, ...) *Engine + func (e *Engine) LedgerForPeer(p peer.ID) *Receipt + func (e *Engine) MessageReceived(ctx context.Context, p peer.ID, m bsmsg.BitSwapMessage) bool + func (e *Engine) MessageSent(p peer.ID, m bsmsg.BitSwapMessage) + func (e *Engine) NotifyNewBlocks(blks []blocks.Block) + func (e *Engine) Outbox() <-chan (<-chan *Envelope) + func (e *Engine) PeerConnected(p peer.ID) + func (e *Engine) PeerDisconnected(p peer.ID) + func (e *Engine) Peers() []peer.ID + func (e *Engine) ReceivedBlocks(from peer.ID, blks []blocks.Block) + func (e *Engine) SetSendDontHaves(send bool) + func (e *Engine) StartWorkers(ctx context.Context, px process.Process) + func (e *Engine) WantlistForPeer(p peer.ID) []wl.Entry + type Envelope struct + Message bsmsg.BitSwapMessage + Peer peer.ID + Sent func() + type Option func(*Engine) + func WithBlockstoreWorkerCount(count int) Option + func WithMaxCidSize(n uint) Option + func WithMaxOutstandingBytesPerPeer(count int) Option + func WithMaxQueuedWantlistEntriesPerPeer(count uint) Option + func WithPeerBlockRequestFilter(pbrf PeerBlockRequestFilter) Option + func WithPeerLedger(peerLedger PeerLedger) Option + func WithScoreLedger(scoreledger ScoreLedger) Option + func WithSetSendDontHave(send bool) Option + func WithTargetMessageSize(size int) Option + func WithTaskComparator(comparator TaskComparator) Option + func WithTaskWorkerCount(count int) Option + type PeerBlockRequestFilter func(p peer.ID, c cid.Cid) bool + type PeerEntry struct + Peer peer.ID + Priority int32 + WantType pb.Message_Wantlist_WantType + type PeerLedger interface + CancelWant func(p peer.ID, k cid.Cid) bool + CancelWantWithType func(p peer.ID, k cid.Cid, typ pb.Message_Wantlist_WantType) + ClearPeerWantlist func(p peer.ID) + CollectPeerIDs func() []peer.ID + PeerDisconnected func(p peer.ID) + Peers func(k cid.Cid) []PeerEntry + WantlistForPeer func(p peer.ID) []wl.Entry + WantlistSizeForPeer func(p peer.ID) int + Wants func(p peer.ID, e wl.Entry) bool + type PeerTagger interface + TagPeer func(peer.ID, string, int) + UntagPeer func(p peer.ID, tag string) + type Receipt struct + Exchanged uint64 + Peer string + Recv uint64 + Sent uint64 + Value float64 + type ScoreLedger interface + AddToReceivedBytes func(p peer.ID, n int) + AddToSentBytes func(p peer.ID, n int) + GetReceipt func(p peer.ID) *Receipt + PeerConnected func(p peer.ID) + PeerDisconnected func(p peer.ID) + Start func(scorePeer ScorePeerFunc) + Stop func() + type ScorePeerFunc func(peer.ID, int) + type TaskComparator func(ta, tb *TaskInfo) bool + type TaskInfo struct + BlockSize int + Cid cid.Cid + HaveBlock bool + IsWantBlock bool + Peer peer.ID + SendDontHave bool