Support atomic reservations and repeatable transfers of bounded quantities in memory #8

Closed
opened 2026-12-02 18:46:11 +00:00 by faumaray · 1 comment
Owner

An in-memory simulation reserves discrete units at a source and free capacity at a destination. Pickup and delivery can occur on different ticks, with a save and reload between them. The caller needs a single outcome for a conditional change to all participating accounts. A failed operation must preserve every balance. A repeated delivery must apply the quantity once.

At the current game pin and Library HEAD, Void::Storage::Batch supports atomic conditional operations on byte keys and values inside a storage engine. Its tests cover preconditions and atomic batches. Void::Numeric supplies checked integer arithmetic. Our simulation already owns its in-memory state, snapshots and tick boundaries. Batch API · Storage tests · Checked arithmetic

Would a reusable in-memory primitive fit the library? The caller would supply its own owner/resource keys, quantities, operation identity and capacity limits. Required outcomes include an atomic reservation on multiple keys, release without ownership change, transfer to the next owner and an explicit result on insufficient balance, exhausted capacity or overflow. Committed phases need stable retry outcomes that can survive an application-managed restore. Issue #6 covers the related request-result lookup.

Downstream adoption would require tests for two claimants competing for the last unit, failure of the last precondition restoring all prior balances, cancellation before pickup and during delivery, and replay after restoring a partially completed transfer. Each test checks the observed owner and exact total. Scene objects, recipes, recovery destinations and permitted losses are game decisions. Downstream S04 plan · Downstream S06 plan

An in-memory simulation reserves discrete units at a source and free capacity at a destination. Pickup and delivery can occur on different ticks, with a save and reload between them. The caller needs a single outcome for a conditional change to all participating accounts. A failed operation must preserve every balance. A repeated delivery must apply the quantity once. At the current game pin and Library HEAD, `Void::Storage::Batch` supports atomic conditional operations on byte keys and values inside a storage engine. Its tests cover preconditions and atomic batches. `Void::Numeric` supplies checked integer arithmetic. Our simulation already owns its in-memory state, snapshots and tick boundaries. [Batch API](https://git.faumaray.com/Void/Library/src/commit/7b0fea6095f603f9e1904f66dfdc7752f4be4792/include/Void/Storage/Batch.hpp) · [Storage tests](https://git.faumaray.com/Void/Library/src/commit/7b0fea6095f603f9e1904f66dfdc7752f4be4792/tests/standalone/Storage/Storage.cpp) · [Checked arithmetic](https://git.faumaray.com/Void/Library/src/commit/7b0fea6095f603f9e1904f66dfdc7752f4be4792/include/Void/Math/Numeric.hpp) Would a reusable in-memory primitive fit the library? The caller would supply its own owner/resource keys, quantities, operation identity and capacity limits. Required outcomes include an atomic reservation on multiple keys, release without ownership change, transfer to the next owner and an explicit result on insufficient balance, exhausted capacity or overflow. Committed phases need stable retry outcomes that can survive an application-managed restore. [Issue #6](https://git.faumaray.com/Void/Library/issues/6) covers the related request-result lookup. Downstream adoption would require tests for two claimants competing for the last unit, failure of the last precondition restoring all prior balances, cancellation before pickup and during delivery, and replay after restoring a partially completed transfer. Each test checks the observed owner and exact total. Scene objects, recipes, recovery destinations and permitted losses are game decisions. [Downstream S04 plan](https://git.faumaray.com/Lagg1ng/stoneheart_at_home/src/branch/chore/plans/docs/plan/systems/S04.md) · [Downstream S06 plan](https://git.faumaray.com/Lagg1ng/stoneheart_at_home/src/branch/chore/plans/docs/plan/systems/S06.md)
Author
Owner

Implemented on branch issue/8-account-ledger (commit a4851c2).

Void::Containers::AccountLedger added: atomic multi-account reservations, repeatable transfers, save/restore replay and explicit failure outcomes.

Branch: https://git.faumaray.com/Void/Library/src/branch/issue/8-account-ledger
Merge request: https://git.faumaray.com/Void/Library/pulls/new/issue/8-account-ledger

Implemented on branch `issue/8-account-ledger` (commit `a4851c2`). `Void::Containers::AccountLedger` added: atomic multi-account reservations, repeatable transfers, save/restore replay and explicit failure outcomes. Branch: https://git.faumaray.com/Void/Library/src/branch/issue/8-account-ledger Merge request: https://git.faumaray.com/Void/Library/pulls/new/issue/8-account-ledger
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Void/Library#8