Created
July 26, 2020 03:43
-
-
Save chelseatroy/7a48a37ad3f2e13023daf1945232ecdf to your computer and use it in GitHub Desktop.
Committing the Entry as the Leader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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