x 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
..
backend 369946786a error: Fix variant name typos and use PhantomTreeBatch 3 weeks ago
common 0816ebf578 refactor: Retain database overlay history internally 3 weeks ago
database e7ec792033 tree: Enforce allowed characters in tree names 3 weeks ago
database_overlay 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
managed_tree_overlay d719f1a20b perf: Index retained managed tree overlay history 3 weeks ago
tree_overlay d1a9c4cfd3 tree_overlay: Have fjall use Peekable the same way sled does 3 weeks ago
README.md 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
checkpoint_commit.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
database_history.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
fork_history.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
overlay_abandonment.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
reorg_history.rs 8d220f215b feat: Add persistent tree caches to database overlays 3 weeks ago
tree_batch_commit.rs 6f235ca0fa refactor: Retain managed tree overlay history internally 3 weeks ago
tree_history.rs 6f235ca0fa refactor: Retain managed tree overlay history internally 3 weeks ago
unit.rs 05220795a7 refactor: Separate managed tree bookkeeping from plain overlays 4 weeks ago

README.md

Tests

The suite exercises backend, database, plain/managed tree-overlay, and database-overlay APIs on Fjall and Sled. Context-level tests are loaded by unit.rs from their respective directories. Crate-private helper tests live beside their owning source modules under src/. Root-level showcase targets combine mutation, capture, replay, confirmation, reversal, and caller-controlled persistence. Crate-level doctests demonstrate plain checkpoint/batch persistence, managed-tree capture/persist/confirmation, and reusable full database application. The Value doctest covers borrowed reads. Shared fixtures and exact-state, key-reference, and tree-reference assertions live in common/; byte literals keep empty and binary values explicit.

Usage

Run the suite on each backend:

cargo test --no-fail-fast
cargo test --no-default-features --features sled-backend --no-fail-fast

Run a single context:

cargo test --test unit backend::
cargo test --no-default-features --features sled-backend --test unit backend::
cargo test --test unit database::
cargo test --no-default-features --features sled-backend --test unit database::
cargo test --test unit tree_overlay:: -- --skip managed_tree_overlay::
cargo test --no-default-features --features sled-backend --test unit tree_overlay:: -- --skip managed_tree_overlay::
cargo test --test unit managed_tree_overlay::
cargo test --no-default-features --features sled-backend --test unit managed_tree_overlay::
cargo test --test unit database_overlay::
cargo test --no-default-features --features sled-backend --test unit database_overlay::

Run a combined showcase:

cargo test --test tree_history
cargo test --no-default-features --features sled-backend --test tree_history
cargo test --test reorg_history
cargo test --no-default-features --features sled-backend --test reorg_history

Coverage

Context Tests Behavior
Backend backend/tree.rs Insert/update/remove/clear, return values, empty versus missing records, binary data, shared handles and backend names
Backend backend/iterator.rs Forward/reverse/mixed iteration, exhaustion, consuming iteration, first/last, strict neighbors, range boundaries and prefixes
Backend backend/phantom.rs Empty reads, unavailable backend name, no-op mutations, empty iterators
Backend backend/value.rs Backend ownership, cached borrowing, cloned handles, reader support, independent into_vec copies
Backend backend/batch.rs Deferred writes, per-key last-operation semantics, applying empty batches, retained tree handles
Database database/lifecycle.rs Opening/wrapping/cloning databases, tree creation/reopening/drop/recreation, phantom lookup, catalogs, tree-name byte-length limits and ASCII character validation, allowed punctuation
Database database/batches.rs Multi-tree writes, empty input preserving empty/populated databases, mixed empty/nonempty batches, phantom rejection before writes, native Fjall batches
Database database/overlay_writes.rs Overlay writes with retained cache/markers/references, empty input preserving empty/populated databases, unchanged overlays, empty phantoms alone and interleaved with changed/unchanged real overlays, forward/inverse/empty diffs, rejection of changed phantoms
Database database/persistence.rs Default and explicit synchronous/asynchronous flushing, reopen contents, empty trees/values, binary data, persisted updates/removals/drops
Tree overlay tree_overlay/mutations.rs Read-through and cached values, independent into_vec copies surviving source mutation/destruction, mutation return values, phantom writes, disjoint writes/markers, missing-key errors, repeated clear, deferred aggregation
Tree overlay tree_overlay/queries.rs Ordered merged iteration, cache precedence, cached-value removal on real and phantom trees, exhaustion, last-key and emptiness queries across live backend mutations, canceled-insertion markers with backend/cached records on real and phantom trees
Tree overlay tree_overlay/diff.rs Packet inversion/cloning and empty forward/reverse batches
Tree overlay tree_overlay/checkpoint.rs Initial rollback, repeatable restoration, independent clone/checkpoint data
Managed tree overlay managed_tree_overlay/mutations.rs Missing-key errors, clear and repeated-clear marker/ownership retention before and after capture, deferred aggregation
Managed tree overlay managed_tree_overlay/queries.rs Canceled-insertion markers with backend/cached records on real and phantom trees, exact deltas and zero ownership
Managed tree overlay managed_tree_overlay/diff.rs Exact backend/retained-history deltas, same-step cancellation and undo values, side-effect-free previews and archives, prefix confirmation
Managed tree overlay managed_tree_overlay/state.rs Key-only capture ownership, mutation-only replay and inverse replay with explicit recording boundaries, per-step cleanup, retained writes/markers, whole-owner reset and data equality
Managed tree overlay managed_tree_overlay/history.rs Grouped/separate packets and local baselines, cancellation and empty-step ordering, borrowed front persistence, uncaptured edit cleanup, empty-history no-ops, reset preserving data/binding/checkpoint, independent clone history, failed caller persistence and explicit rebinding, clone capture/confirmation after original confirmation/reset/destruction with rebinding and per-key backend fallback
Managed tree overlay managed_tree_overlay/checkpoint.rs Speculative data rollback without preview/capture, snapshot replacement and repeatable restoration, independent clone data/references/history, conversion from plain overlays with empty bookkeeping, rebinding with retained counts and history
Internal helper ../src/managed_tree_overlay/tests.rs Synthetic retained history owns keys independently of empty data, exact reference queries and reset
Internal helper ../src/managed_tree_overlay/history/tests.rs Indexed endpoints/counts against retained-packet scans, pointer-identity retirement of value-equal steps, released payloads, independently advancing/resetting clones sharing immutable diffs, empty steps, missing versus empty key endpoints, and unrelated-key retention
Internal helper ../src/tree_overlay_state/tests.rs Supplied-diff cleanup without retained references: matching writes and named deletion markers are removed; differing writes and unrelated markers remain
Internal helper ../src/database_overlay/history/tests.rs Index endpoints against retained-packet scans, pointer-identity retirement and pre-confirmation ownership checks for value-equal steps, released payloads, independently advancing/resetting clones sharing immutable diffs, empty steps/lifetimes and missing versus empty key endpoints
Database overlay database_overlay/dropped.rs Dropped-key candidates including referenced removal/clear markers, backend-baseline versus retained-history undo values, skipped captured removals, backend-relative inspection across capture and prefix persistence, local confirmation, clone/reset, conversion back to removal markers with database-owned references
Database overlay database_overlay/lifecycle.rs Explicit opening, backend/phantom bindings, invalid names, dropping/reopening trees, uncaptured phantom cancellation after read-only preview, captured/replayed empty-tree ownership through drop/reopen, state-tree handles
Database overlay database_overlay/mutations.rs Named-tree query/mutation routing, cached value borrowing, unavailable-tree and missing-key errors, isolated clear, repeated-clear markers through oldest-first confirmation and phantom rebinding, emptiness with pending insert/remove markers before and after confirmation
Database overlay database_overlay/queries.rs Owner-level key/tree reference inspection for live, dropped, empty, unopened, and absent trees
Database overlay database_overlay/diff.rs Created/updated/removed deltas, read-only preview, retained-history lookup, same-step drop/recreate endpoint deltas against backend or captured state, empty cancellation followed by later updates, per-key backend fallback in referenced trees, unchanged captured-key restoration and later reinsertion of a captured removal, same-step insert/update/drop undo across unrelated history, captured remove/drop undo and uncaptured insert/remove exclusion, empty-tree removal after captured key removal, once-per-boundary drops across recreation, history-independent aggregate undo, inversion, handle requirements and key-batch aggregation
Database overlay database_overlay/state.rs Empty state, local capture baselines rather than imported old values, complete multitree capture with side-effect-free previews, data-only state copies versus owner clones, whole-owner reset isolation, independent key/tree replay and inverse ownership, live-cache aggregation, external drop confirmation releasing obsolete keys while retaining later tree lifetimes, phantom rebinding
Database overlay database_overlay/history.rs Grouped versus separate packet captures, cancellation and empty queue entries, oldest-first borrowed iteration and independent archives, front-only retirement returning the shared payload, empty-step versus no-history returns, uncaptured write/marker retention, whole-queue reset and backend recapture, failed confirmation preserving data/history/counts/index baselines and prepared bindings, clone capture/confirmation after original confirmation/reset/destruction, returned diffs surviving owner destruction without logical ownership
Database overlay database_overlay/apply.rs Reusable full application and fresh-construction reset including checkpoint, uncaptured writes, failed apply preserving overlay state, empty inputs, caller packet persistence without open caches, front application returning the persisted diff while retaining exact later steps and uncaptured key/tree changes, empty-front return and no-history no-op, failed front application preserving data/history/bindings, prefix retention/cleanup, empty recreation surviving earlier creation confirmation, repeated empty/populated drops with real/phantom rebinding, reopening retained drops with preserved markers
Database overlay database_overlay/checkpoint.rs Speculative data/lifecycle rollback without preview/capture, snapshot replacement/restoration, live/dropped catalogs and bindings, independent clone key/tree ownership and history, empty lifetimes, separate reset isolation with preserved checkpoints
Database overlay database_overlay/persistent_tree_caches.rs Constructor-configured cache retention, confirmation/front/full application cleanup and bindings, post-apply checkpoints, direct/replayed drops ending retention, recreation, failed drops, clone/reset/rollback behavior, and failed empty-cache rebinding
Showcase tree_history.rs Capture/rebuild with independent local histories, empty steps, oldest-first confirmation, stepwise and accumulated inverse replay with emptiness agreement before/after batch persistence, fresh edits/clear after confirmation, repeated-clear/repopulation and batch confirmation
Showcase database_history.rs Multi-tree capture and independent-backend replay, exact pending prefixes, same-step insert/drop undo exclusion, remove/drop undo from preceding captures across prefix persistence, fresh update/drop capture and backend-relative inspection followed by persistence/confirmation/undo, phantom rebinding, captured empty creation/drop tree ownership, empty-tree drops after captured key removal and unrelated edits, repeated drop/recreate/drop ownership through confirmation, same-step drop/recreate cancellation against captured contents, lifecycle reversal and reopen
Showcase fork_history.rs Rebuilt forks, one shared-prefix writer with per-fork confirmation, divergent suffix selection, emptiness agreement across pending histories and accumulated inverses, stepwise reversal and accumulated inverses followed by full application/reopen
Showcase reorg_history.rs Capture/archive/apply A/B/C with untouched trees, grouped C→A rollback (key insert/remove and value round-trip cancellation, empty and populated tree lifetimes canceled) or stepwise C→B→A rollback measured against history, exact A→D and D→E captures with per-step reference ownership, unchanged backend during validation, adopted A/D/E history excluding the rollback, full reorg application and flush/reopen, peer-at-C replay of the captured reorg including rollback, independent prefix-by-prefix replay/confirmation, and reverse replacement-suffix replay back to A
Showcase checkpoint_commit.rs Tree/database speculative rollback without preview/capture/registration, retained accepted ownership, independent clone abandonment, selected batch or full application, flush/reopen
Showcase tree_batch_commit.rs Real and phantom tree overlays, explicit backend binding, cross-tree writes, empty writes before/after persistence and confirmation, local confirmation, flush/reopen
Showcase overlay_abandonment.rs Standalone phantom abandonment, independently constructed overlays sharing a phantom name, selected full commit, captured/uncaptured changes, flush/reopen