remotemap

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const QueueSize = 128

Variables

This section is empty.

Functions

This section is empty.

Types

type RemoteMap

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

RemoteMap manages a mapping of live remote peers, keyed by address, to their respective send queues. Each peer has two queues: a send queue, and a receive queue. RemoteMap's functions are safe to call from multiple goroutines.

func NewRemoteMap

func NewRemoteMap(timeout time.Duration) *RemoteMap

NewRemoteMap creates a RemoteMap that expires peers after a timeout.

If the timeout is 0, peers never expire.

func (*RemoteMap) Chan

func (m *RemoteMap) Chan(addr net.Addr) chan []byte

Get Channel corresponding to addr

func (*RemoteMap) GetChan

func (m *RemoteMap) GetChan(addr net.Addr) (chan []byte, bool)

Returns the send channel corresponding to addr and indicates whether it is a new channel

Jump to

Keyboard shortcuts

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