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

The coordinator's state: the hub's fixed parts (ProcessHub.Hub) and the bookkeeping that changes as the coordinator handles messages.

Summary

Types

Per-event batch state: pending nodes, debounce timer ref, and the monotonic ms at which the current window opened — used to cap the total wait so a sustained event stream cannot starve the batch.

Coordinator boot-recovery state. :recovering means the first orphan reconcile round has not completed; :normal means it has and is terminal.

t()

Functions

Returns the default event batch state.

Types

@type batch_state() :: %{
  nodes: [node()],
  timer_ref: reference() | nil,
  started_at: integer() | nil
}

Per-event batch state: pending nodes, debounce timer ref, and the monotonic ms at which the current window opened — used to cap the total wait so a sustained event stream cannot starve the batch.

@type recovery_state() :: :recovering | :normal

Coordinator boot-recovery state. :recovering means the first orphan reconcile round has not completed; :normal means it has and is terminal.

@type t() :: %ProcessHub.Coordinator.State{
  cluster_settled?: boolean(),
  declared_batch: ProcessHub.Service.Batch.t(),
  declared_unsynced: ProcessHub.Service.DeclaredChildren.pending() | nil,
  event_batches: %{
    nodedown: batch_state(),
    cluster_leave: batch_state(),
    cluster_join: batch_state(),
    grace_expired: batch_state()
  },
  hub: ProcessHub.Hub.t(),
  migration_retry_timer: reference() | {:running, reference()} | nil,
  nodedown_grace_timers: %{required(node()) => reference()},
  nodeup_reconcile_timers: %{required(node()) => reference()},
  pending_operations: %{
    required(reference()) => ProcessHub.Service.RequestManager.t()
  },
  pending_work_count: non_neg_integer(),
  reconcile_last_at: integer() | nil,
  reconcile_requested?: boolean(),
  reconcile_running?: boolean(),
  recovery_normal_waiters: %{required(GenServer.from()) => reference()},
  recovery_state: recovery_state(),
  registry_delivered_by: MapSet.t(node())
}

Functions

@spec default_batch_state() :: batch_state()

Returns the default event batch state.