irox_stats::tsdf

Struct CodedTimeSeriesWriter

Source
pub struct CodedTimeSeriesWriter { /* private fields */ }
Available on crate features std and miniz only.
Expand description

Coded Time Series Sample File consists of 2 streams: a data stream and a time stream backed by a MultiStreamWriter

Data stream:

  1. Convert f64 to u64 bit-for-bit
  2. Run it through a irox_tools::codec::CodeDictionary to map the observed values into unique u32 codes
  3. Group those codes into blocks of 4 using GroupCodingStream and then encode into Varint-GB using GroupVarintCodeEncoder
  4. Deflate/GZ the resultant byte stream.

It is assumed that the data stream samples come from something approximating a A2D sensor with a fixed number of detection bits and as such, most of the data will be fairly similar, even if very noisy when it jumps around.

Time stream: 0. Convert the time value into a u64 (external)

  1. Run it through a DeltaStream to encode the first value, and then output the N-1 difference
  2. Run it through the same 2, 3, 4 processing as the data stream.

It is assumed that the time series will be periodically sampled and atomically increasing

Implementations§

Source§

impl CodedTimeSeriesWriter

Source

pub fn new<T: AsRef<Path>>(path: T) -> Result<Self, Error>

Source

pub fn write_sample(&mut self, sample: &Sample64) -> Result<(), Error>

Source

pub fn flush(&mut self) -> Result<(), Error>

Source

pub fn written_stats(&self) -> Vec<String>

Source

pub fn metadata<K: AsRef<str>, V: AsRef<str>>( &mut self, key: K, value: V, ) -> Result<(), Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> MaybeInto<U> for T
where U: MaybeFrom<T>,

Source§

fn maybe_into(self) -> Option<U>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.