Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerManager ¶
type PeerManager struct {
// contains filtered or unexported fields
}
PeerManager manages a pool of peers and sends messages to peers in the pool.
func New ¶
func New(ctx context.Context, createPeerQueue PeerQueueFactory) *PeerManager
New creates a new PeerManager, given a context and a peerQueueFactory.
func (*PeerManager) Connected ¶
func (pm *PeerManager) Connected(p peer.ID, initialWants *wantlist.SessionTrackedWantlist)
Connected is called to add a new peer to the pool, and send it an initial set of wants.
func (*PeerManager) ConnectedPeers ¶
func (pm *PeerManager) ConnectedPeers() []peer.ID
ConnectedPeers returns a list of peers this PeerManager is managing.
func (*PeerManager) Disconnected ¶
func (pm *PeerManager) Disconnected(p peer.ID)
Disconnected is called to remove a peer from the pool.
func (*PeerManager) SendMessage ¶
SendMessage is called to send a message to all or some peers in the pool; if targets is nil, it sends to all.
type PeerQueue ¶
type PeerQueue interface { AddMessage(entries []bsmsg.Entry, ses uint64) //AddTicketMessage(tickets []tickets.Ticket, ses uint64) //AddTicketAckMessage(acks []tickets.TicketAck, ses uint64) Startup() AddWantlist(initialWants *wantlist.SessionTrackedWantlist) Shutdown() }
PeerQueue provides a queue of messages to be sent for a single peer.
Click to show internal directories.
Click to hide internal directories.