pub struct DeltaEncoding;Expand description
Delta encoding with varint compression and periodic checkpoints.
Encoding format:
- Checkpoint points stored every N entries (default: 1000)
- Each checkpoint: 8-byte absolute timestamp
- Between checkpoints: varint-encoded deltas
Characteristics:
- Variable-length encoding (1-9 bytes per delta)
- Space-efficient for regular intervals
- Requires checkpoint lookup for range queries
Best for:
- Dense, regular-interval data (e.g., 1-second
IoTsensors) - Storage-constrained environments
- Sequential scan workloads
Not recommended for:
- Sparse, irregular data
- Heavy random access patterns
Implementations§
Source§impl DeltaEncoding
impl DeltaEncoding
Sourcepub fn encode_varint(value: u64, buf: &mut Vec<u8>)
pub fn encode_varint(value: u64, buf: &mut Vec<u8>)
Encodes a delta using unsigned varint encoding.
Sourcepub fn decode_varint(bytes: &[u8]) -> Result<(u64, usize), EncodingError>
pub fn decode_varint(bytes: &[u8]) -> Result<(u64, usize), EncodingError>
Decodes a varint from bytes, returning (value, bytes_consumed).
Trait Implementations§
Source§impl Clone for DeltaEncoding
impl Clone for DeltaEncoding
Source§fn clone(&self) -> DeltaEncoding
fn clone(&self) -> DeltaEncoding
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeltaEncoding
impl Debug for DeltaEncoding
Source§impl TimestampEncoding for DeltaEncoding
impl TimestampEncoding for DeltaEncoding
Source§fn encode(timestamp: u64) -> Vec<u8> ⓘ
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>
fn decode(bytes: &[u8]) -> Result<u64, EncodingError>
Decodes a timestamp from its byte representation.
Source§fn supports_random_access() -> bool
fn supports_random_access() -> bool
Returns true if this encoding supports direct seeking to arbitrary timestamps.
impl Copy for DeltaEncoding
Auto Trait Implementations§
impl Freeze for DeltaEncoding
impl RefUnwindSafe for DeltaEncoding
impl Send for DeltaEncoding
impl Sync for DeltaEncoding
impl Unpin for DeltaEncoding
impl UnwindSafe for DeltaEncoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more