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])
| 339 | /// For timestamps, prefer `DoubleDelta` codec — it compresses ~4x better. |
| 340 | /// This function exists for backward compatibility with V1 segments. |
| 341 | pub 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. |
| 350 | pub fn decode_timestamps(data: &[u8]) -> Result<Vec<i64>, CodecError> { |