Supply Chain Integrity, Transparency, and Trust (IETF SCITT)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Replace Stdlib.Mutex lock/unlock with Eio.Mutex.use_rw

Convert remaining bare Mutex.lock/unlock patterns to
Eio.Mutex.use_rw/use_ro in cookeio, requests, oci, and space.
Fix unattached doc comment in vds.ml Node_cache.

+6 -11
+6 -11
lib/vds.ml
··· 95 95 end 96 96 end 97 97 98 - (** Internal node cache. In an append-only tree, compute_root(offset, len) is 99 - immutable once all [len] leaves at [offset] exist. Cache hits make 100 - inclusion_path O(log n) instead of O(n). *) 101 - (** Internal node cache with bounded size. 98 + (* Internal node cache with bounded size. 102 99 103 - In an append-only tree, subtree hashes are immutable once computed. The 104 - cache maps [(offset, length)] to the subtree root hash. On overflow, only 105 - power-of-2-length entries are kept — these are "complete" subtrees that are 106 - maximally reused and cheapest to lose (they'd be recomputed in O(1) from 107 - two cached children). *) 100 + In an append-only tree, subtree hashes are immutable once computed. The 101 + cache maps (offset, length) to the subtree root hash. On overflow, only 102 + power-of-2-length entries are kept — these are "complete" subtrees that are 103 + maximally reused and cheapest to lose (they'd be recomputed in O(1) from 104 + two cached children). *) 108 105 module Node_cache = struct 109 106 let default_max_entries = 100_000 110 107 ··· 259 256 } 260 257 261 258 let with_lock t f = Eio.Mutex.use_rw ~protect:true t.mu f 262 - 263 259 let algorithm_id t = Hash.id t.hash 264 260 let proof_format _ = Hash.Rfc9162 265 261 let size t = with_lock t (fun () -> Growable.length t.hashes) ··· 340 336 } 341 337 342 338 let with_lock t f = Eio.Mutex.use_rw ~protect:true t.mu f 343 - 344 339 let algorithm_id t = Hash.id t.hash 345 340 let proof_format _ = Hash.Rfc9162 346 341 let size t = with_lock t (fun () -> t.entry_count)