Documentation ¶
Index ¶
- type PeerHandler
- type WantManager
- func (wm *WantManager) CancelWants(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)
- func (wm *WantManager) Connected(p peer.ID)
- func (wm *WantManager) CurrentBroadcastWants() []wantlist.Entry
- func (wm *WantManager) CurrentWants() []wantlist.Entry
- func (wm *WantManager) Disconnected(p peer.ID)
- func (wm *WantManager) Shutdown()
- func (wm *WantManager) Startup()
- func (wm *WantManager) WantBlocks(ctx context.Context, ks []cid.Cid, peers []peer.ID, ses uint64)
- func (wm *WantManager) WantCount() int
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 ¶
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 ¶
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.