pstoremem

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 15 Imported by: 102

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAddrBook

func NewAddrBook() *memoryAddrBook

func NewKeyBook

func NewKeyBook() *memoryKeyBook

noop new, but in the future we may want to do some init work.

func NewPeerMetadata

func NewPeerMetadata() *memoryPeerMetadata

func NewPeerstore

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

NewPeerstore creates an in-memory threadsafe collection of peers.

func NewProtoBook added in v0.0.6

func NewProtoBook(opts ...Option) (*memoryProtoBook, error)

Types

type AddrSubManager

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

An abstracted, pub-sub manager for address streams. Extracted from memoryAddrBook in order to support additional implementations.

func NewAddrSubManager

func NewAddrSubManager() *AddrSubManager

NewAddrSubManager initializes an AddrSubManager.

func (*AddrSubManager) AddrStream

func (mgr *AddrSubManager) AddrStream(ctx context.Context, p peer.ID, initial []ma.Multiaddr) <-chan ma.Multiaddr

AddrStream creates a new subscription for a given peer ID, pre-populating the channel with any addresses we might already have on file.

func (*AddrSubManager) BroadcastAddr

func (mgr *AddrSubManager) BroadcastAddr(p peer.ID, addr ma.Multiaddr)

BroadcastAddr broadcasts a new address to all subscribed streams.

type Option added in v0.4.0

type Option func(*memoryProtoBook) error

func WithMaxProtocols added in v0.4.0

func WithMaxProtocols(num int) Option

Jump to

Keyboard shortcuts

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