Struct rustis::commands::TsCreateOptions

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

Options for the ts_add command.

Implementations§

source§

impl TsCreateOptions

source

pub fn retention(self, retention_period: u64) -> Self

maximum age for samples compared to the highest reported timestamp, in milliseconds.

Samples are expired based solely on the difference between their timestamp and the timestamps passed to subsequent ts_add, ts_madd, ts_incrby, and ts_decrby calls.

When set to 0, samples never expire. When not specified, the option is set to the global RETENTION_POLICY configuration of the database, which by default is 0.

source

pub fn encoding(self, encoding: TsEncoding) -> Self

specifies the series sample’s encoding format.

source

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

initial allocation size, in bytes, for the data part of each new chunk. Actual chunks may consume more memory.

Changing chunkSize (using ts_alter) does not affect existing chunks.

Must be a multiple of 8 in the range [48 .. 1048576]. When not specified, it is set to 4096 bytes (a single memory page).

Note: Before v1.6.10 no minimum was enforced. Between v1.6.10 and v1.6.17 and in v1.8.0 the minimum value was 128. Since v1.8.1 the minimum value is 48.

The data in each key is stored in chunks. Each chunk contains header and data for a given timeframe. An index contains all chunks. Iterations occur inside each chunk. Depending on your use case, consider these tradeoffs for having smaller or larger sizes of chunks:

  • Insert performance: Smaller chunks result in slower inserts (more chunks need to be created).
  • Query performance: Queries for a small subset when the chunks are very large are slower, as we need to iterate over the chunk to find the data.
  • Larger chunks may take more memory when you have a very large number of keys and very few samples per key, or less memory when you have many samples per key.

If you are unsure about your use case, select the default.

source

pub fn duplicate_policy(self, policy: TsDuplicatePolicy) -> Self

policy for handling insertion (ts_add and ts_madd) of multiple samples with identical timestamps

source

pub fn labels<L: SingleArg, V: SingleArg, LL: KeyValueArgsCollection<L, V>>( self, labels: LL ) -> Self

set of label-value pairs that represent metadata labels of the time series.

Use it only if you are creating a new time series. It is ignored if you are adding samples to an existing time series. See labels.

The ts_mget, ts_mrange, and ts_mrevrange commands operate on multiple time series based on their labels. The ts_queryindex command returns all time series keys matching a given filter based on their labels.

Trait Implementations§

source§

impl Default for TsCreateOptions

source§

fn default() -> TsCreateOptions

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

impl ToArgs for TsCreateOptions

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,