Skip to content

Ar/psr 11 oncelock#1620

Merged
allanbrondum merged 12 commits intofeature/rust_block_statefrom
ar/psr-11-oncelock
Apr 21, 2026
Merged

Ar/psr 11 oncelock#1620
allanbrondum merged 12 commits intofeature/rust_block_statefrom
ar/psr-11-oncelock

Conversation

@allanbrondum
Copy link
Copy Markdown
Collaborator

@allanbrondum allanbrondum commented Apr 14, 2026

Purpose

Replace the usages of RwLock with OnceLock, that is a simpler and more lightweight synchronization primitive. Reading the value in a OnceLock e.g. has almost no overhead. And you can borrow the value (no guard needed like for RwLock).

Changes

  • Changed HashedCacheableRef to use OnceLock
  • Changed HashedCacheableRef::with_value to HashedCacheableRef::value that borrows the value
    from HashedCacheableRef is it is memory (no read closure needed).

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 96.87500% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.87%. Comparing base (4587fd4) to head (1858313).
⚠️ Report is 14 commits behind head on feature/rust_block_state.

Files with missing lines Patch % Lines
...state/blob_reference/hashed_cacheable_reference.rs 98.36% 2 Missing ⚠️
plt/plt-block-state/src/block_state/lfmb_tree.rs 93.54% 2 Missing ⚠️
...ate/src/block_state/state/protocol_level_tokens.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/rust_block_state    #1620      +/-   ##
============================================================
- Coverage                     63.88%   63.87%   -0.02%     
============================================================
  Files                           356      356              
  Lines                         71251    71196      -55     
  Branches                       3032     3032              
============================================================
- Hits                          45519    45474      -45     
+ Misses                        22700    22690      -10     
  Partials                       3032     3032              
Files with missing lines Coverage Δ
plt/plt-block-state/src/block_state/utils.rs 100.00% <ø> (ø)
...ate/src/block_state/state/protocol_level_tokens.rs 86.55% <85.71%> (-0.49%) ⬇️
...state/blob_reference/hashed_cacheable_reference.rs 98.02% <98.36%> (+4.33%) ⬆️
plt/plt-block-state/src/block_state/lfmb_tree.rs 92.25% <93.54%> (-0.33%) ⬇️

... and 3 files with indirect coverage changes

Base automatically changed from ar/psr-82-implement-benchmarks-of-rust-lfmb-tree to feature/rust_block_state April 21, 2026 06:36
@allanbrondum allanbrondum merged commit c310093 into feature/rust_block_state Apr 21, 2026
4 checks passed
@allanbrondum allanbrondum deleted the ar/psr-11-oncelock branch April 21, 2026 09:46
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.

2 participants