Beethoven.RoleMgmt.Assign (Beethoven v0.3.9)

Server to track nodes and their role assignments. Once boot, the service will assign one of each open roles to itself. These roles are cast to the Manager service to spawn the roles.

Failover of roles across the cluster is handled by the Failover service.

Summary

Types

Represents a single record in the Mnesia table.

Functions

Returns a specification to start this module under a supervisor.

Similar to :mnesia.dirty_select/2 but only needs the match spec as an argument. The table name of the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table is input automatically as the 1st arity.

Fetches data from the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table. Uses a record key to query the data. Will return all matching records.

Fetches all records from the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table.

Returns the name of the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table.

Supervisor Entry point.

Subscribes to the table mapped to the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table.

Checks if the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table exists.

Holds the thread until the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table becomes available, or timeout occurs. Defaults to 1_000 milliseconds for timeouts and 15 milliseconds for checking intervals.

Types

record()

@type record() ::
  {table :: module(), role :: atom(), count :: integer(), assigned :: integer(),
   workers :: [atom()], last_changed :: DateTime.t()}

Represents a single record in the Mnesia table.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

dirty_select(matchSpec)

@spec dirty_select(:ets.match_spec()) :: [tuple()] | list()

Similar to :mnesia.dirty_select/2 but only needs the match spec as an argument. The table name of the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table is input automatically as the 1st arity.

fetch(key)

@spec fetch(any()) :: [tuple()] | list()

Fetches data from the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table. Uses a record key to query the data. Will return all matching records.

fetch_all()

@spec fetch_all() :: [tuple()] | list()

Fetches all records from the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table.

get_table_name()

@spec get_table_name() :: module() | atom()

Returns the name of the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table.

start_link(init_args \\ [])

@spec start_link(any()) :: GenServer.on_start()

Supervisor Entry point.

subscribe(type \\ :simple)

@spec subscribe(:simple | :detailed) :: :ok

Subscribes to the table mapped to the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table.

Matches based on subscription

:simple

{:mnesia_table_event, {:atom, record(), _op_data}}

:detailed

{:mnesia_table_event, {:atom, module() | :atom(), record(), [] | [record()], _op_data}}

table_exists?()

@spec table_exists?() :: boolean()

Checks if the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table exists.

until_exists(int \\ 15, timeout \\ 1000, acc \\ 0)

Holds the thread until the DistrServer Elixir.Beethoven.RoleMgmt.Assign's mnesia table becomes available, or timeout occurs. Defaults to 1_000 milliseconds for timeouts and 15 milliseconds for checking intervals.