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

Function write_amp_ratio

nodedb/src/engine/kv/index.rs:608–619  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

606
607 #[test]
608 fn write_amp_ratio() {
609 let mut set = KvIndexSet::new();
610 set.add_index("a", 0);
611 set.add_index("b", 1);
612
613 for i in 0..10 {
614 let k = format!("k{i}");
615 set.on_put(k.as_bytes(), &[("a", b"x"), ("b", b"y")], None);
616 }
617 // 10 PUTs, 2 index writes each = 20 index writes.
618 assert!((set.write_amp_ratio() - 2.0).abs() < f64::EPSILON);
619 }
620
621 #[test]
622 fn unindexed_field_ignored() {

Callers

nothing calls this directly

Calls 3

add_indexMethod · 0.45
on_putMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected