mcc v1.0.1 Mcc.Lib

This module contains functions to manipulate cluster based on mnesia.

Includes:

  • 1, start mnesia and mnesia table
  • 2, make node join into the mnesia cluster
  • 3, make node leave from the mnesia cluster
  • 4, remove one node from mnesia cluster
  • 5, get status of mnesia cluster

Link to this section Summary

Functions

Get all nodes in current mnesia cluster

Copy mnesia table from remote node

Create mnesia table

Delete schema copy of given node

Delete schema information in local node

Ensure mnesia stoppted

Make one node join into the mnesia cluster

Make one node leave from the mnesia cluster

Get all not running nodes in current mnesia cluster

Remove one node from the mnesia cluster

Get all running nodes in current mnesia cluster

Tries to start mnesia and create or copy mnesia table. It will raises an exception in case of failure, return :ok if successful, or {:error, reason} if an error occurs

Get status of the mnesia cluster

Link to this section Functions

Link to this function

all_nodes()
all_nodes() :: [node()]

Get all nodes in current mnesia cluster.

Link to this function

copy_table(name, ram_or_disc \\ :ram_copies)
copy_table(atom(), atom()) :: :ok | {:error, any()}

Copy mnesia table from remote node.

Link to this function

create_table(name, tabdef)
create_table(atom(), list()) :: :ok | {:error, any()}

Create mnesia table.

Link to this function

del_schema_copy(node_name)
del_schema_copy(node()) :: :ok | {:error, any()}

Delete schema copy of given node.

Link to this function

delete_schema()
delete_schema() :: :ok | {:error, any()}

Delete schema information in local node.

Link to this function

ensure_stopped()
ensure_stopped() :: :ok | {:error, any()}

Ensure mnesia stoppted.

Link to this function

join_cluster(node_name)
join_cluster(node()) :: :ok | {:error, term()}

Make one node join into the mnesia cluster.

Link to this function

leave_cluster()
leave_cluster() ::
  :ok | {:error, :node_not_in_cluster} | {:error, {:failed_to_leave, node()}}

Make one node leave from the mnesia cluster.

Link to this function

not_running_nodes()
not_running_nodes() :: [node()]

Get all not running nodes in current mnesia cluster.

Link to this function

remove_from_cluster(node_name)
remove_from_cluster(node()) ::
  :ok | {:error, :node_not_in_cluster} | {:error, term()}

Remove one node from the mnesia cluster.

Link to this function

running_nodes()
running_nodes() :: [node()]

Get all running nodes in current mnesia cluster.

Link to this function

start()
start() :: :ok | {:error, term()}

Tries to start mnesia and create or copy mnesia table. It will raises an exception in case of failure, return :ok if successful, or {:error, reason} if an error occurs.

Link to this function

status()
status() :: list()

Get status of the mnesia cluster.