Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created July 26, 2020 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/e7b8313b7d6357cac75efd3fea9d34f6 to your computer and use it in GitHub Desktop.
Save chelseatroy/e7b8313b7d6357cac75efd3fea9d34f6 to your computer and use it in GitHub Desktop.
Conditional Statement—Committing for Followers
...
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