Skip to content

Make ReadOnlyDatabase available without std - #1640

Merged
cberner merged 1 commit into
masterfrom
claude/sweet-hypatia-m4vct7-read-only-no-std
Nov 9, 2026
Merged

cberner merged 1 commit into
masterfrom
claude/sweet-hypatia-m4vct7-read-only-no-std

Conversation

@cberner

@cberner cberner commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Without std, ReadOnlyDatabase and Builder::open_read_only_with_backend() were compiled out, but nothing in them needs std: they hold an Arc<TransactionalMemory> and a TransactionTracker, and wrap the backend in ReadOnlyBackend, which uses only alloc and core. This removes those cfg(not(redb_no_std)) gates, so a no_std user can open their storage read-only. Only ReadOnlyDatabase::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.
  • The no_std regression crate: writes a row, closes the database, reopens the same storage with open_read_only_with_backend(), and reads the row back. It uses a small Shared(Arc<InMemoryBackend>) backend so that the storage outlives the first Database. On master this fails to compile: no method open_read_only_with_backend on Builder.
  • README and CHANGELOG: the no_std notes no longer list ReadOnlyDatabase as 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 to open_read_only, FileBackend and File::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.
  • clippy --all --all-targets, with and without --all-features.
  • clippy for thumbv7em (no_std), with and without logging.
  • cargo check for wasm32-unknown-unknown (3 feature sets).
  • cargo doc.
  • cargo test --all-features, and cargo test with default features.
  • The no_std regression crate.

Generated by Claude Code

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T00:01:47.335274Z 34a4415 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cberner
cberner merged commit 1e92b55 into master Nov 9, 2026
5 checks passed
@cberner
cberner deleted the claude/sweet-hypatia-m4vct7-read-only-no-std branch November 9, 2026 00:44
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.

1 participant