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

Function getset_existing_key

nodedb/src/engine/kv/engine_atomic.rs:618–625  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

616
617 #[test]
618 fn getset_existing_key() {
619 let mut engine = make_engine();
620 engine.put(1, "session", b"tok", b"old-token", 0, 1000, Surrogate::ZERO);
621 let old = engine.getset(1, "session", b"tok", b"new-token", 1000);
622 assert_eq!(old.as_deref(), Some(b"old-token".as_slice()));
623 let val = engine.get(1, "session", b"tok", 1000);
624 assert_eq!(val.as_deref(), Some(b"new-token".as_slice()));
625 }
626}

Callers

nothing calls this directly

Calls 4

getsetMethod · 0.80
make_engineFunction · 0.70
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected