MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / delete_ratio_and_compaction

Function delete_ratio_and_compaction

nodedb-columnar/src/delete_bitmap.rs:183–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181
182 #[test]
183 fn delete_ratio_and_compaction() {
184 let mut bm = DeleteBitmap::new();
185 for i in 0..30 {
186 bm.mark_deleted(i);
187 }
188 // 30 deleted out of 100 total = 0.3
189 assert!((bm.delete_ratio(100) - 0.3).abs() < 0.001);
190 // Default threshold 0.2 → should compact.
191 assert!(bm.should_compact(100, 0.2));
192 // Threshold 0.5 → should not compact.
193 assert!(!bm.should_compact(100, 0.5));
194 }
195
196 #[test]
197 fn block_fully_deleted() {

Callers

nothing calls this directly

Calls 1

mark_deletedMethod · 0.45

Tested by

no test coverage detected