infomempeerstore

package module
v0.0.0-...-fc90c90 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 4

README

go-libp2p-infomempeerstore

Introspectable in-memory Peerstore

GoDoc

This library is a standard in-memory libp2p peer store with an extra method allowing examining the internal raw peer state.

License

SPDX-License-Identifier: Apache-2.0 OR MIT

Documentation

Overview

Package infomempeerstore wraps pstoremem.NewPeerstore() providing an extra methods to examine the internal peer state: GetPeerData()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerData

type PeerData struct {
	Meta   map[string]interface{} `json:"meta"`
	Protos map[string]struct{}    `json:"libp2p_protocols"`
}

type PeerStore

type PeerStore struct {
	peerstore.Peerstore
	// contains filtered or unexported fields
}

func NewPeerstore

func NewPeerstore(opts ...pstoremem.Option) (*PeerStore, error)

func (*PeerStore) AddProtocols

func (ps *PeerStore) AddProtocols(p peer.ID, protos ...protocol.ID) error

func (*PeerStore) ConsumePeerRecord

func (ps *PeerStore) ConsumePeerRecord(s *record.Envelope, ttl time.Duration) (accepted bool, err error)

func (*PeerStore) GetPeerData

func (ps *PeerStore) GetPeerData(p peer.ID) PeerData

func (*PeerStore) GetPeerRecord

func (ps *PeerStore) GetPeerRecord(p peer.ID) *record.Envelope

func (*PeerStore) Put

func (ps *PeerStore) Put(p peer.ID, key string, val interface{}) error

func (*PeerStore) RemovePeer

func (ps *PeerStore) RemovePeer(p peer.ID)

func (*PeerStore) RemoveProtocols

func (ps *PeerStore) RemoveProtocols(p peer.ID, protos ...protocol.ID) error

func (*PeerStore) SetProtocols

func (ps *PeerStore) SetProtocols(p peer.ID, protos ...protocol.ID) error

Jump to

Keyboard shortcuts

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