Skip to content

Instantly share code, notes, and snippets.

Last active September 7, 2018 14:20
What would you like to do?
def handle_call({:add, event}, _from, worker) do
logEntry = %LogEntry{
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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment