Created
July 26, 2020 03:37
-
-
Save chelseatroy/e7b8313b7d6357cac75efd3fea9d34f6 to your computer and use it in GitHub Desktop.
Conditional Statement—Committing for Followers
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
... | |
elif string_operation.split(" ")[0] == "commit_entries": | |
# followers do this to update their logs. | |
stringified_logs_to_append = string_operation.replace("commit_entries ", "") | |
print("Preparing to commit: " + stringified_logs_to_append) | |
logs_to_append = ast.literal_eval(stringified_logs_to_append) | |
[key_value_store.write_to_state_machine(command, term_absent=True) for command in logs_to_append] | |
response = "Commit entries call successful!" | |
print("State machine after committing: " + str(key_value_store.data)) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment