peerstore

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerStore

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

PeerStore takes care of storing and reading peer information to and from persistent storage.

func New

func New(store Store) *PeerStore

New creates a new PeerStore handler.

func (*PeerStore) Get

func (p *PeerStore) Get(id peer.ID) (blockless.Peer, error)

Get wil retrieve peer with the given ID.

func (*PeerStore) Peers

func (p *PeerStore) Peers() ([]blockless.Peer, error)

Peers returns the list of peers from the peer store.

func (*PeerStore) Remove

func (p *PeerStore) Remove(id peer.ID) error

Remove removes the peer from the peerstore.

func (*PeerStore) Store

func (p *PeerStore) Store(id peer.ID, addr multiaddr.Multiaddr, info peer.AddrInfo) error

Store will persist the peer information.

type Store

type Store interface {
	SetRecord(key string, value interface{}) error
	GetRecord(key string, out interface{}) error
	Keys() []string
	Delete(key string) error
}

Jump to

Keyboard shortcuts

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