View Source ProcessHub.Service.Cluster (ProcessHub v0.5.0-beta)

ProcessHub instances with the same hub_id will automatically form a cluster. The cluster service provides API functions for managing the cluster.

Summary

Functions

Adds a new node to the hub cluster and returns new list of nodes.

Handles the node down event by dispatching hooks, removing nodes from cluster state, and triggering the node down update task.

Handles the node up event by dispatching hooks, adding nodes to cluster state, checking partition tolerance for quorum recovery, and triggering the node up update task.

Returns a boolean indicating whether the node exists in the cluster.

Returns a list of nodes in the cluster.

Promotes the current node to a cluster node.

Removes a node from the cluster and returns new list of nodes.

Functions

Link to this function

add_hub_node(misc_storage, node)

View Source
@spec add_hub_node(:ets.tid(), node()) :: [node()]

Adds a new node to the hub cluster and returns new list of nodes.

Handles the node down event by dispatching hooks, removing nodes from cluster state, and triggering the node down update task.

Handles the node up event by dispatching hooks, adding nodes to cluster state, checking partition tolerance for quorum recovery, and triggering the node up update task.

@spec new_node?([node()], node()) :: boolean()

Returns a boolean indicating whether the node exists in the cluster.

Link to this function

nodes(misc_storage, opts \\ [])

View Source
@spec nodes(:ets.tid(), [:include_local] | nil) :: [node()]

Returns a list of nodes in the cluster.

Link to this function

promote_to_node(hub, node_name)

View Source
@spec promote_to_node(ProcessHub.Hub.t(), node()) :: :ok | {:error, :not_alive}

Promotes the current node to a cluster node.

Link to this function

rem_hub_node(misc_storage, node)

View Source
@spec rem_hub_node(:ets.tid(), node()) :: [node()]

Removes a node from the cluster and returns new list of nodes.