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

spec: Snapshot isolation, db.lock() and revert() #395

Open
raykyri opened this issue Nov 6, 2024 · 0 comments
Open

spec: Snapshot isolation, db.lock() and revert() #395

raykyri opened this issue Nov 6, 2024 · 0 comments
Labels

Comments

@raykyri
Copy link
Member

raykyri commented Nov 6, 2024

  1. Implement revert() as a runtime-level primitive in addition to insert and handleAction. This is a low-level primitive that can be called by a runtime consumer through a hook, that reverts the effects of a past signed message.
  • This isn't a gossiplog-level primitive because it doesn't do any branch tracking, all it does is process $effects and model tables to revert the effects of an action. Its effects are exclusively at the level above the sync topology / causal log topology.
  • It can only be called for actions.
  • For testing, override execute to provide a db.revert()
  • Update handleAction to add a new db.revert(id) operation (temporarily) to test.
  1. Add locking to the database and update handleAction to add locking.
  • If an action calls db.lock() which can only be called at the beginning of the function, then any effects written after it are isolated to the action message ID and any later operation that reverts the action message ID should also revert the effects.
  • If an isolated action reads from any effects that contain a lock, then it should inherit that lock. Reads are deterministic because db.get() searches the causal log, so we don't need to worry about consistency issues here.
  • If an isolated or non-isolated action merges with past effects and any of them was isolated under a lock, then the merged effect should inherit its lock(s).
  • $locks table includes the columns key, action, lock with indexes on each field
  • $effects table schema is unchanged with columns key, value, branch, clock
@raykyri raykyri changed the title packages/core: Snapshot isolation, lock and revert packages/core: Snapshot isolation, db.lock() and revert Nov 6, 2024
@raykyri raykyri changed the title packages/core: Snapshot isolation, db.lock() and revert packages/core: Snapshot isolation, db.lock() and revert() Nov 8, 2024
@raykyri raykyri changed the title packages/core: Snapshot isolation, db.lock() and revert() spec: Snapshot isolation, db.lock() and revert() Nov 26, 2024
@raykyri raykyri added the prop-0 label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant