ReductStore Client SDK for C++ v1.3.0 with Labels Support

Feb 22, 2023. | By: Alexey Timin

We are excited to announce the release of ReductStore Client SDK for C++ v1.3.0! This release includes support for the ReductStore API v1.3.0 with labels and content type.

Labels

Since ReductStore v1.3.0, you can attach labels to data when writing and querying. Labels are key-value pairs that can be used to classify and categorize data. For example, you might use labels to store metadata about a record, such as its md5 sum or class.

auto [bucket, err] =  client->CreateBucket(kBucketName);

IBucket::Time ts = IBucket::Time() + std::chrono::microseconds(123109210);
std::string blob = "some blob of data";
bucket->Write("entry",
    IBucket::WriteOptions{
        .timestamp = ts,
        .labels = IBucket::LableMap({"label1", "value3"}),
    },
    [&blob](auto rec) { rec->WriteAll(blob); 
});

This labels can be used to filter the results of a query:

auto err = bucket->Query("entry", ts, ts + us(3), 
    IBucket::QueryOptions{.include = IBucket::LabelMap({"label1", "value1"})},
    [&all_data](auto record) {
        std::cout << record->ReadAll() << std::endl;
    }
);

Content Type

You can now specify the content type of the data you are writing to the ReductStore database. This could be useful for example when you are writing a file to the database and want to store the file extension as the content type or keep information about the image format.

bucket->Write("entry", I
    Bucket::WriteOptions{
        .content_type = "image/png",
    },
    [&blob](auto rec) { rec->WriteAll(image_as_blob); }
 );

Read more about labels and content type in the ReductStore documentation.

I hope you find this release useful. If you have any questions or feedback, don’t hesitate to reach out in Discord or by opening a discussion on GitHub.

Thanks for using ReductStore!

#News #Sdks #Tutorials

About

ReductStore is a time series database designed specifically for storing and managing large amounts of blob data. It has high performance for writing and real-time querying, making it suitable for edge computing, computer vision, and IoT applications. ReductStore is 100% open source under Mozilla Public License v2.0.