Bedrock.Cluster behaviour (bedrock v0.5.2)

View Source

Defines a cluster behaviour and provides macros for creating cluster modules.

A cluster is a distributed group of nodes that coordinate to provide a consistent, distributed key-value store.

Summary

Functions

Get the OTP name for the cluster with the given name.

Get the OTP name for a component within the cluster with the given name.

Types

capability()

@type capability() :: :coordination | :log | :materializer | :resolution

log()

@type log() :: Bedrock.DataPlane.Log.ref()

materializer()

@type materializer() :: Bedrock.DataPlane.Materializer.ref()

name()

@type name() :: String.t()

t()

@type t() :: module()

transaction()

@type transaction() :: Bedrock.DataPlane.Transaction.encoded()

version()

@type version() :: Bedrock.version()

Callbacks

config!()

@callback config!() :: Bedrock.ControlPlane.Config.t()

coordinator!()

@callback coordinator!() :: Bedrock.ControlPlane.Coordinator.ref()

coordinator_nodes!()

@callback coordinator_nodes!() :: [node()]

coordinator_ping_timeout_in_ms()

@callback coordinator_ping_timeout_in_ms() :: non_neg_integer()

fetch_config()

@callback fetch_config() ::
  {:ok, Bedrock.ControlPlane.Config.t()} | {:error, :unavailable}

fetch_coordinator()

@callback fetch_coordinator() ::
  {:ok, Bedrock.ControlPlane.Coordinator.ref()} | {:error, :unavailable}

fetch_coordinator_nodes()

@callback fetch_coordinator_nodes() :: {:ok, [node()]} | {:error, :unavailable}

fetch_link()

@callback fetch_link() :: {:ok, Bedrock.Cluster.Link.ref()} | {:error, :unavailable}

fetch_transaction_system_layout()

@callback fetch_transaction_system_layout() ::
  {:ok, Bedrock.ControlPlane.Config.TransactionSystemLayout.t()}
  | {:error, :unavailable}

gateway_ping_timeout_in_ms()

@callback gateway_ping_timeout_in_ms() :: non_neg_integer()

link!()

@callback link!() :: Bedrock.Cluster.Link.ref()

name()

@callback name() :: String.t()

node_capabilities()

@callback node_capabilities() :: [capability()]

node_config()

@callback node_config() :: Keyword.t()

otp_name()

@callback otp_name() :: atom()

otp_name(service)

@callback otp_name(service :: atom()) :: atom()

path_to_descriptor()

@callback path_to_descriptor() :: Path.t()

transaction_system_layout!()

@callback transaction_system_layout!() ::
  Bedrock.ControlPlane.Config.TransactionSystemLayout.t()

Functions

otp_name(cluster_name)

@spec otp_name(name()) :: atom()

Get the OTP name for the cluster with the given name.

otp_name(cluster_name, service)

@spec otp_name(name(), service :: atom() | String.t()) :: atom()

Get the OTP name for a component within the cluster with the given name.