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

Function cas_success

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

Source from the content-addressed store, hash-verified

581
582 #[test]
583 fn cas_success() {
584 let mut engine = make_engine();
585 engine.put(1, "state", b"p1", b"idle", 0, 1000, Surrogate::ZERO);
586 let result = engine.cas(1, "state", b"p1", b"idle", b"in_match", 1000);
587 assert!(result.success);
588 assert_eq!(result.current_value.as_deref(), Some(b"idle".as_slice()));
589 let val = engine.get(1, "state", b"p1", 1000);
590 assert_eq!(val.as_deref(), Some(b"in_match".as_slice()));
591 }
592
593 #[test]
594 fn cas_failure() {

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