Beethoven.RoleServer (Beethoven v0.3.9)
DEPRECATED! Do not use. Use Beethoven.RoleMgmt
instead.
This server is responsible for the management and allocation of specialized OTP complaint PIDs.
Roles are defined in in the application config for :beethoven
.
Example
config :beethoven,
...
roles: [
# {<AtomName>, <Module>, <Initial Args>, <InstanceCount>}
{:test, Beethoven.TestRole, [arg1: "arg1"], 1}
]
Based on the definition for each role, the nodes in the Beethoven
cluster will ensure the required amount of that service is running across the cluster.
The number of service instances needed for the role is defined with the InstanceCount
element in the tuple. These services are spread across the cluster.
Summary
Types
Role list in the form of a map.
Simplified type for tracker records. Just excludes the table name from the record tuple.
Functions
CoreServer
Tell the local CoreServer that we want to be alerted to changes to cluster node state. Update will be sent in the form of a cast.
Returns a specification to start this module under a supervisor.
Manually copy the tracking DB to the node.
Similar to :mnesia.dirty_select/2
but only needs the match spec as an argument.
The table name of the DistrServer Elixir.Beethoven.RoleServer
's mnesia table is input automatically as the 1st arity.
Fetches data from the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
Uses a record key to query the data. Will return all matching records.
Fetches all records from the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
Retrieves roles from config and converts to map.
Returns the name of the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
Creates a map from a list of maps. First element of the map needs to be an atom. This same atom will be the key for the rest of the data in the map.
Starts assignment job on the RoleServer.
Supervisor Entry point.
Subscribes to the table mapped to the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
Checks if the DistrServer Elixir.Beethoven.RoleServer
's mnesia table exists.
Holds the thread until the DistrServer Elixir.Beethoven.RoleServer
's mnesia table becomes available, or timeout occurs.
Defaults to 1_000
milliseconds for timeouts and 15
milliseconds for checking intervals.
Types
Functions
@spec alert_me() :: :ok
CoreServer
Tell the local CoreServer that we want to be alerted to changes to cluster node state. Update will be sent in the form of a cast.
Example
{:node_update, {nodeName, status}}
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec copy_tracker() :: :ok | :already_exists | {:error, any()}
Manually copy the tracking DB to the node.
@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.RoleServer
's mnesia table is input automatically as the 1st arity.
Fetches data from the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
Uses a record key to query the data. Will return all matching records.
Fetches all records from the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
@spec get_role_config() :: roleMap()
Retrieves roles from config and converts to map.
Returns the name of the DistrServer Elixir.Beethoven.RoleServer
's mnesia table.
@spec role_list_to_map([roleRecord()]) :: roleMap()
Creates a map from a list of maps. First element of the map needs to be an atom. This same atom will be the key for the rest of the data in the map.
@spec start_assign() :: :ok
Starts assignment job on the RoleServer.
@spec start_link(any()) :: GenServer.on_start()
Supervisor Entry point.
@spec subscribe(:simple | :detailed) :: :ok
Subscribes to the table mapped to the DistrServer Elixir.Beethoven.RoleServer
'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}}
@spec table_exists?() :: boolean()
Checks if the DistrServer Elixir.Beethoven.RoleServer
's mnesia table exists.
Holds the thread until the DistrServer Elixir.Beethoven.RoleServer
's mnesia table becomes available, or timeout occurs.
Defaults to 1_000
milliseconds for timeouts and 15
milliseconds for checking intervals.