View Source ProcessHub.Strategy.Migration.Base protocol (ProcessHub v0.2.3-alpha)
The migration strategy protocol provides API functions for migrating child processes.
Summary
Functions
Migrates processes from the local to the remote node.
Trigger after processes have been started on the local node.
Triggered when the coordinator is shutting down.
Triggered when coordinator is initialized.
Types
@type t() :: term()
All the types that implement this protocol.
Functions
handle_migration(struct, hub_id, child_specs, added_node, sync_strategy)
View Source@spec handle_migration( t(), ProcessHub.hub_id(), [ProcessHub.child_spec()], node(), ProcessHub.Strategy.Synchronization.Base.t() ) :: :ok
Migrates processes from the local to the remote node.
Process migration happens when a new node joins the ProcessHub
cluster, and some of the
local processes are moved to the newly connected node. This also requires the processes
to be terminated on the local node.
The redundancy strategy will deal with scenarios where processes are not terminated locally and are duplicated on the new node.
@spec handle_process_startups(t(), ProcessHub.hub_id(), [ {ProcessHub.child_id(), pid()} ]) :: :ok
Trigger after processes have been started on the local node.
Migration srategies can perform any necessary operations after the processes have been started such as state handover etc.
@spec handle_shutdown(t(), ProcessHub.hub_id()) :: :ok
Triggered when the coordinator is shutting down.
Could be used to perform state handover.
@spec init( struct(), ProcessHub.hub_id() ) :: any()
Triggered when coordinator is initialized.
Could be used to perform initialization.