View Source ProcessHub.Strategy.Migration.HandoverBehaviour behaviour (ProcessHub v0.5.0-beta)

Shared behaviour for migration state handover callbacks.

This behaviour defines the callbacks used by both HotSwap and ColdSwap migration strategies for state handover during process migration.

Implement these callbacks to customize how state is prepared before migration and how it's applied to the new process.

Summary

Callbacks

Called on the new process to apply the handover state. Return the new state for the process.

Called on the dying process to prepare state before migration. Return the state data to be transferred to the new process.

Callbacks

Link to this callback

alter_handover_state(current_state, handover_state)

View Source
@callback alter_handover_state(current_state :: term(), handover_state :: term()) ::
  term()

Called on the new process to apply the handover state. Return the new state for the process.

The default implementation replaces the current state with the handover state.

Link to this callback

prepare_handover_state(state)

View Source
@callback prepare_handover_state(state :: term()) :: term()

Called on the dying process to prepare state before migration. Return the state data to be transferred to the new process.

The default implementation returns the state unchanged.