blockpresencemanager

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0, MIT Imports: 3 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, ks []cid.Cid) []cid.Cid

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 []cid.Cid, dontHaves []cid.Cid)

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

Jump to

Keyboard shortcuts

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