sessionpeermanager

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerTagger

type PeerTagger interface {
	TagPeer(peer.ID, string, int)
	UntagPeer(p peer.ID, tag string)
	Protect(peer.ID, string)
	Unprotect(peer.ID, string) bool
}

PeerTagger is an interface for tagging peers with metadata

type SessionPeerManager

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

SessionPeerManager keeps track of peers for a session, and takes care of ConnectionManager tagging.

func New

func New(id uint64, tagger PeerTagger) *SessionPeerManager

New creates a new SessionPeerManager

func (*SessionPeerManager) AddPeer

func (spm *SessionPeerManager) AddPeer(p peer.ID) bool

AddPeer adds the peer to the SessionPeerManager. Returns true if the peer is a new peer, false if it already existed.

func (*SessionPeerManager) HasPeer

func (spm *SessionPeerManager) HasPeer(p peer.ID) bool

func (*SessionPeerManager) HasPeers

func (spm *SessionPeerManager) HasPeers() bool

func (*SessionPeerManager) Peers

func (spm *SessionPeerManager) Peers() []peer.ID

func (*SessionPeerManager) PeersDiscovered

func (spm *SessionPeerManager) PeersDiscovered() bool

PeersDiscovered indicates whether peers have been discovered yet. Returns true once a peer has been discovered by the session (even if all peers are later removed from the session).

func (*SessionPeerManager) ProtectConnection

func (spm *SessionPeerManager) ProtectConnection(p peer.ID)

Protect connection to this peer from being pruned by the connection manager

func (*SessionPeerManager) RemovePeer

func (spm *SessionPeerManager) RemovePeer(p peer.ID) bool

RemovePeer removes the peer from the SessionPeerManager. Returns true if the peer was removed, false if it did not exist.

func (*SessionPeerManager) Shutdown

func (spm *SessionPeerManager) Shutdown()

Shutdown untags all the peers

Jump to

Keyboard shortcuts

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