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

Function index_cleaned_on_delete

nodedb/src/engine/kv/engine.rs:598–626  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

596
597 #[test]
598 fn index_cleaned_on_delete() {
599 let mut e = make_engine();
600 let n = now();
601
602 e.register_index(1, "c", "region", 0, false, n);
603 e.put(
604 1,
605 "c",
606 b"k1",
607 &mp_obj(&[("region", "us")]),
608 0,
609 n,
610 Surrogate::ZERO,
611 );
612 e.put(
613 1,
614 "c",
615 b"k2",
616 &mp_obj(&[("region", "us")]),
617 0,
618 n,
619 Surrogate::ZERO,
620 );
621
622 assert_eq!(e.index_lookup_eq(1, "c", "region", b"us").len(), 2);
623
624 e.delete(1, "c", &[b"k1".to_vec()], n);
625 assert_eq!(e.index_lookup_eq(1, "c", "region", b"us").len(), 1);
626 }
627
628 #[test]
629 fn zero_index_fast_path() {

Callers

nothing calls this directly

Calls 7

nowFunction · 0.85
mp_objFunction · 0.85
register_indexMethod · 0.80
make_engineFunction · 0.70
putMethod · 0.45
deleteMethod · 0.45
to_vecMethod · 0.45

Tested by

no test coverage detected