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

Function batch_get_and_put

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

Source from the content-addressed store, hash-verified

460
461 #[test]
462 fn batch_get_and_put() {
463 let mut e = make_engine();
464 let n = now();
465
466 let entries: Vec<(Vec<u8>, Vec<u8>)> = (0..5u8).map(|i| (vec![i], vec![i * 10])).collect();
467 let new_count = e.batch_put(1, "c", &entries, 0, n);
468 assert_eq!(new_count, 5);
469
470 let keys: Vec<Vec<u8>> = (0..7u8).map(|i| vec![i]).collect();
471 let results = e.batch_get(1, "c", &keys, n);
472 assert_eq!(results.len(), 7);
473 assert_eq!(results[0], Some(vec![0]));
474 assert_eq!(results[4], Some(vec![40]));
475 assert!(results[5].is_none()); // Key 5 doesn't exist.
476 assert!(results[6].is_none());
477 }
478
479 #[test]
480 fn tenant_isolation() {

Callers

nothing calls this directly

Calls 5

nowFunction · 0.85
collectMethod · 0.80
batch_getMethod · 0.80
make_engineFunction · 0.70
batch_putMethod · 0.45

Tested by

no test coverage detected