Conversation
Fraser999
reviewed
Mar 25, 2026
docs/superpowers/specs/2026-03-24-cold-storage-mut-writes-design.md
Outdated
Show resolved
Hide resolved
593e0dd to
6151ead
Compare
Member
Author
|
[Claude Code] Reworked based on your review feedback:
Ready for another look. |
…rite (ENG-1979) Split the ColdStorage trait into three: - ColdStorageRead: Clone + Send + Sync, all &self read methods - ColdStorageWrite: Send, &mut self write methods (append_block, append_blocks, truncate_above) - ColdStorage: supertrait combining both, provides drain_above with a default implementation Eliminate RwLock from the task runner. The runner now holds an owned write backend (exclusively for writes) and a cloned read backend (shared via Arc for spawned read tasks). Read tasks cannot call write methods at the type level. Add drain_above override to EitherCold to dispatch to inner backend's atomic implementation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6151ead to
0c65a12
Compare
Fraser999
approved these changes
Mar 25, 2026
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
Split
ColdStorageinto three traits for compile-time read/write separation:ColdStorageRead:Clone + Send + Sync, all&selfread methods — cloneable, shareable across tasksColdStorageWrite:Send,&mut selfwrite methods (append_block,append_blocks,truncate_above) — exclusively ownedColdStorage: supertrait combining both, providesdrain_abovewith default implementationEliminate
RwLockfrom the task runner. The runner now holds:Arcfor spawned read tasks)Read tasks literally cannot call write methods at the type level.
Also adds
drain_aboveoverride toEitherColdto dispatch to inner backend's atomic implementation (was using the non-atomic default).Closes ENG-1979
Test plan
cargo clippyclean on all 4 affected crates with both--all-featuresand--no-default-featuresmem_backend_conformancepassesmdbx_backend_conformancepassesdrain_above_*)./scripts/test-postgres.sh(requires Postgres)🤖 Generated with Claude Code