Created
July 26, 2020 03:27
-
-
Save chelseatroy/6042bdd28f4cead0e801e3ef52f7550d to your computer and use it in GitHub Desktop.
Marking Follower Servers Updated
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
... | |
def mark_updated(self, server_name): | |
self.followers_with_update_status[server_name] = True | |
trues = len(list(filter(lambda x: x is True, self.followers_with_update_status.values()))) | |
falses = len(list(filter(lambda x: x is False, self.followers_with_update_status.values()))) | |
if trues >= falses: | |
print("Committing entry: " + self.current_operation) | |
self.current_operation_committed = True | |
self.key_value_store.write_to_state_machine(self.current_operation, term_absent=True, write=False) | |
broadcast(self, with_return_address(self, "commit_entries ['" + self.current_operation + "']")) | |
self.current_operation_committed = False | |
for server_name in other_server_names(self.name): | |
self.followers_with_update_status[server_name] = False | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment