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

Function basic_get_put_delete

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

Source from the content-addressed store, hash-verified

395
396 #[test]
397 fn basic_get_put_delete() {
398 let mut e = make_engine();
399 let n = now();
400
401 assert!(e.get(1, "cache", b"k1", n).is_none());
402
403 e.put(1, "cache", b"k1", b"v1", 0, n, Surrogate::ZERO);
404 assert_eq!(e.get(1, "cache", b"k1", n).unwrap(), b"v1");
405
406 e.put(1, "cache", b"k1", b"v2", 0, n, Surrogate::ZERO);
407 assert_eq!(e.get(1, "cache", b"k1", n).unwrap(), b"v2");
408
409 assert_eq!(e.delete(1, "cache", &[b"k1".to_vec()], n), 1);
410 assert!(e.get(1, "cache", b"k1", n).is_none());
411 }
412
413 #[test]
414 fn ttl_expiry_via_tick() {

Callers

nothing calls this directly

Calls 3

nowFunction · 0.85
make_engineFunction · 0.70
putMethod · 0.45

Tested by

no test coverage detected