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

Function cas_failure

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

Source from the content-addressed store, hash-verified

592
593 #[test]
594 fn cas_failure() {
595 let mut engine = make_engine();
596 engine.put(1, "state", b"p1", b"fighting", 0, 1000, Surrogate::ZERO);
597 let result = engine.cas(1, "state", b"p1", b"idle", b"in_match", 1000);
598 assert!(!result.success);
599 assert_eq!(
600 result.current_value.as_deref(),
601 Some(b"fighting".as_slice())
602 );
603 // Value unchanged.
604 let val = engine.get(1, "state", b"p1", 1000);
605 assert_eq!(val.as_deref(), Some(b"fighting".as_slice()));
606 }
607
608 #[test]
609 fn getset_new_key() {

Callers

nothing calls this directly

Calls 4

casMethod · 0.80
make_engineFunction · 0.70
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected