Repository navigation
feat(kv-store): add readOnlyTransaction to AztecAsyncKVStore - #440
Draft
spalladino wants to merge 2 commits into
Draft
spalladino wants to merge 2 commits into
spalladino wants to merge 2 commits into
Conversation
Adds `readOnlyTransaction(callback)`, which runs the callback against a consistent view of the store so that no write can land between two of its reads. Nested calls reuse the enclosing transaction, matching `transactionAsync`. Every backend, lmdb-v2 included, implements it with `transactionAsync` for now, so on lmdb-v2 the callback still goes through the single writer queue. Callers can move their read paths onto it today; a later change can back the lmdb-v2 implementation with a native LMDB read transaction, so readers stop queueing behind writers, without touching those callers.
…ssages `ReadTransaction.getMany` sent every key in a single GET message. It now sends at most `GET_CHUNK_SIZE` (1024) keys per message, which bounds the size of each request and response for callers that batch-read many keys, such as the archiver's per-block log reads.
This was referenced Oct 9, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Bottom to top, each PR targets the branch below it:
Context
Part of A-1817. Redoes the TypeScript API of AztecProtocol/aztec-packages#25280 (closed after the repo split). The native read-only LMDB transactions are in AztecProtocol/aztec-packages#25631 and not released yet, so this adds the API with every backend delegating to
transactionAsync. A-2377 swaps the lmdb-v2 implementation to a real native snapshot once released.Approach
AztecAsyncKVStore.readOnlyTransaction(callback): runs the callback against a consistent view. Implemented on lmdb-v2, lmdb v1, sqlite-opfs, indexeddb and the pxe store spy, all delegating totransactionAsync(same nesting semantics). On lmdb-v2 it still goes through the writer queue for now; callers must not write inside it, since that will stop working once it becomes a real snapshot.ReadTransaction.getMany(from feat: getMany in maps #129) now sends at most 1024 keys perGETmessage, bounding message size and how long one read holds its transaction.API changes
AztecAsyncKVStoregainsreadOnlyTransaction<T>(callback: () => Promise<T>): Promise<T>.