Repository navigation
Introduce builders for the storage implementations - #260
Draft
Alnusjaponica wants to merge 2 commits into
Draft
Alnusjaponica wants to merge 2 commits into
Alnusjaponica wants to merge 2 commits 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
Member
|
@Alnusjaponica Is this PR ready for review? |
Resolve conflicts with main, which added `attr_format` to the storage options, by adding an `attr_format` setter to each builder. Following the decision in #262, `XxxBuilder::new()` is now the only entry point (matching `std::thread::Builder::new()`); the `XxxStorage::builder()` methods are removed. - `InMemoryStorageBuilder::new().apply_discard(true).attr_format(..).build()` - `SQLite3StorageBuilder::new(file_path).apply_discard(true).build()?` - `JournalStorageBuilder::new(backend).apply_discard(true).build()?` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alnusjaponica
marked this pull request as ready for review
November 4, 2026 10:06
Alnusjaponica
marked this pull request as draft
November 6, 2026 05:33
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. As withthread::Builder::new(),XxxBuilder::new()is the only entry point (consistent withPedAnovaBuilderin #262).Changes
InMemoryStorageBuilder(withDefault),SQLite3StorageBuilder, andJournalStorageBuilder, exposingnew(), chainable setters (apply_discard,attr_format), andbuild()InMemoryStorageOptions,SQLite3StorageOptions,JournalStorageOptionsandnew_with_option/new_with_optionsnewonInMemoryStorage/SQLite3Storage/JournalStoragewith the existing signatures; it now delegates to the buildersToRustStorage's cache) to construct storages through the builderscache.rsthat referenced the removed options structsVerification
cargo test --locked --all-features— all pass (including new doctests)cargo test --locked -- --ignored(fromrustuna_storage, with Optuna installed) — 6 passcargo clippy --locked --workspace --lib --bins --tests --examples --all-features -- -D warnings— cleancargo fmt --all -- --check— cleanuv run --no-sync pytest tests/— 706 passed, 16 skipped🤖 Generated with Claude Code