From 8d44e6233d76567698763ea2d55646dd13b8ecdc Mon Sep 17 00:00:00 2001 From: Alexey Timin Date: Wed, 11 Sep 2024 13:40:29 +0200 Subject: [PATCH] fix cpp example --- .../cpp/src/data_management_delete_query.cc | 2 +- .../js/src/data_management_delete_query.mjs | 12 +- docs/guides/data-management.mdx | 138 +++++++++--------- 3 files changed, 79 insertions(+), 73 deletions(-) diff --git a/docs/examples/cpp/src/data_management_delete_query.cc b/docs/examples/cpp/src/data_management_delete_query.cc index f71c05b4..e036d4f5 100644 --- a/docs/examples/cpp/src/data_management_delete_query.cc +++ b/docs/examples/cpp/src/data_management_delete_query.cc @@ -26,7 +26,7 @@ int main() { assert(err == Error::kOk); // Delete all records withing a time range - auto [removed_records, query_err] = bucket->RemoveQuery("cpp-example", ts, ts + 1s, {}); + auto [removed_records, query_err] = bucket->RemoveQuery("cpp-example", ts, ts + 2s, {}); assert(query_err == Error::kOk); assert(removed_records == 2); diff --git a/docs/examples/js/src/data_management_delete_query.mjs b/docs/examples/js/src/data_management_delete_query.mjs index 0a0ec7e5..75099df4 100644 --- a/docs/examples/js/src/data_management_delete_query.mjs +++ b/docs/examples/js/src/data_management_delete_query.mjs @@ -14,11 +14,17 @@ record = await bucket.beginWrite("entry-1", timestamp + 1000_000n); await record.write("Some more binary data"); // Delete all records withing a time range -const removedRecords = await bucket.removeQuery("entry-1", timestamp, timestamp + 2000_000n); +const removedRecords = await bucket.removeQuery( + "entry-1", + timestamp, + timestamp + 2000_000n, +); assert(removedRecords === 2); // You can also delete all records with a specific label -await bucket.removeQuery("entry-1", undefined, undefined, { include: { label1: "value1" } }); +await bucket.removeQuery("entry-1", undefined, undefined, { + include: { label1: "value1" }, +}); // Or each N-th record -await bucket.removeQuery("entry-1", undefined, undefined, { eachN: 2 }); \ No newline at end of file +await bucket.removeQuery("entry-1", undefined, undefined, { eachN: 2 }); diff --git a/docs/guides/data-management.mdx b/docs/guides/data-management.mdx index ab70c1e8..58a9e3d9 100644 --- a/docs/guides/data-management.mdx +++ b/docs/guides/data-management.mdx @@ -8,10 +8,10 @@ import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; - + # Data Management With ReductStore @@ -34,21 +34,21 @@ import ChangeLabelsCpp from "!!raw-loader!../examples/cpp/src/data_management_up import ChangeLabelsCurl from "!!raw-loader!../examples/curl/data_management_update_labels.sh"; - - {ChangeLabelsPy} - - - {ChangeLabelsJs} - - - {ChangeLabelsRs} - - - {ChangeLabelsCpp} - - - {ChangeLabelsCurl} - + + {ChangeLabelsPy} + + + {ChangeLabelsJs} + + + {ChangeLabelsRs} + + + {ChangeLabelsCpp} + + + {ChangeLabelsCurl} + ## Deleting Data @@ -68,24 +68,24 @@ import DeleteDataCli from "!!raw-loader!../examples/cli/data_management_delete_d import DeleteDataCurl from "!!raw-loader!../examples/curl/data_management_delete_data.sh"; - - {DeleteDataPy} - - - {DeleteDataJs} - - - {DeleteDataRs} - - - {DeleteDataCpp} - - - {DeleteDataCli} - - - {DeleteDataCurl} - + + {DeleteDataPy} + + + {DeleteDataJs} + + + {DeleteDataRs} + + + {DeleteDataCpp} + + + {DeleteDataCli} + + + {DeleteDataCurl} + ### Deleting Specific Records @@ -99,21 +99,21 @@ import DeleteRecordsCpp from "!!raw-loader!../examples/cpp/src/data_management_d import DeleteRecordsCurl from "!!raw-loader!../examples/curl/data_management_delete_records.sh"; - - {DeleteRecordsPy} - - - {DeleteRecordsJs} - - - {DeleteRecordsRs} - - - {DeleteRecordsCpp} - - - {DeleteRecordsCurl} - + + {DeleteRecordsPy} + + + {DeleteRecordsJs} + + + {DeleteRecordsRs} + + + {DeleteRecordsCpp} + + + {DeleteRecordsCurl} + ### Deleting Records in a Time Range @@ -121,7 +121,7 @@ import DeleteRecordsCurl from "!!raw-loader!../examples/curl/data_management_del You can delete records in a specific time range by specifying the start and end timestamps, and you can use query parameters to filter the records: | Parameter | Description | Type | Default | -|-----------|-----------------------------------|-------------------------|------------------------------------------------| +| --------- | --------------------------------- | ----------------------- | ---------------------------------------------- | | `start` | Remove records from | Timestamp | The timestamp of the first record in the entry | | `end` | Remove records until | Timestamp | The timestamp of the last record in the entry | | `include` | Remove only records with labels | List of key-value pairs | Disabled | @@ -138,23 +138,23 @@ import DeleteRecordsRangeCpp from "!!raw-loader!../examples/cpp/src/data_managem import DeleteRecordsRangeCurl from "!!raw-loader!../examples/curl/data_management_delete_query.sh"; - - {DeleteRecordsRangePy} - - - {DeleteRecordsRangeJs} - - - {DeleteRecordsRangeRs} - - - {DeleteRecordsRangeCpp} - - - {DeleteRecordsRangeCurl} - + + {DeleteRecordsRangePy} + + + {DeleteRecordsRangeJs} + + + {DeleteRecordsRangeRs} + + + {DeleteRecordsRangeCpp} + + + {DeleteRecordsRangeCurl} + :::info Deleting records in a time range is a heavy operation and may take a long time to complete because it copies the retained records to new blocks and deletes the old ones. -::: \ No newline at end of file +:::