Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split commits into two phases: Prepare and Apply #22

Open
DavidBuchanan314 opened this issue Dec 13, 2024 · 2 comments
Open

Split commits into two phases: Prepare and Apply #22

DavidBuchanan314 opened this issue Dec 13, 2024 · 2 comments

Comments

@DavidBuchanan314
Copy link
Owner

DavidBuchanan314 commented Dec 13, 2024

"Prepare" is a read-only phase, generating a description of the required changes to be made to the repo.

"Apply" actually persists those changes to the db (making sure no other commits have been applied in the meantime!)

Currently both are rolled into one - the giant apply_writes function in repo_ops.py (nb: the verb "apply" is overloaded here - think of a better one?)

There are several benefits to this change:

  1. Improved testability (much easier to isolate the "Prepare" phase for testing).
  2. Opens the door for implementing client-signed commits (but this is far from the only change needed for that).
  3. Reduced db transaction granularity (two medium-sized transactions vs one big one).
@DavidBuchanan314
Copy link
Owner Author

Should probably separate out the core commit logic from the firehose message generation logic, too

@DavidBuchanan314
Copy link
Owner Author

re: verbs - "persist" seems like a good word for the second phase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant