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

Function decode_f64

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

Decode Gorilla-compressed f64 values (encoded with `encode_f64`).

(data: &[u8])

Source from the content-addressed store, hash-verified

323
324/// Decode Gorilla-compressed f64 values (encoded with `encode_f64`).
325pub fn decode_f64(data: &[u8]) -> Result<Vec<f64>, CodecError> {
326 let mut dec = GorillaDecoder::new(data);
327 let samples = dec.decode_all();
328 if samples.len() != dec.total as usize {
329 return Err(CodecError::Truncated {
330 expected: dec.total as usize,
331 actual: samples.len(),
332 });
333 }
334 Ok(samples.into_iter().map(|(_, v)| v).collect())
335}
336
337/// Encode a slice of i64 timestamps using Gorilla (value channel unused).
338///

Callers 1

f64_batch_roundtripFunction · 0.70

Calls 3

collectMethod · 0.80
decode_allMethod · 0.45
lenMethod · 0.45

Tested by 1

f64_batch_roundtripFunction · 0.56