Repository navigation
Make ReadOnlyDatabase available without std - #1640
Merged
Merged
Conversation
ReadOnlyDatabase and Builder::open_read_only_with_backend() were compiled out without std, though nothing in them needs it. Only ReadOnlyDatabase::open(), which takes a path, still requires std. The no_std regression crate now also reopens its database read-only. Assisted-by: Claude Code Claude-Session: https://claude.ai/code/session_01ALhxet6NP69dCfAUv8TAhR
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Without std,
ReadOnlyDatabaseandBuilder::open_read_only_with_backend()were compiled out, but nothing in them needs std: they hold anArc<TransactionalMemory>and aTransactionTracker, and wrap the backend inReadOnlyBackend, which uses onlyallocandcore. This removes thosecfg(not(redb_no_std))gates, so a no_std user can open their storage read-only. OnlyReadOnlyDatabase::open(path)stays std-only, like every other method that opens a path.With std, nothing changes.
Changes:
src/: the gates are deleted, and no code changed.open_read_only_with_backend(), and reads the row back. It uses a smallShared(Arc<InMemoryBackend>)backend so that the storage outlives the firstDatabase. On master this fails to compile: no methodopen_read_only_with_backendonBuilder.ReadOnlyDatabaseas unavailable.Note: the no_std rustdoc build (not run in CI) now also compiles the docs of
open_read_only_with_backend(). Its std-specific paragraph links toopen_read_only,FileBackendandFile::try_clone, so that build's broken-link count goes from 22 to 25. They're the same kind as the existing ones.Checked:
cargo fmt.--all --all-targets, with and without--all-features.logging.cargo checkfor wasm32-unknown-unknown (3 feature sets).cargo doc.cargo test --all-features, andcargo testwith default features.Generated by Claude Code