pub struct TimeSeries<T> { /* private fields */ }
Expand description

Connection to a Redis Time Series

Implementations§

source§

impl<T> TimeSeries<T>

source

pub fn new(namespace: &str, name: &str) -> Result<Self>

Creates a new connection to the named time series.

source

pub fn with_host(host: &str, namespace: &str, name: &str) -> Result<Self>

Creates a new connection to the named time series on the specified host.

source

pub fn with_uri(uri: &str, namespace: &str, name: &str) -> Result<Self>

Creates a new connection to the named time series on the host with the specified URI.

source

pub fn purge(&mut self, ts: f64) -> Result<()>

Deletes all the values in the time series before the specified time stamp.

source

pub fn purge_time(&mut self, ts: SystemTime) -> Result<()>

Deletes all the values in the time series before the specified time.

source

pub fn purge_duration(&mut self, dur: Duration) -> Result<()>

Deletes all the values in the time series except points that fall in the most recent time specified by the duration.

source

pub fn delete(&mut self) -> Result<()>

Removes the entire timeseries from the Redis DB.

source§

impl<T: Serialize> TimeSeries<T>

source

pub fn add(&mut self, ts: f64, val: T) -> Result<()>

Adds a point to the time series.

source

pub fn add_now(&mut self, val: T) -> Result<()>

Adds a point to the time series, using the current time as the timestamp.

source

pub fn add_value<V>(&mut self, val: V) -> Result<()>
where V: Into<TimeValue<T>>,

Adds a point to the time series as a TimeValue.

source

pub fn add_multiple(&mut self, vals: &[TimeValue<T>]) -> Result<()>

Adds multiple points to the time series.

source

pub fn add_multiple_values(&mut self, vals: &[(f64, T)]) -> Result<()>

Adds multiple points to the time series from a slice of tuples.

source§

impl<T: DeserializeOwned> TimeSeries<T>

source

pub fn get_range_any<R, RR>( &mut self, ts1: R, ts2: RR ) -> Result<Vec<TimeValue<T>>>
where R: ToRedisArgs, RR: ToRedisArgs,

Gets values from a time range The timestamps can be the usual floating point values, or anything that can be conbverted to a Redis argument, such as special strings like “-inf”, “+inf”, or “2.0)” to indicate open ranges.

source

pub fn get_range(&mut self, ts1: f64, ts2: f64) -> Result<Vec<TimeValue<T>>>

Gets values from a time range This gets the values from ts1 up to, but not including, ts2.

source

pub fn get_time_range( &mut self, ts1: SystemTime, ts2: SystemTime ) -> Result<Vec<TimeValue<T>>>

Gets values from a time range This gets the values from ts1 up to, but not including, ts2.

source

pub fn get_range_from(&mut self, ts: f64) -> Result<Vec<TimeValue<T>>>

Gets values starting from the specified time up to the latest value.

source

pub fn get_all(&mut self) -> Result<Vec<TimeValue<T>>>

Gets all the values in the series. This should be used with caution if the series is large.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for TimeSeries<T>

§

impl<T> Send for TimeSeries<T>
where T: Send,

§

impl<T> Sync for TimeSeries<T>
where T: Sync,

§

impl<T> Unpin for TimeSeries<T>
where T: Unpin,

§

impl<T> !UnwindSafe for TimeSeries<T>

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> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.