Skip to content

Instantly share code, notes, and snippets.

@x-ji
Created December 12, 2019 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x-ji/699425a103dc0fac61d3c0a12f506ea1 to your computer and use it in GitHub Desktop.
Save x-ji/699425a103dc0fac61d3c0a12f506ea1 to your computer and use it in GitHub Desktop.
Markdium-Elixir process orchestration in Kubernetes with libcluster and swarm
# Change the handling of :begin_handoff
# This is triggered whenever a registered process is to be killed.
def handle_call({:swarm, :begin_handoff}, _from, current_state) do
{:reply, {:resume, produce_outgoing_state(current_state)}, current_state}
end
# Handle :end_handoff
# This is triggered whenever a process has been restarted on a new node.
def handle_call({:swarm, :end_handoff, incoming_state}, _from, current_state) do
{:noreply, end_handoff_new_state(current_state, incoming_state)}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment