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

Function block_count

nodedb-codec/src/fastlanes/mod.rs:161–169  ·  view source on GitHub ↗

Number of blocks in an encoded FastLanes stream.

(data: &[u8])

Source from the content-addressed store, hash-verified

159
160/// Number of blocks in an encoded FastLanes stream.
161pub fn block_count(data: &[u8]) -> Result<usize, CodecError> {
162 if data.len() < GLOBAL_HEADER_SIZE {
163 return Err(CodecError::Truncated {
164 expected: GLOBAL_HEADER_SIZE,
165 actual: data.len(),
166 });
167 }
168 Ok(u16::from_le_bytes([data[4], data[5]]) as usize)
169}
170
171/// Decode a single block by index without decoding the entire stream.
172///

Callers 2

random_access_blockFunction · 0.85
custom_block_sizeFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by 2

random_access_blockFunction · 0.68
custom_block_sizeFunction · 0.68