Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active September 6, 2018 11:29
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 deque-blog/cbeb7554cea86b6ea637386412a95fe1 to your computer and use it in GitHub Desktop.
Save deque-blog/cbeb7554cea86b6ea637386412a95fe1 to your computer and use it in GitHub Desktop.
def handle_info({:replication_log, logEntry}, worker) do
newWorkerState =
if logEntry.origin == worker.name do
worker
else
%{ worker |
clock: max(worker.clock, logEntry.time) + 1,
eventLog: [logEntry | worker.eventLog] }
end
{:noreply, newWorkerState }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment