Helper functions related to participating in the Quagga bamboo clump
By codifying conventions used therein, it is hope that it will be easier to maintain client-facing applications.
The Quagga clump uses a one byte facet_id to permit log-type consolidation
for a logging identity. This is represented in the high 8-bits of the log_id
The lower 56-bits represent the base_log_id. Such conventions as exist for
base_log_id contents are exposed in the log_defs
Summary
Types
A 56-bit integer representing base_log in a log_id
An 8-bit integer representing the facet of an identity in a log_id
A map representing the Quagga conventions for log entry contents
A 64-bit integer representing a complete log_id
Functions
The base_log_id for a provided atomic name, string type or integer log_id
The canonical bootstrap node for the Quagga clump.
Computes the correct log_id given a base_log_id or atomic name
and a facet_id
The log definition map for a given integer log_id
A map of all presently defined log types
Unpack a given integer log_id into a tuple with
{base_log_id, facet_id}
A log_id list for a provided atomic encoding across every facet_id
A log_id list for a provided atomic name
Includes the computed values for each possible facet_id
Types
@type base_log_id() :: integer()
A 56-bit integer representing base_log in a log_id
@type facet_id() :: integer()
An 8-bit integer representing the facet of an identity in a log_id
@type log_def() :: map()
A map representing the Quagga conventions for log entry contents
@type log_id() :: integer()
A 64-bit integer representing a complete log_id
Functions
@spec base_log(atom() | log_id() | binary()) :: base_log_id() | :error
The base_log_id for a provided atomic name, string type or integer log_id
The canonical bootstrap node for the Quagga clump.
Returns a {host, port} tuple identifying the well-known peer used to
seed peer discovery when first joining the clump.
@spec facet_log(base_log_id() | atom(), facet_id()) :: log_id() | :error
Computes the correct log_id given a base_log_id or atomic name
and a facet_id
The log definition map for a given integer log_id
@spec log_defs() :: %{required(base_log_id()) => log_def()}
A map of all presently defined log types
@spec log_id_unpack(log_id()) :: {base_log_id(), facet_id()} | :error
Unpack a given integer log_id into a tuple with
{base_log_id, facet_id}
A log_id list for a provided atomic encoding across every facet_id
A log_id list for a provided atomic name
Includes the computed values for each possible facet_id