blockpresencemanager

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockPresenceManager

type BlockPresenceManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

func (bpm *BlockPresenceManager) AllPeersDoNotHaveBlock(peers []peer.ID, ws []auth.Want) []auth.Want

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

func (bpm *BlockPresenceManager) PeerDoesNotHaveBlock(p peer.ID, c cid.Cid) bool

PeerDoesNotHaveBlock indicates whether the given peer has sent a DONT_HAVE for the given cid

func (*BlockPresenceManager) PeerHasBlock

func (bpm *BlockPresenceManager) PeerHasBlock(p peer.ID, c cid.Cid) bool

PeerHasBlock indicates whether the given peer has sent a HAVE for the given cid

func (*BlockPresenceManager) ReceiveFrom

func (bpm *BlockPresenceManager) ReceiveFrom(p peer.ID, haves []auth.Want, dontHaves []auth.Want)

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(ws []auth.Want)

RemoveKeys cleans up the given keys from the block presence map

Jump to

Keyboard shortcuts

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