Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Conditional Statement—Responding to Data Manipulation Requests
...
else: #if the request is to get, set, or delete
if self.leader:
self.current_operation = string_operation
key_value_store.write_to_log(string_operation, term_absent=True)
if self.current_operation.split(" ")[0] in ["set", "delete"]:
broadcast(self, with_return_address(self, "append_entries [" + self.current_operation + "]"))
send_pending = False
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.