Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active September 7, 2018 14:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
def handle_call({:add, event}, _from, worker) do
logEntry = %LogEntry{
origin: worker.name,
time: worker.clock,
event: event
}
newWorkerState = %{ worker |
clock: worker.clock + 1,
eventLog: [logEntry | worker.eventLog]
}
PubSub.broadcast(@log_replication_topic, {:replication_log, logEntry})
{:reply, :ok, newWorkerState }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment