View Source ProcessHub.Service.State (ProcessHub v0.8.0)

The state service provides API functions for managing the state of the hub.

Summary

Functions

Returns a boolean indicating whether the hub cluster is partitioned.

Terminates the local distributed supervisor.

Restarts the local distributed supervisor.

Functions

@spec is_partitioned?(ProcessHub.Hub.t()) :: boolean()

Returns a boolean indicating whether the hub cluster is partitioned.

Link to this function

toggle_quorum_failure(hub)

View Source
@spec toggle_quorum_failure(ProcessHub.Hub.t()) ::
  :ok | {:error, :already_partitioned}

Terminates the local distributed supervisor.

The children it ran are stopped with it, so this node withdraws its claim on them and remembers them for toggle_quorum_success/1: a hub in partition mode never tells the cluster it runs a child it does not.

Link to this function

toggle_quorum_success(hub)

View Source
@spec toggle_quorum_success(ProcessHub.Hub.t()) :: :ok | {:error, :not_partitioned}

Restarts the local distributed supervisor.

It comes back empty. The rows of the reachable hub nodes that kept their quorum are merged first, the way a join merges them, so this node sees where their side runs each child. Of the children this node held when it stopped, it starts again only those no node runs; the node-up redistribution moves back the others that belong here. A child stopped on the other side meanwhile is one no node runs, so it starts again too; with :auto_recovery the next round stops it.