wantmanager

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerHandler

type PeerHandler interface {
	Disconnected(p peer.ID)
	Connected(p peer.ID, initialWants *wantlist.SessionTrackedWantlist)
	SendMessage(entries []bsmsg.Entry, targets []peer.ID, from uint64)
}

PeerHandler sends changes out to the network as they get added to the wantlist managed by the WantManager.

type WantManager

type WantManager struct {
	// contains filtered or unexported fields
}

WantManager manages a global want list. It tracks two seperate want lists - one for all wants, and one for wants that are specifically broadcast to the internet.

func New

func New(ctx context.Context, peerHandler PeerHandler) *WantManager

New initializes a new WantManager for a given context.

func (*WantManager) CancelWants

func (wm *WantManager) CancelWants(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)

CancelWants removes the given cids from the wantlist, tracked by the given session.

func (*WantManager) Connected

func (wm *WantManager) Connected(p peer.ID)

Connected is called when a new peer is connected

func (*WantManager) CurrentBroadcastWants

func (wm *WantManager) CurrentBroadcastWants() []wantlist.Entry

CurrentBroadcastWants returns the current list of wants that are broadcasts.

func (*WantManager) CurrentWants

func (wm *WantManager) CurrentWants() []wantlist.Entry

CurrentWants returns the list of current wants.

func (*WantManager) Disconnected

func (wm *WantManager) Disconnected(p peer.ID)

Disconnected is called when a peer is disconnected

func (*WantManager) Shutdown

func (wm *WantManager) Shutdown()

Shutdown ends processing for the want manager.

func (*WantManager) Startup

func (wm *WantManager) Startup()

Startup starts processing for the WantManager.

func (*WantManager) WantBlocks

func (wm *WantManager) WantBlocks(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)

WantBlocks adds the given cids to the wantlist, tracked by the given session.

func (*WantManager) WantCount

func (wm *WantManager) WantCount() int

WantCount returns the total count of wants.

Jump to

Keyboard shortcuts

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