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

Function assert_kv_absent

nodedb-test-support/src/tx_batch_helpers.rs:297–311  ·  view source on GitHub ↗

Assert that a KV key is absent (NotFound or empty payload).

(
    core: &mut CoreLoop,
    tx: &mut Producer<BridgeRequest>,
    rx: &mut Consumer<BridgeResponse>,
    key: &[u8],
)

Source from the content-addressed store, hash-verified

295
296/// Assert that a KV key is absent (NotFound or empty payload).
297pub fn assert_kv_absent(
298 core: &mut CoreLoop,
299 tx: &mut Producer<BridgeRequest>,
300 rx: &mut Consumer<BridgeResponse>,
301 key: &[u8],
302) {
303 let r = send_raw(core, tx, rx, kv_get(key));
304 let is_absent = r.status == Status::Error || r.payload.is_empty();
305 assert!(
306 is_absent,
307 "KV key {key:?} must be absent after rollback; status={:?} payload_len={}",
308 r.status,
309 r.payload.len()
310 );
311}
312
313/// Assert that a document is absent (NotFound or empty payload).
314pub fn assert_doc_absent(

Callers 2

Calls 3

send_rawFunction · 0.70
kv_getFunction · 0.70
is_emptyMethod · 0.45

Tested by 2