Bedrock.SystemKeys.OtpRef (bedrock v0.5.2)

View Source

FlatBuffer schema for OtpRef - service identity.

Used for all services (ephemeral and durable). Durable service IDs (like log_id) are encoded in the key path, not in this value.

Example

# Encode
binary = OtpRef.to_binary(%{otp_name: "bedrock_sequencer", node: "node@host"})

# Decode
{:ok, %{otp_name: name, node: node}} = OtpRef.read(binary)

# Convert to/from Elixir tuple format
ref = OtpRef.to_tuple(binary)  # {:bedrock_sequencer, :"node@host"}
binary = OtpRef.from_tuple({:bedrock_sequencer, :"node@host"})

Summary

Types

t()

@type t() :: {atom(), atom()}

Functions

fetch(buffer, path)

fetch!(buffer, path)

from_tuple(arg)

@spec from_tuple(t()) :: binary()

Converts an Elixir tuple to binary OtpRef

get(buffer, path, default \\ nil)

read(buffer)

read!(buffer)

schema()

to_binary(map)

to_iolist(map)

to_tuple(binary)

@spec to_tuple(binary()) :: t() | {:error, term()}

Converts a binary OtpRef to Elixir tuple format