Struct rustis::commands::TsRangeOptions

source ·
pub struct TsRangeOptions { /* private fields */ }
Available on crate feature redis-time-series only.
Expand description

Options for the ts_range and ts_revrange commands.

Implementations§

source§

impl TsRangeOptions

source

pub fn latest(self) -> Self

Used when a time series is a compaction.

With latest, ts_range also reports the compacted value of the latest possibly partial bucket, given that this bucket’s start time falls within [from_timestamp, to_timestamp]. Without latest, ts_range does not report the latest possibly partial bucket. When a time series is not a compaction, latest is ignored.

The data in the latest bucket of a compaction is possibly partial. A bucket is closed and compacted only upon arrival of a new sample that opens a new latest bucket. There are cases, however, when the compacted value of the latest possibly partial bucket is also required. In such a case, use latest.

source

pub fn filter_by_ts(self, ts: impl SingleArgCollection<u64>) -> Self

filters samples by a list of specific timestamps.

A sample passes the filter if its exact timestamp is specified and falls within [from_timestamp, to_timestamp].

source

pub fn filter_by_value(self, min: f64, max: f64) -> Self

filters samples by minimum and maximum values.

source

pub fn count(self, count: usize) -> Self

limits the number of returned samples.

source

pub fn align(self, align: impl SingleArg) -> Self

A time bucket alignment control for aggregation.

It controls the time bucket timestamps by changing the reference timestamp on which a bucket is defined.

Values include:

  • start or -: The reference timestamp will be the query start interval time (from_timestamp) which can’t be -
  • end or +: The reference timestamp will be the query end interval time (to_timestamp) which can’t be +
  • A specific timestamp: align the reference timestamp to a specific time
§Note

When not provided, alignment is set to 0.

source

pub fn aggregation( self, aggregator: TsAggregationType, bucket_duration: u64 ) -> Self

Aggregates results into time buckets, where:

  • aggregator - takes a value of TsAggregationType
  • bucket_duration - is duration of each bucket, in milliseconds.

Without align, bucket start times are multiples of bucket_duration.

With align, bucket start times are multiples of bucket_duration with remainder align % bucket_duration.

The first bucket start time is less than or equal to from_timestamp.

source

pub fn bucket_timestamp(self, bucket_timestamp: u64) -> Self

controls how bucket timestamps are reported. bucket_timestamp values include:

  • - or low - Timestamp reported for each bucket is the bucket’s start time (default)
  • + or high - Timestamp reported for each bucket is the bucket’s end time
  • ~ or mid - Timestamp reported for each bucket is the bucket’s mid time (rounded down if not an integer)
source

pub fn empty(self) -> Self

A flag, which, when specified, reports aggregations also for empty buckets. when aggregator values are:

  • sum, count - the value reported for each empty bucket is 0
  • last - the value reported for each empty bucket is the value of the last sample before the bucket’s start. NaN when no such sample.
  • twa - the value reported for each empty bucket is the average value over the bucket’s timeframe based on linear interpolation of the last sample before the bucket’s start and the first sample after the bucket’s end. NaN when no such samples.
  • min, max, range, avg, first, std.p, std.s - the value reported for each empty bucket is NaN

Regardless of the values of from_timestamp and to_timestamp, no data is reported for buckets that end before the earliest sample or begin after the latest sample in the time series.

Trait Implementations§

source§

impl Default for TsRangeOptions

source§

fn default() -> TsRangeOptions

Returns the “default value” for a type. Read more
source§

impl ToArgs for TsRangeOptions

source§

fn write_args(&self, args: &mut CommandArgs)

Write this Rust type as one ore multiple args into CommandArgs. Read more
source§

fn num_args(&self) -> usize

Number arguments generated by this Rust type

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> 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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> MultipleArgsCollection<T> for T
where T: ToArgs,