Bedrock.Cluster.Descriptor (bedrock v0.5.2)

View Source

A module for reading and writing cluster descriptors to and from files.

A cluster descriptor is a file that contains the name of the cluster, the id of the cluster, and the names of the coordinator nodes in the cluster.

Summary

Types

t()

A Descriptor struct holds a cluster's name and the list of nodes that act as it's coordinators.

Functions

Reads the cluster descriptor from a file.

Reads the cluster descriptor from a file. Raises an exception if an error was encountered.

Writes the cluster descriptor to a file.

Types

t()

@type t() :: %Bedrock.Cluster.Descriptor{
  cluster_name: String.t(),
  coordinator_nodes: [node()]
}

A Descriptor struct holds a cluster's name and the list of nodes that act as it's coordinators.

Fields:

  • cluster_name - The name of the cluster.
  • coordinator_nodes - A list of atoms representing the coordinator nodes in the cluster.

Functions

encode_cluster_file_contents(t)

@spec encode_cluster_file_contents(t()) :: String.t()

new(cluster_name, coordinator_nodes)

@spec new(String.t(), [node()]) :: t()

parse_cluster_file_contents(contents)

@spec parse_cluster_file_contents(String.t()) ::
  {:ok, t()} | {:error, :invalid_cluster_descriptor}

read_from_file(path_to_file)

@spec read_from_file(path_to_file :: Path.t()) ::
  {:ok, t()} | {:error, :unable_to_read_file | :invalid_cluster_descriptor}

Reads the cluster descriptor from a file.

read_from_file!(path_to_file)

@spec read_from_file!(path_to_file :: Path.t()) :: t()

Reads the cluster descriptor from a file. Raises an exception if an error was encountered.

write_to_file!(path_to_file, t)

@spec write_to_file!(path_to_file :: Path.t(), %Bedrock.Cluster.Descriptor{
  cluster_name: term(),
  coordinator_nodes: term()
}) :: :ok

Writes the cluster descriptor to a file.