internal

package
v0.37.9 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerIdCache

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

func NewPeerIdCache

func NewPeerIdCache(size int) (*PeerIdCache, error)

func (*PeerIdCache) ByPeerId

func (p *PeerIdCache) ByPeerId(pid peer.ID) (string, bool)

ByPeerId returns the base58 encoded peer id string by directly looking up the peer id in the cache. It is only used for testing and since this is an internal package, it is not exposed to the outside world.

func (*PeerIdCache) PeerIdString

func (p *PeerIdCache) PeerIdString(pid peer.ID) string

PeerIdString returns the base58 encoded peer id string, it looks up the peer id in a cache to avoid expensive base58 encoding, and caches the result for future use in case of a cache miss. It is safe to call this method concurrently.

func (*PeerIdCache) Size

func (p *PeerIdCache) Size() int

Size returns the number of entries in the cache; it is mainly used for testing.

Jump to

Keyboard shortcuts

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