Struct redis_zset_ts::TimeSeries
source · pub struct TimeSeries<T> { /* private fields */ }Expand description
Connection to a Redis Time Series
Implementations§
source§impl<T> TimeSeries<T>
impl<T> TimeSeries<T>
sourcepub fn new(namespace: &str, name: &str) -> Result<Self>
pub fn new(namespace: &str, name: &str) -> Result<Self>
Creates a new connection to the named time series.
sourcepub fn with_host(host: &str, namespace: &str, name: &str) -> Result<Self>
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.
sourcepub fn with_uri(uri: &str, namespace: &str, name: &str) -> Result<Self>
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.
sourcepub fn purge(&mut self, ts: f64) -> Result<()>
pub fn purge(&mut self, ts: f64) -> Result<()>
Deletes all the values in the time series before the specified time stamp.
sourcepub fn purge_time(&mut self, ts: SystemTime) -> Result<()>
pub fn purge_time(&mut self, ts: SystemTime) -> Result<()>
Deletes all the values in the time series before the specified time.
sourcepub fn purge_duration(&mut self, dur: Duration) -> Result<()>
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§impl<T: Serialize> TimeSeries<T>
impl<T: Serialize> TimeSeries<T>
sourcepub fn add_now(&mut self, val: T) -> Result<()>
pub fn add_now(&mut self, val: T) -> Result<()>
Adds a point to the time series, using the current time as the timestamp.
sourcepub fn add_value<V>(&mut self, val: V) -> Result<()>where
V: Into<TimeValue<T>>,
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.
sourcepub fn add_multiple(&mut self, vals: &[TimeValue<T>]) -> Result<()>
pub fn add_multiple(&mut self, vals: &[TimeValue<T>]) -> Result<()>
Adds multiple points to the time series.
sourcepub fn add_multiple_values(&mut self, vals: &[(f64, T)]) -> Result<()>
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>
impl<T: DeserializeOwned> TimeSeries<T>
sourcepub fn get_range_any<R, RR>(
&mut self,
ts1: R,
ts2: RR
) -> Result<Vec<TimeValue<T>>>where
R: ToRedisArgs,
RR: ToRedisArgs,
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.
sourcepub fn get_range(&mut self, ts1: f64, ts2: f64) -> Result<Vec<TimeValue<T>>>
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.
sourcepub fn get_time_range(
&mut self,
ts1: SystemTime,
ts2: SystemTime
) -> Result<Vec<TimeValue<T>>>
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.
sourcepub fn get_range_from(&mut self, ts: f64) -> Result<Vec<TimeValue<T>>>
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.