View Source ProcessHub.Service.Migration (ProcessHub v0.6.0)
Deferred-migration list and graceful node drain for the migration consent
protocol. See ProcessHub.Strategy.Migration.MigrationConsent.
Summary
Functions
Parks children in the deferred list and ensures the retry tick runs.
Drains the local node before shutdown: removes it from the distribution
cluster-wide, migrates every local child away through the consent gate, and
force-migrates whatever is still deferred at the :timeout deadline
(default 60000 ms). Leaves children untouched on error.
One retry pass: prunes entries whose child died or is assigned back to the local node, migrates the ready, re-consenting and expired ones, and returns the number of entries left.
Marks a deferred child ready; it migrates on the next retry tick.
Types
@type entry() :: %{ child_id: ProcessHub.child_id(), deferred_at: integer(), ready: boolean() }
Functions
@spec defer_children(ProcessHub.Hub.t(), [ProcessHub.child_id()]) :: :ok
Parks children in the deferred list and ensures the retry tick runs.
@spec deferred_child_ids(ProcessHub.Hub.t()) :: MapSet.t()
@spec deferred_list(ProcessHub.Hub.t()) :: [entry()]
@spec drain( ProcessHub.hub_id() | ProcessHub.Hub.t(), keyword() ) :: {:ok, %{migrated: non_neg_integer(), forced: non_neg_integer()}} | {:error, :no_target_nodes | :draining | :partitioned | :locked}
Drains the local node before shutdown: removes it from the distribution
cluster-wide, migrates every local child away through the consent gate, and
force-migrates whatever is still deferred at the :timeout deadline
(default 60000 ms). Leaves children untouched on error.
@spec draining?(ProcessHub.Hub.t()) :: boolean()
@spec handle_retry_tick(ProcessHub.Hub.t()) :: non_neg_integer()
One retry pass: prunes entries whose child died or is assigned back to the local node, migrates the ready, re-consenting and expired ones, and returns the number of entries left.
@spec migration_ready(ProcessHub.hub_id() | ProcessHub.Hub.t(), ProcessHub.child_id()) :: :ok | {:error, :not_deferred}
Marks a deferred child ready; it migrates on the next retry tick.
@spec retry_interval(ProcessHub.Hub.t()) :: pos_integer()