wantmanager

package
v0.0.0-...-15711b3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2019 License: MIT, 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 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) *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) 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) IsWanted

func (wm *WantManager) IsWanted(c cid.Cid) bool

IsWanted returns whether a CID is currently wanted.

func (*WantManager) SetDelegate

func (wm *WantManager) SetDelegate(wantSender WantSender)

SetDelegate specifies who will send want changes out to the internet.

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.

type WantSender

type WantSender interface {
	SendMessage(entries []*bsmsg.Entry, targets []peer.ID, from uint64)
}

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

Jump to

Keyboard shortcuts

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