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

Function verify_entry

nodedb-query/src/msgpack_scan/sidecar.rs:120–125  ·  view source on GitHub ↗

Verify that sidecar entry `i` actually corresponds to `field` by scanning the msgpack map. This is the hash-collision resolution path — only invoked when a hash matches, so the amortised cost is near-zero.

(msgpack: &[u8], value_offset: usize, value_len: usize, field: &str)

Source from the content-addressed store, hash-verified

118/// the msgpack map. This is the hash-collision resolution path — only invoked
119/// when a hash matches, so the amortised cost is near-zero.
120fn verify_entry(msgpack: &[u8], value_offset: usize, value_len: usize, field: &str) -> bool {
121 match crate::msgpack_scan::field::extract_field(msgpack, 0, field) {
122 Some((start, end)) => start == value_offset && (end - start) == value_len,
123 None => false,
124 }
125}
126
127/// Build a sidecar-indexed document from raw msgpack bytes.
128///

Callers 2

sidecar_lookupFunction · 0.85
getMethod · 0.85

Calls 1

extract_fieldFunction · 0.85

Tested by

no test coverage detected