module

Swim::Wire

Binary SWIM packet. The layout is fixed so encode and decode do not allocate.

0  magic "SWIM"     4
4  version          1
5  type             1
6  change count     1
7  flags            1
8  sequence         8
16 sender endpoint  19
35 target endpoint  19
54 changes          28 each, at most 5

An endpoint is family (1), port (2), address (16).

Constants

ACK = 2_u8
CHANGE = 28
ENDPOINT = 19
HEADER = 54
MAX_BYTES = HEADER + (MAX_CHANGES * CHANGE)
MAX_CHANGES = 5
PING = 1_u8
PING_REQ = 3_u8
VERSION = 1_u8

Class methods

bytes(count : Int32) : Int32
Source
change(buf : Bytes, index : Int32) : Tuple(Endpoint, UInt64, Status)
Source
open(buf : Bytes, type : UInt8, seq : UInt64, sender : Endpoint, target : Endpoint) : Nil

Writes the header. The change count starts at 0.

Source
store(buf : Bytes, index : Int32, endpoint : Endpoint, incarnation : UInt64, status : Status) : Nil

Writes one gossip change and stores the new count.

Source
view?(buf : Bytes) : View | Nil

Returns nil when the bytes are not a SWIM packet.

Source

Nested types