store

package
v0.65.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPeer

type IPeer interface {
	Close()
	ID() messages.PeerID
}

type Listener

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

func (*Listener) AddInterestedPeers

func (l *Listener) AddInterestedPeers(peerIDs []messages.PeerID)

func (*Listener) RemoveInterestedPeer

func (l *Listener) RemoveInterestedPeer(peerIDs []messages.PeerID)

type PeerNotifier

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

func NewPeerNotifier

func NewPeerNotifier() *PeerNotifier

func (*PeerNotifier) NewListener

func (pn *PeerNotifier) NewListener(onPeersComeOnline, onPeersWentOffline func([]messages.PeerID)) *Listener

func (*PeerNotifier) PeerCameOnline

func (pn *PeerNotifier) PeerCameOnline(peerID messages.PeerID)

func (*PeerNotifier) PeerWentOffline

func (pn *PeerNotifier) PeerWentOffline(peerID messages.PeerID)

func (*PeerNotifier) RemoveListener

func (pn *PeerNotifier) RemoveListener(listener *Listener)

type Store

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

Store is a thread-safe store of peers It is used to store the peers that are connected to the relay server

func NewStore

func NewStore() *Store

NewStore creates a new Store instance

func (*Store) AddPeer

func (s *Store) AddPeer(peer IPeer) bool

AddPeer adds a peer to the store If the peer already exists, it will be replaced and the old peer will be closed Returns true if the peer was replaced, false if it was added for the first time.

func (*Store) DeletePeer

func (s *Store) DeletePeer(peer IPeer) bool

DeletePeer deletes a peer from the store

func (*Store) GetOnlinePeersAndRegisterInterest added in v0.51.2

func (s *Store) GetOnlinePeersAndRegisterInterest(peerIDs []messages.PeerID, listener *Listener) []messages.PeerID

func (*Store) Peer

func (s *Store) Peer(id messages.PeerID) (IPeer, bool)

Peer returns a peer by its ID

func (*Store) Peers

func (s *Store) Peers() []IPeer

Peers returns all the peers in the store

Jump to

Keyboard shortcuts

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