[Storage] Make mutating contiguous journal methods &mut#3570
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
commonware-mcp | 376d5d6 | May 08 2026, 01:44 PM |
Deploying monorepo with
|
| Latest commit: |
376d5d6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://20072431.monorepo-eu0.pages.dev |
| Branch Preview URL: | https://danlaine-contiguous-2.monorepo-eu0.pages.dev |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5cacf40. Configure here.
377e7c1 to
c0e3b70
Compare
Benchmark resultsTip ✅ PASSED: No benchmark exceeded the regression threshold. Benchmark comparison table
Baseline commit(s): |
12c60ae to
77c6202
Compare
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #3570 +/- ##
==========================================
- Coverage 95.81% 95.81% -0.01%
==========================================
Files 466 466
Lines 185899 185720 -179
Branches 4443 4442 -1
==========================================
- Hits 178119 177939 -180
- Misses 6356 6358 +2
+ Partials 1424 1423 -1
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|

Motivation
The contiguous journal types (
fixed::Journal,variable::Journal) and their consumers (merkle::Journaled,Metadata,Queue,qmdb::store::Db, etc.) previously used interior mutability (UpgradableAsyncRwLock,RwLock,AsyncMutex) to allow mutating methods likeappend,sync,prune, andrewindto take&self. This added locking overhead on every operation and obscured the actual mutability requirements at the type level.This PR removes the interior-mutability wrappers and changes all mutating methods to take
&mut selfinstead, letting the borrow checker enforce exclusive access statically.Changes
Persistabletrait (storage/src/lib.rs)commitandsyncnow require&mut self.fixed::JournalInnerstruct andUpgradableAsyncRwLockwrapper. Fields (journal,size,metadata,pruning_boundary,items_per_blob) are now directly onJournal.append,append_many,sync,rewind,prune,clear_to_sizenow take&mut self.sizeandpruning_boundaryare nowconst fn(no lock acquisition, no async).read,bounds, andreplayare promoted from test/reader-only helpers to public methods onJournaldirectly.Readertype becomes a thin borrowed wrapper (&Journal) instead of holding a lock guard. It still implements theReadertrait for use via theContiguoustrait.append_many(for syncing full sections mid-append) is replaced by direct&mut selfcalls.position_to_sectionhelper (inlined).variable::JournalParallel changes to
fixed::Journal: removedInner/UpgradableAsyncRwLock, flattened fields ontoJournal, changed mutating methods to&mut self, madesizesynchronous.merkle::JournaledInnerstruct andRwLockwrapper.memandpruned_to_posare now direct fields.sync_lock: AsyncMutex(no longer needed sincesynctakes&mut self).sync,prune, and related methods take&mut self.rootis nowconst fn.self.inner.read().mem/self.inner.get_mut().memaccesses becomeself.mem.MetadataAsyncMutexaroundState.stateis now a direct field.synctakes&mut self.&mut self.stateinstead ofself.state.get_mut().Queueack,ack_up_to,size,is_emptyare no longer async (they were only async because of the lock).shared::Readerandshared::Writerwrappers accordingly.qmdb::store::Dbcommit,sync,prunetake&mut self.boundsandsizeare nowconst fn(synchronous).journal::authenticatedcommitandsynctake&mut self.synccan no longer usetry_join!to sync journal and merkle concurrently (since both require&mut self), so they are now sequential.