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

Function read_entry_count

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

Read the entry count from the trailer (second-to-last field before magic).

(buf: &[u8])

Source from the content-addressed store, hash-verified

80
81/// Read the entry count from the trailer (second-to-last field before magic).
82fn read_entry_count(buf: &[u8]) -> Option<u16> {
83 if buf.len() < TRAILER_SIZE {
84 return None;
85 }
86 let count_start = buf.len() - TRAILER_SIZE;
87 let bytes = buf.get(count_start..count_start + 2)?;
88 Some(u16::from_le_bytes([bytes[0], bytes[1]]))
89}
90
91/// Binary search the sorted sidecar entries (in raw byte buffer) for `target` hash.
92///

Callers 3

sidecar_msgpack_lenFunction · 0.85
sidecar_lookupFunction · 0.85
field_index_from_sidecarFunction · 0.85

Calls 2

lenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected