Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Parsing server URLs with an additional path, [PR-102](https://github.com/reductstore/reduct-cpp/pull/102)
- Fix Multi-entry API implementation,[PR-108](https://github.com/reductstore/reduct-cpp/pull/108)

### Removed

- each_n, each_s, limit in IBucket::QueryOptions and IBucket::ReplicationSettings are removed, [PR-109](https://github.com/reductstore/reduct-cpp/pull/109)

## [1.17.1] - 2025-11-17

### Added
Expand Down
9 changes: 0 additions & 9 deletions src/reduct/bucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,7 @@ class IBucket {
std::optional<std::string> when; ///< query condition
std::optional<bool> strict; ///< strict mode
std::optional<std::string> ext; ///< additional parameters for extensions

[[deprecated("Use when instead. Will be removed in v1.18.0")]]
std::optional<double> each_s; ///< return one record each S seconds
[[deprecated("Use when instead. Will be remove in v1.18.0")]]
std::optional<size_t> each_n; ///< return each N-th record
[[deprecated("Use when instead. Will be remove in v1.18.0")]]
std::optional<size_t> limit; ///< limit number of records

std::optional<std::chrono::milliseconds> ttl; ///< time to live

bool continuous = false; ///< continuous query. If true,
/// the method returns the latest record and waits for the next one
std::chrono::milliseconds poll_interval = std::chrono::milliseconds(1000); ///< poll interval for continuous query
Expand Down
4 changes: 0 additions & 4 deletions src/reduct/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ class IClient {
std::optional<std::string> dst_token; // Destination access token
std::vector<std::string>
entries; // Entries to replicate. If empty, all entries are replicated. Wildcards are supported.
[[deprecated("Use when instead. Will be removed in v1.18.0")]]
std::optional<double> each_s; // Replicate a record every S seconds if not empty
[[deprecated("Use when instead. Will be removed in v1.18.0")]]
std::optional<uint64_t> each_n; // Replicate every Nth record if not empty
std::optional<std::string> when; // Replication condition
ReplicationMode mode = ReplicationMode::kEnabled; // Replication mode

Expand Down
27 changes: 0 additions & 27 deletions src/reduct/internal/serialisation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,6 @@ Result<nlohmann::json> ReplicationSettingsToJsonString(IClient::ReplicationSetti
}
json_data["entries"] = settings.entries;
json_data["mode"] = ReplicationModeToString(settings.mode);
if (settings.each_s) {
json_data["each_s"] = *settings.each_s;
}

if (settings.each_n) {
json_data["each_n"] = *settings.each_n;
}

if (settings.when) {
try {
Expand Down Expand Up @@ -205,14 +198,6 @@ Result<IClient::FullReplicationInfo> ParseFullReplicationInfo(const nlohmann::js
info.settings.dst_token = settings.at("dst_token");
}

if (settings.contains("each_s") && !settings.at("each_s").is_null()) {
info.settings.each_s = settings.at("each_s");
}

if (settings.contains("each_n") && !settings.at("each_n").is_null()) {
info.settings.each_n = settings.at("each_n");
}

if (settings.contains("when") && !settings.at("when").is_null()) {
info.settings.when = settings.at("when").dump();
}
Expand Down Expand Up @@ -257,18 +242,6 @@ Result<nlohmann::ordered_json> QueryOptionsToJsonString(std::string_view type, c
json_data["stop"] = std::chrono::duration_cast<std::chrono::microseconds>(stop->time_since_epoch()).count();
}

if (options.each_s) {
json_data["each_s"] = *options.each_s;
}

if (options.each_n) {
json_data["each_n"] = *options.each_n;
}

if (options.limit) {
json_data["limit"] = *options.limit;
}

if (options.ttl) {
json_data["ttl"] = options.ttl->count() / 1000;
}
Expand Down
60 changes: 0 additions & 60 deletions tests/reduct/entry_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,66 +411,6 @@ TEST_CASE("reduct::IBucket should remove a batch across entries", "[entry_api][1
Error{.code = 404, .message = "No record with timestamp 1"});
}

TEST_CASE("reduct::IBucket should resample data", "[entry_api][1_10]") {
Fixture ctx;
auto [bucket, _] = ctx.client->CreateBucket(kBucketName);
REQUIRE(bucket);

IBucket::Time ts{};
REQUIRE(bucket->Write("entry", ts, [](auto rec) { rec->WriteAll("some_data1"); }) == Error::kOk);
REQUIRE(bucket->Write("entry", ts + s(1), [](auto rec) { rec->WriteAll("some_data2"); }) == Error::kOk);
REQUIRE(bucket->Write("entry", ts + s(2), [](auto rec) { rec->WriteAll("some_data3"); }) == Error::kOk);

std::vector<std::string> received_data;
auto call_back = [&received_data](auto record) {
auto [data, err] = record.ReadAll();
received_data.push_back(data);
return true;
};

SECTION("return a record each 2 seconds") {
auto err = bucket->Query("entry", std::nullopt, std::nullopt, {.each_s = 2.0}, call_back);

REQUIRE(err == Error::kOk);
REQUIRE(received_data.size() == 2);
REQUIRE(received_data[0] == "some_data1");
REQUIRE(received_data[1] == "some_data3");
}

SECTION("return each 3th record") {
auto err = bucket->Query("entry", std::nullopt, std::nullopt, {.each_n = 3}, call_back);

REQUIRE(err == Error::kOk);
REQUIRE(received_data.size() == 1);
REQUIRE(received_data[0] == "some_data1");
}
}

TEST_CASE("reduct::IBucket should limit records in a query", "[entry_api][1_6]") {
Fixture ctx;
auto [bucket, _] = ctx.client->GetBucket("test_bucket_1");
REQUIRE(bucket);

int count = 0;
auto err =
bucket->Query("entry-1", IBucket::Time{}, IBucket::Time::clock::now(), {.limit = 1}, [&count](auto record) {
count++;
return true;
});

REQUIRE(err == Error::kOk);
REQUIRE(count == 1);

count = 0;
err = bucket->Query("entry-1", IBucket::Time{}, IBucket::Time::clock::now(), {.limit = 2}, [&count](auto record) {
count++;
return true;
});

REQUIRE(err == Error::kOk);
REQUIRE(count == 2);
}

TEST_CASE("reduct::IBucket should query data with ext parameter", "[bucket_api][1_15]") {
Fixture ctx;
auto [bucket, _] = ctx.client->GetBucket("test_bucket_1");
Expand Down
3 changes: 0 additions & 3 deletions tests/reduct/replication_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ TEST_CASE("reduct::Client should remove a replication", "[replication_api][1_8]"
TEST_CASE("reduct::Client should set each_s and each_n settings", "[replication_api][1_17]") {
Fixture ctx;
auto settings = DefaultSettings();
settings.each_s = 1.5;
settings.each_n = 10;

auto err = ctx.client->CreateReplication("test_replication", settings);
REQUIRE(err == Error::kOk);

Expand Down
Loading