Protobuf wire-format primitives (proto3): varints, zigzag, fixed64, tags, and
length-delimited fields — just enough of the encoding to (de)serialize the
Hrana 3 messages. The message-level codecs live in Filo.Protobuf.
Encoders return iodata/0 (callers wrap a whole message in
IO.iodata_to_binary/1). decode_fields/1 returns the fields in wire order as
{field_number, value} where value is one of {:varint, n},
{:fixed64, <<8 bytes>>}, {:len, binary}, or {:fixed32, <<4 bytes>>};
repeated fields appear once per occurrence.
Summary
Functions
Decodes a fixed64 double payload.
Splits a message into its {field_number, value} fields, in wire order.
Length-prefixes a message (no tag) for the cursor response stream.
A varint field for a bool.
A fixed64 field for a double (little-endian IEEE-754).
A varint field for a possibly-negative int32/int64 (sign-extended to 64 bits).
A length-delimited field (string, bytes, or a sub-message).
A zigzag varint field for a sint64.
A varint field for a non-negative integer (uint32/uint64/enum).
Splits a length-delimited stream (the inverse of repeated delimit/1) into messages.
Encodes a field tag (field_number << 3 | wire_type).
Encodes an unsigned integer as a base-128 varint.
Inverse of zigzag_encode/1.
Encodes a signed integer with zigzag (so small magnitudes stay small).
Functions
Decodes a fixed64 double payload.
@spec decode_fields(binary()) :: [{pos_integer(), term()}]
Splits a message into its {field_number, value} fields, in wire order.
Length-prefixes a message (no tag) for the cursor response stream.
@spec field_bool(pos_integer(), boolean()) :: iodata()
A varint field for a bool.
@spec field_double(pos_integer(), float()) :: iodata()
A fixed64 field for a double (little-endian IEEE-754).
@spec field_int(pos_integer(), integer()) :: iodata()
A varint field for a possibly-negative int32/int64 (sign-extended to 64 bits).
@spec field_len(pos_integer(), iodata()) :: iodata()
A length-delimited field (string, bytes, or a sub-message).
@spec field_sint64(pos_integer(), integer()) :: iodata()
A zigzag varint field for a sint64.
@spec field_varint(pos_integer(), non_neg_integer()) :: iodata()
A varint field for a non-negative integer (uint32/uint64/enum).
Splits a length-delimited stream (the inverse of repeated delimit/1) into messages.
@spec tag(pos_integer(), 0..5) :: iodata()
Encodes a field tag (field_number << 3 | wire_type).
@spec varint(non_neg_integer()) :: iodata()
Encodes an unsigned integer as a base-128 varint.
@spec zigzag_decode(non_neg_integer()) :: integer()
Inverse of zigzag_encode/1.
@spec zigzag_encode(integer()) :: non_neg_integer()
Encodes a signed integer with zigzag (so small magnitudes stay small).