27 stable releases

1.17.0 Oct 21, 2025
1.16.0 Jul 31, 2025
1.14.0 Feb 25, 2025
1.13.0 Dec 4, 2024
1.7.3 Nov 8, 2023

#709 in Database interfaces

Download history 38/week @ 2025-07-09 57/week @ 2025-07-16 61/week @ 2025-07-23 288/week @ 2025-07-30 128/week @ 2025-08-06 69/week @ 2025-08-13 305/week @ 2025-08-20 201/week @ 2025-08-27 114/week @ 2025-09-03 99/week @ 2025-09-10 148/week @ 2025-09-17 220/week @ 2025-09-24 129/week @ 2025-10-01 73/week @ 2025-10-08 303/week @ 2025-10-15 136/week @ 2025-10-22

651 downloads per month
Used in 4 crates (2 directly)

MPL-2.0 license

125KB
3K SLoC

ReductStore Client SDK for Rust

Crates.io Docs.rs GitHub Workflow Status

This package provides an HTTP client for interacting with the ReductStore, time-series database for unstructured data.

Features

Example

use futures_util::stream::StreamExt;
use reduct_rs::{QuotaType, ReductClient, ReductError};
use serde_json::json;
use std::pin::pin;
use std::time::{Duration, SystemTime};
use tokio;

#[tokio::main]
async fn main() -> Result<(), ReductError> {
    // 1. Create a ReductStore client
    let client = ReductClient::builder()
        .url("http://127.0.0.1:8383")
        .api_token("my-token")
        .build();

    // 2. Get or create a bucket with 1Gb quota
    let bucket = client
        .create_bucket("my-bucket")
        .quota_type(QuotaType::FIFO)
        .quota_size(1_000_000_000)
        .exist_ok(true)
        .send()
        .await?;

    // 3. Write some data with timestamps and labels to the 'entry-1' entry
    let start = SystemTime::now();
    bucket
        .write_record("sensor-1")
        .data("<Blob data>")
        .timestamp(start)
        .add_label("score", 10)
        .send()
        .await?;

    bucket
        .write_record("sensor-1")
        .data("<Blob data>")
        .timestamp(start + Duration::from_secs(1))
        .add_label("score", 20)
        .send()
        .await?;

    // 4. Query the data by time range and condition
    let query = bucket
        .query("sensor-1")
        .start(start)
        .stop(start + Duration::from_secs(2))
        .when(json!({"&score": {"$gt": 15}}))
        .send()
        .await?;

    let mut query = pin!(query);
    while let Some(record) = query.next().await {
        let record = record?;
        println!("Record timestamp: {:?}", record.timestamp());
        println!("Record size: {}", record.content_length());
        println!("{:?}", record.bytes().await?);
    }

    // 5. Exit
    Ok(())
}

For more examples, see the Guides section in the ReductStore documentation.

Supported ReductStore Versions and Backward Compatibility

The library is backward compatible with the previous versions. However, some methods have been deprecated and will be removed in the future releases. Please refer to the Changelog for more details. The SDK supports the following ReductStore API versions:

  • v1.17
  • v1.16
  • v1.15

It can work with newer and older versions, but it is not guaranteed that all features will work as expected because the API may change and some features may be deprecated or the SDK may not support them yet.

Dependencies

~10–25MB
~325K SLoC