Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Committing the Entry as the Leader
...
else:
if self.leader:
self.current_operation = string_operation
if self.current_operation.split(" ")[0] in ["set", "delete"]:
key_value_store.write_to_log(string_operation, term_absent=True)
broadcast(self, with_return_address(self, "append_entries ['" + self.current_operation + "']"))
while not self.current_operation_committed:
pass
send_pending = False
else:
response = key_value_store.read(self.current_operation)
else:
response = "I am not the leader. Please leave me alone."
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.