View Source ProcessHub.Hub (ProcessHub v0.7.0)
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.
Parsed :auto_recovery config. enabled? gates the lifecycle;
reconcile_grace_ms delays the first reconcile round after coordinator start;
reconcile_interval_ms rate-limits subsequent rounds and bounds each blocking
hook handler; remote_manifest is the optional off-cluster declared-list
adapter ({module, opts}).
Coordinator boot-recovery state. :recovering means the first orphan reconcile
round has not completed; :normal means it has and is terminal.
Functions
Returns the default event batch state.
The hub a worker needs — identity, processes, storage, configuration — with the coordinator's transient bookkeeping blanked. That bookkeeping (every in-flight operation, the declared-list batch, event batches, waiters) grows with the load; handed to the worker queue and copied into every request task it made each start cost as much as every start in flight.
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_config() :: %{ enabled?: boolean(), reconcile_grace_ms: pos_integer(), reconcile_interval_ms: pos_integer(), remote_manifest: {module(), keyword()} | nil }
Parsed :auto_recovery config. enabled? gates the lifecycle;
reconcile_grace_ms delays the first reconcile round after coordinator start;
reconcile_interval_ms rate-limits subsequent rounds and bounds each blocking
hook handler; remote_manifest is the optional off-cluster declared-list
adapter ({module, opts}).
@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.Hub{ declared_batch: ProcessHub.Service.Batch.t(), declared_unsynced: map() | nil, event_batches: %{nodedown: batch_state(), cluster_join: batch_state()}, hub_id: atom(), migration_retry_timer: reference() | {:running, reference()} | nil, nodeup_reconcile_timers: %{required(node()) => reference()}, pending_operations: %{ required(reference()) => ProcessHub.Service.RequestManager.t() }, pending_work_count: non_neg_integer(), procs: %{ initializer: pid(), task_sup: {:via, Registry, {pid(), binary()}}, dist_sup: {:via, Registry, {pid(), binary()}}, worker_queue: {:via, Registry, {pid(), binary()}}, janitor: {:via, Registry, {pid(), binary()}}, manifest_shipper: {:via, Registry, {pid(), binary()}}, event_queue: atom() }, reconcile_last_at: integer() | nil, reconcile_running?: boolean(), recovery_config: recovery_config(), recovery_normal_waiters: %{required(GenServer.from()) => reference()}, recovery_state: recovery_state(), storage: %{ optional(:registry_backend) => {module(), term()}, optional(:declared_backend) => {module(), term()}, optional(:declared_path) => String.t(), misc: :ets.tid(), hook: :ets.tid() } }
Functions
Returns the default event batch state.
The hub a worker needs — identity, processes, storage, configuration — with the coordinator's transient bookkeeping blanked. That bookkeeping (every in-flight operation, the declared-list batch, event batches, waiters) grows with the load; handed to the worker queue and copied into every request task it made each start cost as much as every start in flight.