Documentation ¶
Index ¶
- type PeerHandler
- type SessionManager
- type WantManager
- func (wm *WantManager) BroadcastWantHaves(ctx context.Context, ses uint64, wantHaves []cid.Cid)
- func (wm *WantManager) Connected(p peer.ID)
- func (wm *WantManager) Disconnected(p peer.ID)
- func (wm *WantManager) ReceiveFrom(ctx context.Context, p peer.ID, blks []cid.Cid, haves []cid.Cid, ...)
- func (wm *WantManager) RemoveSession(ctx context.Context, ses uint64)
- func (wm *WantManager) SetSessionManager(sm SessionManager)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerHandler ¶
type PeerHandler interface { // Connected is called when a peer connects, with any initial want-haves // that have been broadcast to all peers (as part of session discovery) Connected(p peer.ID, initialWants []cid.Cid) // Disconnected is called when a peer disconnects Disconnected(p peer.ID) // BroadcastWantHaves sends want-haves to all connected peers BroadcastWantHaves(ctx context.Context, wantHaves []cid.Cid) // SendCancels sends cancels to all peers that had previously been sent // a want-block or want-have for the given key SendCancels(context.Context, []cid.Cid) }
PeerHandler sends wants / cancels to other peers
type SessionManager ¶
type SessionManager interface {
ReceiveFrom(p peer.ID, blks []cid.Cid, haves []cid.Cid, dontHaves []cid.Cid) []sessionmanager.Session
}
SessionManager receives incoming messages and distributes them to sessions
type WantManager ¶
type WantManager struct {
// contains filtered or unexported fields
}
WantManager
- informs the SessionManager and BlockPresenceManager of incoming information and cancelled sessions
- informs the PeerManager of connects and disconnects
- manages the list of want-haves that are broadcast to the internet (as opposed to being sent to specific peers)
func New ¶
func New(ctx context.Context, peerHandler PeerHandler, sim *bssim.SessionInterestManager, bpm *bsbpm.BlockPresenceManager) *WantManager
New initializes a new WantManager for a given context.
func (*WantManager) BroadcastWantHaves ¶
BroadcastWantHaves is called when want-haves should be broadcast to all connected peers (as part of session discovery)
func (*WantManager) Connected ¶
func (wm *WantManager) Connected(p peer.ID)
Connected is called when a new peer connects
func (*WantManager) Disconnected ¶
func (wm *WantManager) Disconnected(p peer.ID)
Disconnected is called when a peer disconnects
func (*WantManager) ReceiveFrom ¶
func (wm *WantManager) ReceiveFrom(ctx context.Context, p peer.ID, blks []cid.Cid, haves []cid.Cid, dontHaves []cid.Cid)
ReceiveFrom is called when a new message is received
func (*WantManager) RemoveSession ¶
func (wm *WantManager) RemoveSession(ctx context.Context, ses uint64)
RemoveSession is called when the session is shut down
func (*WantManager) SetSessionManager ¶
func (wm *WantManager) SetSessionManager(sm SessionManager)
Click to show internal directories.
Click to hide internal directories.