class

Swim::Table

Inherits Reference < Object

Open-address table of peers. Lookup and update of a known peer do not allocate. The table allocates only when it grows, or when it compacts tombstones.

Constants

EMPTY = 0_u8
LIVE = 1_u8
TOMB = 2_u8

Constructors

new(random : Random)
Source

Instance methods

delete_dead(before : Time::Instant, keep : Endpoint) : Nil

Removes dead peers whose update time is at or before before. The local peer is kept.

Source
each
Source
find(endpoint : Endpoint) : Peer | Nil
Source
put(peer : Peer) : Nil

Inserts or replaces a peer. A replace does not allocate.

Source
sample(want : Int32, skip_dead : Bool, exclude_a : Endpoint, exclude_b : Endpoint = Endpoint.zero, & : Peer -> ) : Nil

Picks up to want peers. The shuffle uses the order array in place. skip_dead keeps failed peers out of probes. Gossip leaves it false.

Source
size
Source

Nested types