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.
Click to show internal directories.
Click to hide internal directories.