Skip to content

Instantly share code, notes, and snippets.

@x-ji
Created December 12, 2019 19:39
Show Gist options
  • Select an option

  • Save x-ji/699425a103dc0fac61d3c0a12f506ea1 to your computer and use it in GitHub Desktop.

Select an option

Save x-ji/699425a103dc0fac61d3c0a12f506ea1 to your computer and use it in GitHub Desktop.

Revisions

  1. x-ji created this gist Dec 12, 2019.
    11 changes: 11 additions & 0 deletions Markdium-elixir.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # 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