Skip to content

Add BackendReader trait#986

Open
sergerad wants to merge 42 commits intonextfrom
sergerad-forest-reader-trait
Open

Add BackendReader trait#986
sergerad wants to merge 42 commits intonextfrom
sergerad-forest-reader-trait

Conversation

@sergerad
Copy link
Copy Markdown
Contributor

@sergerad sergerad commented May 1, 2026

Context

In #967 we created reader traits used by rocks db structs including a new snapshot reader struct.

We need to do the same for the large forest SMT traits and PersistentBackend.

Changes

  • Extracts a BackendReader trait from Backend, providing the read-only query interface for the SMT forest storage backend (open, get, get_leaf, version, lineages, trees, entries, entry_count).
  • Backend becomes a supertrait of BackendReader, extending it with write operations and an associated Reader type with a reader() method that returns a point-in-time snapshot.
  • Adds InMemoryBackendSnapshot — a read-only, snapshot of the in-memory backend — implementing only BackendReader.
  • Adds PersistentBackendReader — a read-only view of the persistent backend backed by a RocksDB snapshot, providing a consistent read view isolated from concurrent writes (Similar to RocksDbSnapshotStorage).

Base automatically changed from sergerad-largesmt-reader-trait to next May 1, 2026 02:36
@sergerad sergerad marked this pull request as ready for review May 4, 2026 01:41
@sergerad sergerad requested review from bobbinth and huitseeker May 4, 2026 01:41
@sergerad sergerad requested a review from iamrecursion May 4, 2026 02:49
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.

2 participants