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