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

Function encode_timestamps

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

Encode a slice of i64 timestamps using Gorilla (value channel unused). For timestamps, prefer `DoubleDelta` codec — it compresses ~4x better. This function exists for backward compatibility with V1 segments.

(timestamps: &[i64])

Source from the content-addressed store, hash-verified

339/// For timestamps, prefer `DoubleDelta` codec — it compresses ~4x better.
340/// This function exists for backward compatibility with V1 segments.
341pub fn encode_timestamps(timestamps: &[i64]) -> Vec<u8> {
342 let mut enc = GorillaEncoder::new();
343 for &ts in timestamps {
344 enc.encode(ts, 0.0);
345 }
346 enc.finish()
347}
348
349/// Decode Gorilla-encoded timestamps.
350pub fn decode_timestamps(data: &[u8]) -> Result<Vec<i64>, CodecError> {

Callers 3

encode_i64_pipelineFunction · 0.85
encode_timestamps_colFunction · 0.85

Calls 2

encodeMethod · 0.45
finishMethod · 0.45

Tested by 1