Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Marking Follower Servers Updated
...
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
You can’t perform that action at this time.