diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d8367d..00c5b47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/reduct/bucket.h b/src/reduct/bucket.h index dc5a5ae..1827199 100644 --- a/src/reduct/bucket.h +++ b/src/reduct/bucket.h @@ -376,16 +376,7 @@ class IBucket { std::optional when; ///< query condition std::optional strict; ///< strict mode std::optional ext; ///< additional parameters for extensions - - [[deprecated("Use when instead. Will be removed in v1.18.0")]] - std::optional each_s; ///< return one record each S seconds - [[deprecated("Use when instead. Will be remove in v1.18.0")]] - std::optional each_n; ///< return each N-th record - [[deprecated("Use when instead. Will be remove in v1.18.0")]] - std::optional limit; ///< limit number of records - std::optional 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 diff --git a/src/reduct/client.h b/src/reduct/client.h index 1a7f4e5..e083c90 100644 --- a/src/reduct/client.h +++ b/src/reduct/client.h @@ -201,10 +201,6 @@ class IClient { std::optional dst_token; // Destination access token std::vector 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 each_s; // Replicate a record every S seconds if not empty - [[deprecated("Use when instead. Will be removed in v1.18.0")]] - std::optional each_n; // Replicate every Nth record if not empty std::optional when; // Replication condition ReplicationMode mode = ReplicationMode::kEnabled; // Replication mode diff --git a/src/reduct/internal/serialisation.cc b/src/reduct/internal/serialisation.cc index 4d27c34..ab56db3 100644 --- a/src/reduct/internal/serialisation.cc +++ b/src/reduct/internal/serialisation.cc @@ -157,13 +157,6 @@ Result 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 { @@ -205,14 +198,6 @@ Result 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(); } @@ -257,18 +242,6 @@ Result QueryOptionsToJsonString(std::string_view type, c json_data["stop"] = std::chrono::duration_cast(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; } diff --git a/tests/reduct/entry_api_test.cc b/tests/reduct/entry_api_test.cc index 400682c..bc30fe9 100644 --- a/tests/reduct/entry_api_test.cc +++ b/tests/reduct/entry_api_test.cc @@ -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 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"); diff --git a/tests/reduct/replication_api_test.cc b/tests/reduct/replication_api_test.cc index 255da98..a3b3034 100644 --- a/tests/reduct/replication_api_test.cc +++ b/tests/reduct/replication_api_test.cc @@ -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);