Documentation ¶
Index ¶
- func NewAddrBook() *memoryAddrBook
- func NewKeyBook() *memoryKeyBook
- func NewPeerMetadata() *memoryPeerMetadata
- func NewPeerstore(opts ...Option) (ps *pstoremem, err error)
- func NewProtoBook(opts ...ProtoBookOption) (*memoryProtoBook, error)
- type AddrBookOption
- type AddrSubManager
- type Option
- type ProtoBookOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAddrBook ¶
func NewAddrBook() *memoryAddrBook
func NewKeyBook ¶
func NewKeyBook() *memoryKeyBook
func NewPeerMetadata ¶
func NewPeerMetadata() *memoryPeerMetadata
func NewPeerstore ¶
NewPeerstore creates an in-memory threadsafe collection of peers. It's the caller's responsibility to call RemovePeer to ensure that memory consumption of the peerstore doesn't grow unboundedly.
func NewProtoBook ¶
func NewProtoBook(opts ...ProtoBookOption) (*memoryProtoBook, error)
Types ¶
type AddrBookOption ¶
type AddrBookOption func(book *memoryAddrBook) error
func WithClock ¶
func WithClock(clock clock) AddrBookOption
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 ProtoBookOption ¶
type ProtoBookOption func(book *memoryProtoBook) error
func WithMaxProtocols ¶
func WithMaxProtocols(num int) ProtoBookOption
Click to show internal directories.
Click to hide internal directories.