DEV Community

Cover image for Reduct Storage Client SDK for C++ 0.7.0 was released
Alexey Timin for ReductStore

Posted on • Edited on

Reduct Storage Client SDK for C++ 0.7.0 was released

This is a little update for people who follow news about Reduct Storage and its ecosystem.

I've just released a new version of the SDK which supports HTTP API v0.7.
The most important new feature is the IBucket::Query method. It allows to iterate records for a given time interval:

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

int main() {
  auto client = IClient::Build("https://play.reduct-storage.dev");
  // Create a bucket
  auto [bucket, create_err] = client->GetOrCreateBucket("bucket");
  if (create_err) {
    std::cerr << "Error: " << create_err;
    return -1;
  }


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

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

    return true;
  });
}
Enter fullscreen mode Exit fullscreen mode

You can use the library with CMake's FetchContet macros or install it from the source:

git clone https://github.com/reduct-storage/reduct-cpp.git
cd reduct-cpp
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
sudo cmake --build . --target install
Enter fullscreen mode Exit fullscreen mode

In your CMakeLists.txt:

find_package(ReductCpp 0.8.0)
find_package(ZLIB)
find_package(OpenSSL)

add_executable(you_app you_app.cc)
target_link_libraries(you_app ${REDUCT_CPP_LIBRARIES} ${ZLIB_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
Enter fullscreen mode Exit fullscreen mode

For more information, read here

Top comments (0)