How to integrate ReductStore into your C++ application

Dec 17, 2022. | By: Alexey Timin | Orginaly published at

This guide will help you get started with the ReductStore C++ SDK.


The ReductStore C++ SDK is written in C++20 and uses CMake as a build system. To install it, you will need:

  • C++ compiler with C++20 support (we use GCC-11.2)
  • cmake 3.18 or higher
  • conan 1.40 or higher (it is optional, but conan is a convenient package manager)

Currently, we have only tested the SDK on Linux AMD64, but if you need to port it to another operating system or platform, you can create an issue for assistance.


To install the ReductStore C++ SDK, follow these steps:

git clone
cd reduct-cpp
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
sudo cmake --build . --target install

Simple Application

Let’s create a simple C++ application that connects to the storage, creates a bucket, and writes and reads some data. We will need two files: CMakeLists.txt and

touch CMakeLists.txt

Here is the CMakeLists.txt file:

cmake_minimum_required(VERSION 3.18)


find_package(ReductCpp 1.1.0)

target_link_libraries(usage-example ${REDUCT_CPP_LIBRARIES} ${ZLIB_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)

And here is the code in

#include <reduct/client.h>

#include <iostream>

using reduct::IBucket;
using reduct::IClient;

int main() {
  auto client = IClient::Build("");

  // Get information about the server
  auto [info, err] = client->GetInfo();
  if (err) {
    std::cerr << "Error: " << err;
    return -1;

  std::cout << "Server version: " << info.version;
  // Create a bucket
  auto [bucket, create_err] = client->GetOrCreateBucket("bucket");
  if (create_err) {
    std::cerr << "Error: " << create_err;
    return -1;

  // Write some data
  IBucket::Time start = IBucket::Time::clock::now();
  [[maybe_unused]] auto write_err = bucket->Write("entry-1", {}, [](auto rec) { rec->WriteAll("some_data1"); });
  write_err = bucket->Write("entry-1", {}, [](auto rec) { rec->WriteAll("some_data2"); });
  write_err = bucket->Write("entry-1", {}, [](auto rec) { rec->WriteAll("some_data3"); });

  // Walk through the data
  err = bucket->Query("entry-1", start, IBucket::Time::clock::now(), std::nullopt, [](auto&& record) {
    std::string blob;
    auto read_err = record.Read([&blob](auto chunk) {
      return true;

    if (!read_err) {
      std::cout << "Read blob: " << blob;

    return true;

To compile the example, use the following commands:

mkdir build && cd build
cmake ..
cmake --build .

Before you can run the example, you will need to start the storage as a Docker container:

docker run -p 8383:8383  reductstorage/engine:latest

You can then run the example with the following command:


Next Steps

You can find more detailed documentation and examples in the Reference API section. You can also refer to the ReductStore HTTP API documentation for a complete reference of the available API calls.

#Tutorials #Sdks


ReductStore is a time series database designed specifically for storing and managing large amounts of blob data. It offers high performance for writing and real-time querying, making it suitable for edge computing, computer vision, and IoT applications. ReductStore is licensed under the Business Source License 1.1.


ReductStore LLC
651 N BROAD ST STE 201