Beethoven.Tracker (Beethoven v0.2.3)
Module to handle the Beethoven.Tracker
mnesia table.
This table is used by beethoven to track the state and roles of nodes within the cluster.
Summary
Functions
Add role to a node.
Adds self to BeethovenTracking Mnesia table. Uses a record like this
List of builtin roles used for filtering.
Clear all roles from offline nodes. Returns list of roles cleared.
Clear all roles from a node.
Compares a list of roles to what is hosted in the Tracker. Returns roles that are not hosted in Mnesia, but provided in the argument. Duplicate inputs are allowed and encouraged.
Gets roles hosted in the cluster. Provides list of roles - this list is not deduplicated.
Gets the count of roles held by each node. Provides a list of lists, where each nested list is data from a single record in mnesia.
Gets roles hosted in the cluster by offline nodes. Provides list of roles - this list is not deduplicated.
Checks if a role is hosted on a given node.
Checks if a role is hosted in the cluster. Does not return truthful if the hosting node is offline.
Joins the Beethoven.Tracker
mnesia table as a cluster node.
Removes builtin roles from a list of roles provided to the function.
Remove role from a node.
Sets node in tracker offline. Also clears roles on the node.
Starts Beethoven.Tracker
Mnesia table
Subscribe to changes to the BeethovenTracking Mnesia table.
Functions
Add role to a node.
@spec add_self(list()) :: :ok
Adds self to BeethovenTracking Mnesia table. Uses a record like this:
{Tracker, node(), roles, :online, DateTime.now!("Etc/UTC")}
@spec builtin_roles() :: list()
List of builtin roles used for filtering.
@spec clear_offline_roles() :: list()
Clear all roles from offline nodes. Returns list of roles cleared.
@spec clear_roles(atom()) :: :ok
Clear all roles from a node.
Compares a list of roles to what is hosted in the Tracker. Returns roles that are not hosted in Mnesia, but provided in the argument. Duplicate inputs are allowed and encouraged.
@spec get_active_roles() :: list()
Gets roles hosted in the cluster. Provides list of roles - this list is not deduplicated.
@spec get_active_roles_by_host() :: list()
Gets the count of roles held by each node. Provides a list of lists, where each nested list is data from a single record in mnesia.
@spec get_inactive_roles() :: list()
Gets roles hosted in the cluster by offline nodes. Provides list of roles - this list is not deduplicated.
Checks if a role is hosted on a given node.
Checks if a role is hosted in the cluster. Does not return truthful if the hosting node is offline.
@spec join() :: :ok | :not_started | :copy_error
Joins the Beethoven.Tracker
mnesia table as a cluster node.
Removes builtin roles from a list of roles provided to the function.
Remove role from a node.
@spec set_node_offline(node()) :: :ok
Sets node in tracker offline. Also clears roles on the node.
@spec start() :: :ok | :copied | :already_exists
Starts Beethoven.Tracker
Mnesia table
Subscribe to changes to the BeethovenTracking Mnesia table.