TimestampEncoding

Trait TimestampEncoding 

Source
pub trait TimestampEncoding: Send + Sync {
    // Required methods
    fn encode(timestamp: u64) -> Vec<u8> ;
    fn decode(bytes: &[u8]) -> Result<u64, EncodingError>;
    fn supports_random_access() -> bool;
}
Expand description

Trait for encoding timestamps into sortable byte representations.

Different encoding strategies optimize for different use cases:

  • AbsoluteEncoding: Simple, fast, supports random access
  • DeltaEncoding: Space-efficient for dense regular-interval data

Required Methods§

Source

fn encode(timestamp: u64) -> Vec<u8>

Encodes a timestamp (milliseconds since epoch) into a sortable byte representation.

Source

fn decode(bytes: &[u8]) -> Result<u64, EncodingError>

Decodes a timestamp from its byte representation.

Source

fn supports_random_access() -> bool

Returns true if this encoding supports direct seeking to arbitrary timestamps.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§