QuaggaDef (QuaggaDef v0.8.1)

Copy Markdown View Source

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

base_log_id()

@type base_log_id() :: integer()

A 56-bit integer representing base_log in a log_id

facet_id()

@type facet_id() :: integer()

An 8-bit integer representing the facet of an identity in a log_id

log_def()

@type log_def() :: map()

A map representing the Quagga conventions for log entry contents

log_id()

@type log_id() :: integer()

A 64-bit integer representing a complete log_id

Functions

base_log(t)

@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

bootstrap_node()

@spec bootstrap_node() :: {binary(), integer()}

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.

facet_log(name, facet_id)

@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

log_def(n)

@spec log_def(log_id()) :: log_def() | :error

The log definition map for a given integer log_id

log_defs()

@spec log_defs() :: %{required(base_log_id()) => log_def()}

A map of all presently defined log types

log_id_unpack(n)

@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}

logs_for_encoding(e)

@spec logs_for_encoding(atom()) :: [log_id()]

A log_id list for a provided atomic encoding across every facet_id

logs_for_name(n)

@spec logs_for_name(atom()) :: [log_id()]

A log_id list for a provided atomic name Includes the computed values for each possible facet_id