DEV Community

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

Posted on

Reduct Storage Client SDK for C++ 1.0.0 was released

Hey everyone, I just released the Reduct Storage SDK for C++ v1.0.0. Now it supports Reduct Storage v1.0.0.

Because it is a major release, I refactored the Bucket.Write and Bucket.Read methods and made the more similar to Bucket.Query See #41.

Now to read a record from the storage engine, we use a callback with a proxy object:

  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;
  }

  auto ts = IBucket::Time::clock::now();
  auto read_err = bucket->Read("entry-1", ts, [](auto rec) {
        std::cout << "Read blob: " <<  rec->ReadAll() << std::endl;
  });
Enter fullscreen mode Exit fullscreen mode

and the same for writing:

auto write_err = bucket->Write("entry-1", ts, [](auto rec) {
    rec->WriteAll("some_data1"); 
});
Enter fullscreen mode Exit fullscreen mode

You also can easily use the same proxy objects to write or read records via chunks.

Have fun!

Top comments (0)