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

Function decode_timestamps

nodedb-codec/src/gorilla.rs:350–360  ·  view source on GitHub ↗

Decode Gorilla-encoded timestamps.

(data: &[u8])

Source from the content-addressed store, hash-verified

348
349/// Decode Gorilla-encoded timestamps.
350pub fn decode_timestamps(data: &[u8]) -> Result<Vec<i64>, CodecError> {
351 let mut dec = GorillaDecoder::new(data);
352 let samples = dec.decode_all();
353 if samples.len() != dec.total as usize {
354 return Err(CodecError::Truncated {
355 expected: dec.total as usize,
356 actual: samples.len(),
357 });
358 }
359 Ok(samples.into_iter().map(|(ts, _)| ts).collect())
360}
361
362#[cfg(test)]
363mod tests {

Callers 3

decode_i64_pipelineFunction · 0.85
decode_timestamps_colFunction · 0.85

Calls 3

collectMethod · 0.80
decode_allMethod · 0.45
lenMethod · 0.45

Tested by 1