Skip to content

sdk: typed local-store helpers over the apply seam#630

Merged
mfw78 merged 1 commit into
dev/m1from
feat/609-sdk-store
Jul 25, 2026
Merged

sdk: typed local-store helpers over the apply seam#630
mfw78 merged 1 commit into
dev/m1from
feat/609-sdk-store

Conversation

@mfw78

@mfw78 mfw78 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What

LocalStoreHost gains WriteOp and apply, with a documented per-op set/delete default for arbitrary impls such as mocks; the WitBindgenHost adapter overrides it with the atomic nexum:host/local-store.apply verb landed in #611. A new nexum_sdk::store module layers typed helpers over the seam: a WriteBatch builder flushed in one apply call (an unflushed drop discards), clear_prefix, borsh-typed TypedCell and TypedMap (insert/get/remove/keys plus an atomic clear), and a u64 Counter safe under single-actor dispatch.

Why

Wave 2 of #609 (ADR-0014 SDK ergonomics): the sanctioned atomicity scope is the opt-in batch verb, but without an SDK surface every module hand-rolls serialization and batching against raw get/set bytes. The keeper Journal is untouched; its single-key markers stay on plain set because they span the submit await and must never ride an apply batch.

Testing

nix develop --command just ci green (rustfmt, clippy -D warnings, rustdoc, all module wasm builds, full workspace test suite including 9 new integration tests over the mock local store and a default-apply order test), plus just check-venue-agnostic and just check-cow-orderbook-only all PASS.

AI Assistance

Implemented and verified with AI assistance.

Part of #609.

Expose the atomic batch verb on the seam: LocalStoreHost gains WriteOp and apply, whose default is an explicit per-op set/delete fallback for arbitrary impls such as mocks, and the WitBindgenHost adapter overrides it with the host's apply verb so a flushed batch is all-or-nothing on the real host.

Add nexum_sdk::store with the #609 Wave 2 helpers: a WriteBatch builder flushed in one apply call, clear_prefix, borsh-typed TypedCell and TypedMap, and a u64 Counter, so module code hand-rolls neither serialization nor batching.
@mfw78
mfw78 force-pushed the feat/609-sdk-store branch from 664bc08 to bb547d1 Compare July 25, 2026 10:58
@mfw78
mfw78 merged commit d2a5cc0 into dev/m1 Jul 25, 2026
7 checks passed
@mfw78
mfw78 deleted the feat/609-sdk-store branch July 25, 2026 12:29
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

Successfully merging this pull request may close these issues.

1 participant