Beethoven.DistrServer behaviour (Beethoven v0.3.1)
A modified version of the built-in GenServer.
Specialized for Beethoven's No-Master design; this GenServer will initialize a Mnesia table on creation.
These tables act as the primary state for the distributed process.
Supports most GenServer logic and callbacks.
Summary
Functions
Sends a cast to the provided DistrServer.
Similar to GenServer.call/2 and GenServer.call/3
Sends a cast to the provided DistrServer. Similar to GenServer.cast/2
Converts the DistrConfig() into the tableConfig() type.
Starts a DistrServer process under the supervisor tree.
Similar to GenServer.start_link/2 and GenServer.start_link/3
Types
@type copyTypes() :: :local | :multi
Copy options for the Mnesia table.
:local-> Copies are only on the table-creating-node.:multi-> Copies are pushed to ALL nodes in the cluster.
@type distrConfig() :: %{ tableName: atom(), columns: [atom()], indexes: [atom()], dataType: atom(), copyType: copyTypes() }
Configuration for the DistrServer instance.
:tableName-> Atomic name for the table.:columns-> List of atoms representing the names of columns in the name.:indexes-> List of table columns that should be indexed. Note: Indexing a column will slow writes to it, but make read operations consistent regardless of the table's size.:dataType-> Data type for the Mnesia table.:copyType-> How the new table will be copied across the Beethoven cluster.
Callbacks
@callback config() :: distrConfig()
-Callback required-
DistrServer configuration. See distrConfig() type for more information on the return.
@callback create_action(tableConfig :: Beethoven.MnesiaTools.tableConfig()) :: :ok
-Callback required-
Callback that is triggered when the process creates the Mnesia Table for the cluster.
-Callback required-
Entry point for the DistrServer process. Similar to init/1 for GenServers.
Functions
@spec call(GenServer.server(), any(), timeout()) :: any()
Sends a cast to the provided DistrServer.
Similar to GenServer.call/2 and GenServer.call/3
@spec cast(GenServer.server(), any()) :: :ok
Sends a cast to the provided DistrServer. Similar to GenServer.cast/2
@spec distr_to_table_conf(distrConfig()) :: Beethoven.MnesiaTools.tableConfig()
Converts the DistrConfig() into the tableConfig() type.
@spec start_link(module(), any(), GenServer.options()) :: GenServer.on_start()
Starts a DistrServer process under the supervisor tree.
Similar to GenServer.start_link/2 and GenServer.start_link/3