Closed
Description
- Implement revert() as a runtime-level primitive in addition to
insert
andhandleAction
. 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.
- 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