peerstore

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

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