Introduce builders for the storage implementations - #260
Draft
Alnusjaponica wants to merge 1 commit into
Draft
Alnusjaponica wants to merge 1 commit into
Alnusjaponica wants to merge 1 commit into
Conversation
Replace the `XxxStorageOptions`/`new_with_option(s)` construction pattern with builders following the API style of `std::thread::Builder`: settings are configured by chaining setter methods and the storage is created with `build`. - `InMemoryStorageBuilder`: `InMemoryStorage::builder().apply_discard(true).build()` - `SQLite3StorageBuilder`: `SQLite3Storage::builder(file_path).apply_discard(true).build()` - `JournalStorageBuilder`: `JournalStorage::builder(backend).apply_discard(true).build()` `InMemoryStorageOptions`, `SQLite3StorageOptions`, `JournalStorageOptions` and `new_with_option`/`new_with_options` are removed. `new` is kept for backward compatibility and now delegates to the builders. The pyo3 bindings construct storages through the builders as well.
Alnusjaponica
marked this pull request as draft
September 28, 2026 02:21
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.
Summary
Replace the
XxxStorageOptions/new_with_option(s)construction pattern with builders following the API style ofstd::thread::Builder: settings are configured by chaining setter methods and the storage is created withbuild.Changes
InMemoryStorageBuilder,SQLite3StorageBuilder, andJournalStorageBuilder(withDefaultwhere they have no required arguments), exposingbuilder(), chainable setters, andbuild()InMemoryStorageOptions,SQLite3StorageOptions,JournalStorageOptionsandnew_with_option/new_with_optionsnewfor backward compatibility; it now delegates to the buildersSQLite3Storage/JournalStorage/CachedStoragealso keep their existingnewsignaturescache.rsthat referenced the removed options structsVerification
cargo test --all-features— 275 tests pass (including new doctests)cargo test -p rustuna_storage --locked -- --ignored(fromrustuna_pyo3) — 3 passcargo clippy --locked --workspace --lib --bins --tests --examples --all-features -- -D warnings— cleancargo fmt --all -- --check— cleanuv run --no-sync pytest tests/— 701 pass