Documentation ¶
Index ¶
- type BlockPresenceManager
- func (bpm *BlockPresenceManager) AllPeersDoNotHaveBlock(peers []peer.ID, ks []cid.Cid) []cid.Cid
- func (bpm *BlockPresenceManager) HasKey(c cid.Cid) bool
- func (bpm *BlockPresenceManager) PeerDoesNotHaveBlock(p peer.ID, c cid.Cid) bool
- func (bpm *BlockPresenceManager) PeerHasBlock(p peer.ID, c cid.Cid) bool
- func (bpm *BlockPresenceManager) ReceiveFrom(p peer.ID, haves []cid.Cid, dontHaves []cid.Cid)
- func (bpm *BlockPresenceManager) RemoveKeys(ks []cid.Cid)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockPresenceManager ¶
BlockPresenceManager keeps track of which peers have indicated that they have or explicitly don't have a block
func New ¶
func New() *BlockPresenceManager
func (*BlockPresenceManager) AllPeersDoNotHaveBlock ¶
Filters the keys such that all the given peers have received a DONT_HAVE for a key. This allows us to know if we've exhausted all possibilities of finding the key with the peers we know about.
func (*BlockPresenceManager) HasKey ¶
func (bpm *BlockPresenceManager) HasKey(c cid.Cid) bool
HasKey indicates whether the BlockPresenceManager is tracking the given key (used by the tests)
func (*BlockPresenceManager) PeerDoesNotHaveBlock ¶
PeerDoesNotHaveBlock indicates whether the given peer has sent a DONT_HAVE for the given cid
func (*BlockPresenceManager) PeerHasBlock ¶
PeerHasBlock indicates whether the given peer has sent a HAVE for the given cid
func (*BlockPresenceManager) ReceiveFrom ¶
ReceiveFrom is called when a peer sends us information about which blocks it has and does not have
func (*BlockPresenceManager) RemoveKeys ¶
func (bpm *BlockPresenceManager) RemoveKeys(ks []cid.Cid)
RemoveKeys cleans up the given keys from the block presence map