From 553979ce4b4f1a6d90ec89f992607363f2387d3a Mon Sep 17 00:00:00 2001 From: Beka Davis <31743465+bekadavis9@users.noreply.github.com> Date: Fri, 29 Sep 2023 08:40:30 -0400 Subject: [PATCH] Add REST client support for delete_fragments and delete_fragments_list (#3923) * Rebase on dev * Add deserialization and test for fragments_list * Add serialization for FragmentTimestamps * Add deserialization C APIs * Add win32 capnp files * Use pointers to output params, return data in serialization * Add class FragmentsList with OL fragment for FragmentsList Handle class * Add Handle class for FragmentsList and use handle for deserialization * Rebase on dev * Address comments * Calculate char length with strlen * Use string_view in tiledb_fragments_list_get_fragment_uri * Rebase on dev * Address minor comments * Rename capnp structures * Fix CI failure * Add tiledb_array_delete_fragments_v2 which directly calls the Rest API * Move Rest call into C API for delete_fragments_list * Add uri to ArrayDeleteFragmentsTimestampsRequest * Add uri to FragmentsList capnp struct * Delete fragments inside of tiledb_deserialize_array_delete_fragments_timestamps_request * Delete fragments list in tiledb_deserialize_array_delete_fragments_list_request * Remove FragmentsList class and its handle class * Error handling optimization * Fix test issue, open between timestamps --- test/regression/targets/sc-25116.cc | 2 + test/src/unit-capi-array.cc | 94 +++- test/src/unit-cppapi-deletes.cc | 23 +- tiledb/CMakeLists.txt | 3 + tiledb/sm/array/array.cc | 21 +- tiledb/sm/c_api/tiledb.cc | 242 +++++++++- tiledb/sm/c_api/tiledb.h | 32 +- tiledb/sm/c_api/tiledb_serialization.h | 28 ++ tiledb/sm/cpp_api/array.h | 31 +- tiledb/sm/rest/rest_client.cc | 77 ++++ tiledb/sm/rest/rest_client.h | 27 +- tiledb/sm/serialization/array.cc | 11 +- tiledb/sm/serialization/array.h | 2 +- tiledb/sm/serialization/fragments.cc | 332 ++++++++++++++ tiledb/sm/serialization/fragments.h | 119 +++++ .../serialization/posix/tiledb-rest.capnp.c++ | 161 +++++++ .../serialization/posix/tiledb-rest.capnp.h | 432 ++++++++++++++++++ tiledb/sm/serialization/tiledb-rest.capnp | 11 + .../serialization/win32/tiledb-rest.capnp.c++ | 161 +++++++ .../serialization/win32/tiledb-rest.capnp.h | 432 ++++++++++++++++++ 20 files changed, 2171 insertions(+), 70 deletions(-) create mode 100644 tiledb/sm/serialization/fragments.cc create mode 100644 tiledb/sm/serialization/fragments.h diff --git a/test/regression/targets/sc-25116.cc b/test/regression/targets/sc-25116.cc index d000b08994a..25e7ab1bb63 100644 --- a/test/regression/targets/sc-25116.cc +++ b/test/regression/targets/sc-25116.cc @@ -76,4 +76,6 @@ TEST_CASE( FragmentInfo fi(ctx, array_name); fi.load(); REQUIRE(fi.fragment_num() == 1); + + remove_array(); } diff --git a/test/src/unit-capi-array.cc b/test/src/unit-capi-array.cc index 30c4b96d82d..a088d2a7614 100644 --- a/test/src/unit-capi-array.cc +++ b/test/src/unit-capi-array.cc @@ -36,10 +36,6 @@ #endif #include -#include "tiledb/sm/c_api/tiledb.h" - -#include - #include "test/support/src/helpers.h" #include "test/support/src/serialization_wrappers.h" #include "test/support/src/vfs_helpers.h" @@ -59,6 +55,7 @@ #include "tiledb/sm/enums/serialization_type.h" #include "tiledb/sm/global_state/unit_test_config.h" #include "tiledb/sm/serialization/array.h" +#include "tiledb/sm/serialization/fragments.h" #include "tiledb/storage_format/uri/parse_uri.h" #include @@ -385,7 +382,7 @@ void ArrayFx::create_dense_array(const std::string& path) { void ArrayFx::write_fragment(tiledb_array_t* array, uint64_t timestamp) { // Open the array at the given timestamp - int rc = tiledb_array_set_open_timestamp_start(ctx_, array, timestamp); + int rc = tiledb_array_set_open_timestamp_end(ctx_, array, timestamp); REQUIRE(rc == TILEDB_OK); rc = tiledb_array_open(ctx_, array, TILEDB_WRITE); REQUIRE(rc == TILEDB_OK); @@ -2666,3 +2663,90 @@ TEST_CASE_METHOD( remove_temp_dir(local_fs.file_prefix() + local_fs.temp_dir()); #endif } + +TEST_CASE_METHOD( + ArrayFx, + "Test array fragments serialization", + "[array][fragments][serialization]") { +#ifdef TILEDB_SERIALIZATION + SupportedFsLocal local_fs; + std::string array_name = local_fs.file_prefix() + local_fs.temp_dir() + + "array_fragments_serialization"; + create_temp_dir(local_fs.file_prefix() + local_fs.temp_dir()); + create_dense_vector(array_name); + + // Write fragments at timestamps 1, 2 + tiledb_array_t* array; + int rc = tiledb_array_alloc(ctx_, array_name.c_str(), &array); + REQUIRE(rc == TILEDB_OK); + uint64_t start_timestamp = 1; + uint64_t end_timestamp = 2; + write_fragment(array, start_timestamp); + write_fragment(array, end_timestamp); + CHECK(tiledb::test::num_commits(array_name) == 2); + CHECK(tiledb::test::num_fragments(array_name) == 2); + + // ALlocate buffer + tiledb_buffer_t* buff; + rc = tiledb_buffer_alloc(ctx_, &buff); + REQUIRE(rc == TILEDB_OK); + + SECTION("delete_fragments") { + // Serialize fragment timestamps and deserialize delete request + tiledb::sm::serialization::fragments_timestamps_serialize( + array_name, + start_timestamp, + end_timestamp, + tiledb::sm::SerializationType::CAPNP, + &buff->buffer()); + rc = tiledb_deserialize_array_delete_fragments_timestamps_request( + ctx_, + (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, + buff); + REQUIRE(rc == TILEDB_OK); + CHECK(tiledb::test::num_commits(array_name) == 0); + CHECK(tiledb::test::num_fragments(array_name) == 0); + } + + SECTION("delete_fragments_list") { + // Get the fragment info object + tiledb_fragment_info_t* fragment_info = nullptr; + rc = tiledb_fragment_info_alloc(ctx_, array_name.c_str(), &fragment_info); + REQUIRE(rc == TILEDB_OK); + rc = tiledb_fragment_info_load(ctx_, fragment_info); + REQUIRE(rc == TILEDB_OK); + + // Get the fragment URIs + const char* uri1; + rc = tiledb_fragment_info_get_fragment_uri(ctx_, fragment_info, 0, &uri1); + REQUIRE(rc == TILEDB_OK); + const char* uri2; + rc = tiledb_fragment_info_get_fragment_uri(ctx_, fragment_info, 1, &uri2); + REQUIRE(rc == TILEDB_OK); + + std::vector fragments; + fragments.emplace_back(URI(uri1)); + fragments.emplace_back(URI(uri2)); + + // Serialize fragments list and deserialize delete request + tiledb::sm::serialization::fragments_list_serialize( + array_name, + fragments, + tiledb::sm::SerializationType::CAPNP, + &buff->buffer()); + rc = tiledb_deserialize_array_delete_fragments_list_request( + ctx_, + (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, + buff); + REQUIRE(rc == TILEDB_OK); + CHECK(tiledb::test::num_commits(array_name) == 0); + CHECK(tiledb::test::num_fragments(array_name) == 0); + tiledb_fragment_info_free(&fragment_info); + } + + // Clean up + tiledb_array_free(&array); + tiledb_buffer_free(&buff); + remove_temp_dir(local_fs.file_prefix() + local_fs.temp_dir()); +#endif +} diff --git a/test/src/unit-cppapi-deletes.cc b/test/src/unit-cppapi-deletes.cc index b61292dfc0d..8306717301a 100644 --- a/test/src/unit-cppapi-deletes.cc +++ b/test/src/unit-cppapi-deletes.cc @@ -1766,16 +1766,6 @@ TEST_CASE_METHOD( write_sparse({0, 1, 2, 3}, {1, 1, 1, 2}, {1, 2, 4, 3}, 3); CHECK(tiledb::test::num_fragments(SPARSE_ARRAY_NAME) == 2); - // Open array in WRITE mode and try to delete fragments - std::unique_ptr array = - std::make_unique(ctx_, SPARSE_ARRAY_NAME, TILEDB_WRITE); - REQUIRE_THROWS_WITH( - array->delete_fragments(SPARSE_ARRAY_NAME, 0, UINT64_MAX), - Catch::Matchers::ContainsSubstring( - "Query type must be MODIFY_EXCLUSIVE")); - CHECK(tiledb::test::num_fragments(SPARSE_ARRAY_NAME) == 2); - array->close(); - // Try to delete a fragment uri that doesn't exist std::string extraneous_fragment = std::string(SPARSE_ARRAY_NAME) + "/" + @@ -1784,8 +1774,7 @@ TEST_CASE_METHOD( REQUIRE_THROWS_WITH( Array::delete_fragments_list( ctx_, SPARSE_ARRAY_NAME, extraneous_fragments, 1), - Catch::Matchers::ContainsSubstring( - "is not a fragment of the ArrayDirectory")); + Catch::Matchers::ContainsSubstring("Failed to delete fragments_list")); CHECK(tiledb::test::num_fragments(SPARSE_ARRAY_NAME) == 2); remove_sparse_array(); @@ -1836,10 +1825,7 @@ TEST_CASE_METHOD( // Delete fragments SECTION("delete fragments by timestamps") { - std::unique_ptr array = std::make_unique( - ctx_, SPARSE_ARRAY_NAME, TILEDB_MODIFY_EXCLUSIVE); - array->delete_fragments(SPARSE_ARRAY_NAME, 2, 6); - array->close(); + Array::delete_fragments(ctx_, SPARSE_ARRAY_NAME, 2, 6); } SECTION("delete fragments by uris") { @@ -1926,9 +1912,7 @@ TEST_CASE_METHOD( CHECK(tiledb::test::num_fragments(SPARSE_ARRAY_NAME) == num_fragments); // Delete fragments at timestamps 2 - 4 - std::unique_ptr array = - std::make_unique(ctx_, SPARSE_ARRAY_NAME, TILEDB_MODIFY_EXCLUSIVE); - array->delete_fragments(SPARSE_ARRAY_NAME, 2, 4); + Array::delete_fragments(ctx_, SPARSE_ARRAY_NAME, 2, 4); if (!vacuum) { // Vacuum after deletion auto config = ctx_.config(); @@ -1936,7 +1920,6 @@ TEST_CASE_METHOD( num_commits -= 2; num_fragments -= 2; } - array->close(); // Validate working directory CHECK(tiledb::test::num_commits(SPARSE_ARRAY_NAME) == num_commits); diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt index 450530d9c7c..75c2fd93272 100644 --- a/tiledb/CMakeLists.txt +++ b/tiledb/CMakeLists.txt @@ -284,6 +284,7 @@ set(TILEDB_CORE_SOURCES ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/enumeration.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragment_info.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragment_metadata.cc + ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragments.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/group.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/query.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/consolidation.cc @@ -335,6 +336,7 @@ if (TILEDB_SERIALIZATION) ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/enumeration.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragment_info.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragment_metadata.cc + ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragments.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/group.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/query.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/consolidation.cc @@ -355,6 +357,7 @@ if (TILEDB_SERIALIZATION) ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/enumeration.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragment_info.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragment_metadata.cc + ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/fragments.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/group.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/query.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/consolidation.cc diff --git a/tiledb/sm/array/array.cc b/tiledb/sm/array/array.cc index a9fea9a2f75..5d1bacb8c17 100644 --- a/tiledb/sm/array/array.cc +++ b/tiledb/sm/array/array.cc @@ -552,10 +552,14 @@ void Array::delete_fragments( ensure_array_is_valid_for_delete(uri); // Delete fragments - // #TODO Add rest support for delete_fragments if (remote_) { - throw ArrayException( - "[delete_fragments] Remote arrays currently unsupported."); + auto rest_client = resources_.rest_client(); + if (rest_client == nullptr) { + throw ArrayException( + "[delete_fragments] Remote array with no REST client."); + } + rest_client->delete_fragments_from_rest( + uri, timestamp_start, timestamp_end); } else { storage_manager_->delete_fragments( uri.c_str(), timestamp_start, timestamp_end); @@ -567,11 +571,14 @@ void Array::delete_fragments_list( // Check that data deletion is allowed ensure_array_is_valid_for_delete(uri); - // Delete fragments - // #TODO Add rest support for delete_fragments_list + // Delete fragments_list if (remote_) { - throw ArrayException( - "[delete_fragments_list] Remote arrays currently unsupported."); + auto rest_client = resources_.rest_client(); + if (rest_client == nullptr) { + throw ArrayException( + "[delete_fragments_list] Remote array with no REST client."); + } + rest_client->delete_fragments_list_from_rest(uri, fragment_uris); } else { auto array_dir = ArrayDirectory( resources_, uri, 0, std::numeric_limits::max()); diff --git a/tiledb/sm/c_api/tiledb.cc b/tiledb/sm/c_api/tiledb.cc index 9b7b0501121..95e4d4667c8 100644 --- a/tiledb/sm/c_api/tiledb.cc +++ b/tiledb/sm/c_api/tiledb.cc @@ -79,6 +79,7 @@ #include "tiledb/sm/serialization/config.h" #include "tiledb/sm/serialization/enumeration.h" #include "tiledb/sm/serialization/fragment_info.h" +#include "tiledb/sm/serialization/fragments.h" #include "tiledb/sm/serialization/query.h" #include "tiledb/sm/stats/global_stats.h" #include "tiledb/sm/storage_manager/context.h" @@ -2351,6 +2352,10 @@ int32_t tiledb_array_delete_fragments( if (sanity_check(ctx) == TILEDB_ERR || sanity_check(ctx, array) == TILEDB_ERR) return TILEDB_ERR; + LOG_WARN( + "tiledb_array_delete_fragments is deprecated. Please use " + "tiledb_array_delete_fragments_v2 instead."); + try { array->array_->delete_fragments( tiledb::sm::URI(uri), timestamp_start, timestamp_end); @@ -2364,12 +2369,64 @@ int32_t tiledb_array_delete_fragments( return TILEDB_OK; } +capi_return_t tiledb_array_delete_fragments_v2( + tiledb_ctx_t* ctx, + const char* uri_str, + uint64_t timestamp_start, + uint64_t timestamp_end) { + auto uri = tiledb::sm::URI(uri_str); + if (uri.is_invalid()) { + throw api::CAPIStatusException( + "Failed to delete fragments; Invalid input uri"); + } + + // Allocate an array object + tiledb_array_t* array = new (std::nothrow) tiledb_array_t; + try { + array->array_ = + make_shared(HERE(), uri, ctx->storage_manager()); + } catch (...) { + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to create array"); + } + + // Set array open timestamps + array->array_->set_timestamp_start(timestamp_start); + array->array_->set_timestamp_end(timestamp_end); + + // Open the array for exclusive modification + throw_if_not_ok(array->array_->open( + static_cast(TILEDB_MODIFY_EXCLUSIVE), + static_cast(TILEDB_NO_ENCRYPTION), + nullptr, + 0)); + + // Delete fragments + try { + array->array_->delete_fragments(uri, timestamp_start, timestamp_end); + } catch (...) { + throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to delete fragments"); + } + + // Close and delete the array + throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; + + return TILEDB_OK; +} + capi_return_t tiledb_array_delete_fragments_list( tiledb_ctx_t* ctx, - const char* uri, + const char* uri_str, const char* fragment_uris[], const size_t num_fragments) { - if (tiledb::sm::URI(uri).is_invalid()) { + auto uri = tiledb::sm::URI(uri_str); + if (uri.is_invalid()) { throw api::CAPIStatusException( "Failed to delete_fragments_list; Invalid input uri"); } @@ -2386,19 +2443,22 @@ capi_return_t tiledb_array_delete_fragments_list( } } + // Convert the list of fragment uris to a vector + std::vector uris; + uris.reserve(num_fragments); + for (size_t i = 0; i < num_fragments; i++) { + uris.emplace_back(tiledb::sm::URI(fragment_uris[i])); + } + // Allocate an array object tiledb_array_t* array = new (std::nothrow) tiledb_array_t; try { - array->array_ = make_shared( - HERE(), tiledb::sm::URI(uri), ctx->storage_manager()); - } catch (std::bad_alloc&) { - auto st = Status_Error( - "Failed to create TileDB array object; Memory allocation error"); + array->array_ = + make_shared(HERE(), uri, ctx->storage_manager()); + } catch (...) { delete array; array = nullptr; - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; + throw api::CAPIStatusException("Failed to create array"); } // Open the array for exclusive modification @@ -2408,25 +2468,20 @@ capi_return_t tiledb_array_delete_fragments_list( nullptr, 0)); - // Convert the list of fragment uris to a vector - std::vector uris; - uris.reserve(num_fragments); - for (size_t i = 0; i < num_fragments; i++) { - uris.emplace_back(tiledb::sm::URI(fragment_uris[i])); - } - + // Delete fragments list try { - array->array_->delete_fragments_list(tiledb::sm::URI(uri), uris); - } catch (std::exception& e) { + array->array_->delete_fragments_list(uri, uris); + } catch (...) { throw_if_not_ok(array->array_->close()); - auto st = Status_ArrayError(e.what()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to delete fragments_list"); } // Close the array throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; return TILEDB_OK; } @@ -3997,6 +4052,115 @@ int32_t tiledb_serialize_array_max_buffer_sizes( return TILEDB_OK; } +capi_return_t tiledb_deserialize_array_delete_fragments_timestamps_request( + tiledb_ctx_t* ctx, + tiledb_serialization_type_t serialize_type, + const tiledb_buffer_t* buffer) { + api::ensure_buffer_is_valid(buffer); + + // Deserialize buffer + auto [uri_str, timestamp_start, timestamp_end] = + tiledb::sm::serialization::fragments_timestamps_deserialize( + (tiledb::sm::SerializationType)serialize_type, buffer->buffer()); + + auto uri = tiledb::sm::URI(uri_str); + if (uri.is_invalid()) { + throw api::CAPIStatusException( + "Failed to delete fragments; Invalid input uri"); + } + + // Allocate an array object + tiledb_array_t* array = new (std::nothrow) tiledb_array_t; + try { + array->array_ = + make_shared(HERE(), uri, ctx->storage_manager()); + } catch (...) { + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to create array"); + } + + // Set array open timestamps + array->array_->set_timestamp_start(timestamp_start); + array->array_->set_timestamp_end(timestamp_end); + + // Open the array for exclusive modification + throw_if_not_ok(array->array_->open( + static_cast(TILEDB_MODIFY_EXCLUSIVE), + static_cast(TILEDB_NO_ENCRYPTION), + nullptr, + 0)); + + // Delete fragments + try { + array->array_->delete_fragments(uri, timestamp_start, timestamp_end); + } catch (...) { + throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to delete fragments"); + } + + // Close and delete the array + throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; + + return TILEDB_OK; +} + +capi_return_t tiledb_deserialize_array_delete_fragments_list_request( + tiledb_ctx_t* ctx, + tiledb_serialization_type_t serialize_type, + const tiledb_buffer_t* buffer) { + api::ensure_buffer_is_valid(buffer); + + // Deserialize buffer + auto [uri_str, uris] = tiledb::sm::serialization::fragments_list_deserialize( + (tiledb::sm::SerializationType)serialize_type, buffer->buffer()); + + auto uri = tiledb::sm::URI(uri_str); + if (uri.is_invalid()) { + throw api::CAPIStatusException( + "Failed to delete_fragments_list; Invalid input uri"); + } + + // Allocate an array object + tiledb_array_t* array = new (std::nothrow) tiledb_array_t; + try { + array->array_ = + make_shared(HERE(), uri, ctx->storage_manager()); + } catch (...) { + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to create array"); + } + + // Open the array for exclusive modification + throw_if_not_ok(array->array_->open( + static_cast(TILEDB_MODIFY_EXCLUSIVE), + static_cast(TILEDB_NO_ENCRYPTION), + nullptr, + 0)); + + // Delete fragments list + try { + array->array_->delete_fragments_list(uri, uris); + } catch (...) { + throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; + throw api::CAPIStatusException("Failed to delete fragments_list"); + } + + // Close and delete the array + throw_if_not_ok(array->array_->close()); + delete array; + array = nullptr; + + return TILEDB_OK; +} + int32_t tiledb_serialize_array_metadata( tiledb_ctx_t* ctx, const tiledb_array_t* array, @@ -6279,13 +6443,22 @@ int32_t tiledb_array_delete_fragments( ctx, array, uri, timestamp_start, timestamp_end); } +capi_return_t tiledb_array_delete_fragments_v2( + tiledb_ctx_t* ctx, + const char* uri_str, + uint64_t timestamp_start, + uint64_t timestamp_end) noexcept { + return api_entry( + ctx, uri_str, timestamp_start, timestamp_end); +} + capi_return_t tiledb_array_delete_fragments_list( tiledb_ctx_t* ctx, - const char* uri, + const char* uri_str, const char* fragment_uris[], const size_t num_fragments) noexcept { return api_entry( - ctx, uri, fragment_uris, num_fragments); + ctx, uri_str, fragment_uris, num_fragments); } int32_t tiledb_array_open( @@ -6862,6 +7035,25 @@ int32_t tiledb_serialize_array_max_buffer_sizes( ctx, array, subarray, serialize_type, buffer); } +capi_return_t tiledb_deserialize_array_delete_fragments_timestamps_request( + tiledb_ctx_t* ctx, + tiledb_serialization_type_t serialize_type, + const tiledb_buffer_t* buffer) noexcept { + return api_entry< + tiledb::api:: + tiledb_deserialize_array_delete_fragments_timestamps_request>( + ctx, serialize_type, buffer); +} + +capi_return_t tiledb_deserialize_array_delete_fragments_list_request( + tiledb_ctx_t* ctx, + tiledb_serialization_type_t serialize_type, + const tiledb_buffer_t* buffer) noexcept { + return api_entry< + tiledb::api::tiledb_deserialize_array_delete_fragments_list_request>( + ctx, serialize_type, buffer); +} + int32_t tiledb_serialize_array_metadata( tiledb_ctx_t* ctx, const tiledb_array_t* array, diff --git a/tiledb/sm/c_api/tiledb.h b/tiledb/sm/c_api/tiledb.h index 40418d6e682..34b9cc66a1d 100644 --- a/tiledb/sm/c_api/tiledb.h +++ b/tiledb/sm/c_api/tiledb.h @@ -2954,14 +2954,40 @@ TILEDB_EXPORT int32_t tiledb_array_get_open_timestamp_end( * @param timestamp_end The epoch timestamp in milliseconds. Use UINT64_MAX for * the current timestamp. * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + * + * @note This function was deprecated in release 2.18 in favor of + * tiledb_array_delete_fragments_v2. */ -TILEDB_EXPORT int32_t tiledb_array_delete_fragments( +TILEDB_DEPRECATED_EXPORT int32_t tiledb_array_delete_fragments( tiledb_ctx_t* ctx, tiledb_array_t* array, const char* uri, uint64_t timestamp_start, uint64_t timestamp_end) TILEDB_NOEXCEPT; +/** + * Deletes array fragments written between the input timestamps. + * + * **Example:** + * + * @code{.c} + * tiledb_array_delete_fragments_v2( + * ctx, "hdfs:///temp/my_array", 0, UINT64_MAX); + * @endcode + * + * @param ctx The TileDB context. + * @param uri_str The URI of the fragments' parent Array. + * @param timestamp_start The epoch timestamp in milliseconds. + * @param timestamp_end The epoch timestamp in milliseconds. Use UINT64_MAX for + * the current timestamp. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_array_delete_fragments_v2( + tiledb_ctx_t* ctx, + const char* uri_str, + uint64_t timestamp_start, + uint64_t timestamp_end) TILEDB_NOEXCEPT; + /** * Deletes array fragments with the input uris. * @@ -2976,14 +3002,14 @@ TILEDB_EXPORT int32_t tiledb_array_delete_fragments( * @endcode * * @param ctx The TileDB context. - * @param uri The URI of the fragments' parent Array. + * @param uri_str The URI of the fragments' parent Array. * @param fragment_uris The URIs of the fragments to be deleted. * @param num_fragments The number of fragments to be deleted. * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. */ TILEDB_EXPORT int32_t tiledb_array_delete_fragments_list( tiledb_ctx_t* ctx, - const char* array_uri, + const char* uri_str, const char* fragment_uris[], const size_t num_fragments) TILEDB_NOEXCEPT; diff --git a/tiledb/sm/c_api/tiledb_serialization.h b/tiledb/sm/c_api/tiledb_serialization.h index 9c9b72cd3b9..3c0ab674be8 100644 --- a/tiledb/sm/c_api/tiledb_serialization.h +++ b/tiledb/sm/c_api/tiledb_serialization.h @@ -431,6 +431,34 @@ TILEDB_EXPORT int32_t tiledb_serialize_array_max_buffer_sizes( tiledb_serialization_type_t serialize_type, tiledb_buffer_t** buffer) TILEDB_NOEXCEPT; +/** + * Deserializes a delete fragments request from the given buffer. + * + * @param ctx The TileDB context. + * @param serialization_type Type of serialization to use + * @param buffer Buffer containing serialized fragment timestamps. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT +capi_return_t tiledb_deserialize_array_delete_fragments_timestamps_request( + tiledb_ctx_t* ctx, + tiledb_serialization_type_t serialization_type, + const tiledb_buffer_t* buffer) TILEDB_NOEXCEPT; + +/** + * Deserializes a delete fragments list request from the given buffer. + * + * @param ctx The TileDB context. + * @param serialization_type Type of serialization to use + * @param buffer Buffer containing serialized fragments list. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT +capi_return_t tiledb_deserialize_array_delete_fragments_list_request( + tiledb_ctx_t* ctx, + tiledb_serialization_type_t serialization_type, + const tiledb_buffer_t* buffer) TILEDB_NOEXCEPT; + /** * Serializes the array metadata into the given buffer. * diff --git a/tiledb/sm/cpp_api/array.h b/tiledb/sm/cpp_api/array.h index afbac617374..b11d0b9af4d 100644 --- a/tiledb/sm/cpp_api/array.h +++ b/tiledb/sm/cpp_api/array.h @@ -354,17 +354,36 @@ class Array { * @param timestamp_end The epoch end timestamp in milliseconds. Use * UINT64_MAX for the current timestamp. */ + TILEDB_DEPRECATED void delete_fragments( const std::string& uri, uint64_t timestamp_start, uint64_t timestamp_end) const { + throw std::logic_error( + "This method is deprecated. Please use " + "Array::delete_fragments(ctx, uri, timestamp_start, timestamp_end)"); auto& ctx = ctx_.get(); - ctx.handle_error(tiledb_array_delete_fragments( - ctx.ptr().get(), - array_.get(), - uri.c_str(), - timestamp_start, - timestamp_end)); + ctx.handle_error(tiledb_array_delete_fragments_v2( + ctx.ptr().get(), uri.c_str(), timestamp_start, timestamp_end)); + } + + /** + * Deletes the fragments written between the input timestamps of an array + * with the input uri. + * + * @param ctx TileDB context + * @param uri The URI of the fragments' parent Array. + * @param timestamp_start The epoch start timestamp in milliseconds. + * @param timestamp_end The epoch end timestamp in milliseconds. Use + * UINT64_MAX for the current timestamp. + */ + static void delete_fragments( + const Context& ctx, + const std::string& uri, + uint64_t timestamp_start, + uint64_t timestamp_end) { + ctx.handle_error(tiledb_array_delete_fragments_v2( + ctx.ptr().get(), uri.c_str(), timestamp_start, timestamp_end)); } /** diff --git a/tiledb/sm/rest/rest_client.cc b/tiledb/sm/rest/rest_client.cc index a9c7aa6c68c..e4d44ac8050 100644 --- a/tiledb/sm/rest/rest_client.cc +++ b/tiledb/sm/rest/rest_client.cc @@ -40,6 +40,7 @@ #include "tiledb/sm/serialization/consolidation.h" #include "tiledb/sm/serialization/enumeration.h" #include "tiledb/sm/serialization/fragment_info.h" +#include "tiledb/sm/serialization/fragments.h" #include "tiledb/sm/serialization/group.h" #include "tiledb/sm/serialization/query.h" #include "tiledb/sm/serialization/tiledb-rest.h" @@ -345,6 +346,71 @@ void RestClient::delete_array_from_rest(const URI& uri) { stats_, url, serialization_type_, &returned_data, cache_key)); } +void RestClient::delete_fragments_from_rest( + const URI& uri, uint64_t timestamp_start, uint64_t timestamp_end) { + Buffer buff; + serialization::fragments_timestamps_serialize( + uri.to_string(), + timestamp_start, + timestamp_end, + serialization_type_, + &buff); + // Wrap in a list + BufferList serialized; + throw_if_not_ok(serialized.add_buffer(std::move(buff))); + + // Init curl and form the URL + Curl curlc(logger_); + std::string array_ns, array_uri; + throw_if_not_ok(uri.get_rest_components(&array_ns, &array_uri)); + const std::string cache_key = array_ns + ":" + array_uri; + throw_if_not_ok( + curlc.init(config_, extra_headers_, &redirect_meta_, &redirect_mtx_)); + const std::string url = redirect_uri(cache_key) + "/v1/arrays/" + array_ns + + "/" + curlc.url_escape(array_uri) + + "/delete_fragments"; + + Buffer returned_data; + throw_if_not_ok(curlc.post_data( + stats_, + url, + serialization_type_, + &serialized, + &returned_data, + cache_key)); +} + +void RestClient::delete_fragments_list_from_rest( + const URI& uri, const std::vector& fragment_uris) { + Buffer buff; + serialization::fragments_list_serialize( + uri.to_string(), fragment_uris, serialization_type_, &buff); + // Wrap in a list + BufferList serialized; + throw_if_not_ok(serialized.add_buffer(std::move(buff))); + + // Init curl and form the URL + Curl curlc(logger_); + std::string array_ns, array_uri; + throw_if_not_ok(uri.get_rest_components(&array_ns, &array_uri)); + const std::string cache_key = array_ns + ":" + array_uri; + throw_if_not_ok( + curlc.init(config_, extra_headers_, &redirect_meta_, &redirect_mtx_)); + const std::string url = redirect_uri(cache_key) + "/v1/arrays/" + array_ns + + "/" + curlc.url_escape(array_uri) + + "/delete_fragments_list"; + + // Post query to rest + Buffer returned_data; + throw_if_not_ok(curlc.post_data( + stats_, + url, + serialization_type_, + &serialized, + &returned_data, + cache_key)); +} + Status RestClient::deregister_array_from_rest(const URI& uri) { // Init curl and form the URL Curl curlc(logger_); @@ -1440,6 +1506,17 @@ void RestClient::delete_array_from_rest(const URI&) { Status_RestError("Cannot use rest client; serialization not enabled.")); } +void RestClient::delete_fragments_from_rest(const URI&, uint64_t, uint64_t) { + throw StatusException( + Status_RestError("Cannot use rest client; serialization not enabled.")); +} + +void RestClient::delete_fragments_list_from_rest( + const URI&, const std::vector&) { + throw StatusException( + Status_RestError("Cannot use rest client; serialization not enabled.")); +} + Status RestClient::deregister_array_from_rest(const URI&) { return LOG_STATUS( Status_RestError("Cannot use rest client; serialization not enabled.")); diff --git a/tiledb/sm/rest/rest_client.h b/tiledb/sm/rest/rest_client.h index 99c1eb6ed22..c02d84584f9 100644 --- a/tiledb/sm/rest/rest_client.h +++ b/tiledb/sm/rest/rest_client.h @@ -5,7 +5,7 @@ * * The MIT License * - * @copyright Copyright (c) 2018-2021 TileDB, Inc. + * @copyright Copyright (c) 2018-2023 TileDB, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -127,6 +127,31 @@ class RestClient { */ void delete_array_from_rest(const URI& uri); + /** + * Deletes the fragments written between the given timestamps from the array + * at the given URI from the REST server. + * + * @param uri Array URI to delete fragments from + * @param timestamp_start The start timestamp at which to delete fragments + * @param timestamp_end The end timestamp at which to delete fragments + * + * #TODO Implement API endpoint on TileDBCloud. + */ + void delete_fragments_from_rest( + const URI& uri, uint64_t timestamp_start, uint64_t timestamp_end); + + /** + * Deletes the fragments with the given URIs from the array at the given URI + * from the REST server. + * + * @param uri Array URI to delete fragments from + * @param fragment_uris The uris of the fragments to be deleted + * + * #TODO Implement API endpoint on TileDBCloud. + */ + void delete_fragments_list_from_rest( + const URI& uri, const std::vector& fragment_uris); + /** * Deregisters an array at the given URI from the REST server. * diff --git a/tiledb/sm/serialization/array.cc b/tiledb/sm/serialization/array.cc index f73fb212a86..a1b632addcc 100644 --- a/tiledb/sm/serialization/array.cc +++ b/tiledb/sm/serialization/array.cc @@ -58,6 +58,13 @@ namespace tiledb { namespace sm { namespace serialization { +class ArraySerializationException : public StatusException { + public: + explicit ArraySerializationException(const std::string& message) + : StatusException("[TileDB::Serialization][Array]", message) { + } +}; + #ifdef TILEDB_SERIALIZATION Status metadata_to_capnp( @@ -697,7 +704,7 @@ Status array_serialize(Array*, SerializationType, Buffer*, const bool) { Status array_deserialize( Array*, SerializationType, const Buffer&, StorageManager*) { return LOG_STATUS(Status_SerializationError( - "Cannot serialize; serialization not enabled.")); + "Cannot deserialize; serialization not enabled.")); } Status array_open_serialize(const Array&, SerializationType, Buffer*) { @@ -717,7 +724,7 @@ Status metadata_serialize(Metadata*, SerializationType, Buffer*) { Status metadata_deserialize(Metadata*, SerializationType, const Buffer&) { return LOG_STATUS(Status_SerializationError( - "Cannot serialize; serialization not enabled.")); + "Cannot deserialize; serialization not enabled.")); } #endif // TILEDB_SERIALIZATION diff --git a/tiledb/sm/serialization/array.h b/tiledb/sm/serialization/array.h index b8c6b03dfcd..bef9d5143de 100644 --- a/tiledb/sm/serialization/array.h +++ b/tiledb/sm/serialization/array.h @@ -5,7 +5,7 @@ * * The MIT License * - * @copyright Copyright (c) 2022 TileDB, Inc. + * @copyright Copyright (c) 2023 TileDB, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/tiledb/sm/serialization/fragments.cc b/tiledb/sm/serialization/fragments.cc new file mode 100644 index 00000000000..d3b4f2160c6 --- /dev/null +++ b/tiledb/sm/serialization/fragments.cc @@ -0,0 +1,332 @@ +/** + * @file fragments.cc + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2023 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file declares serialization functions for fragments. + */ + +// clang-format off +#ifdef TILEDB_SERIALIZATION +#include +#include +#include +#include "tiledb/sm/serialization/capnp_utils.h" +#endif +// clang-format on + +#include + +#include "tiledb/common/common.h" +#include "tiledb/sm/enums/serialization_type.h" +#include "tiledb/sm/serialization/fragments.h" + +using namespace tiledb::common; + +namespace tiledb::sm::serialization { + +class FragmentsSerializationException : public StatusException { + public: + explicit FragmentsSerializationException(const std::string& message) + : StatusException("[TileDB::Serialization][Fragments]", message) { + } +}; + +#ifdef TILEDB_SERIALIZATION +void fragments_timestamps_to_capnp( + std::string uri, + uint64_t start_timestamp, + uint64_t end_timestamp, + capnp::ArrayDeleteFragmentsTimestampsRequest::Builder* builder) { + builder->setUri(uri); + builder->setStartTimestamp(start_timestamp); + builder->setEndTimestamp(end_timestamp); +} + +std::tuple fragments_timestamps_from_capnp( + const capnp::ArrayDeleteFragmentsTimestampsRequest::Reader& reader) { + return { + reader.getUri().cStr(), + reader.getStartTimestamp(), + reader.getEndTimestamp()}; +} + +void fragments_timestamps_serialize( + std::string uri, + uint64_t start_timestamp, + uint64_t end_timestamp, + SerializationType serialize_type, + Buffer* serialized_buffer) { + try { + // Serialize + ::capnp::MallocMessageBuilder message; + auto builder = + message.initRoot(); + fragments_timestamps_to_capnp( + uri, start_timestamp, end_timestamp, &builder); + + // Copy to buffer + serialized_buffer->reset_size(); + serialized_buffer->reset_offset(); + switch (serialize_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + kj::String capnp_json = json.encode(builder); + const auto json_len = capnp_json.size(); + const char nul = '\0'; + // size does not include needed null terminator, so add +1 + throw_if_not_ok(serialized_buffer->realloc(json_len + 1)); + throw_if_not_ok(serialized_buffer->write(capnp_json.cStr(), json_len)); + throw_if_not_ok(serialized_buffer->write(&nul, 1)); + break; + } + case SerializationType::CAPNP: { + kj::Array<::capnp::word> protomessage = messageToFlatArray(message); + kj::ArrayPtr message_chars = protomessage.asChars(); + const auto nbytes = message_chars.size(); + throw_if_not_ok(serialized_buffer->realloc(nbytes)); + throw_if_not_ok( + serialized_buffer->write(message_chars.begin(), nbytes)); + break; + } + default: { + throw FragmentsSerializationException( + "[fragments_timestamps_serialize] Unknown serialization type " + "passed"); + } + } + + } catch (kj::Exception& e) { + throw FragmentsSerializationException( + "[fragments_timestamps_serialize] kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw FragmentsSerializationException( + "[fragments_timestamps_serialize] exception " + std::string(e.what())); + } +} + +std::tuple fragments_timestamps_deserialize( + SerializationType serialize_type, const Buffer& serialized_buffer) { + try { + switch (serialize_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + ::capnp::MallocMessageBuilder message_builder; + auto builder = + message_builder + .initRoot(); + json.decode( + kj::StringPtr(static_cast(serialized_buffer.data())), + builder); + auto reader = builder.asReader(); + // Deserialize + return fragments_timestamps_from_capnp(reader); + } + case SerializationType::CAPNP: { + const auto mBytes = + reinterpret_cast(serialized_buffer.data()); + ::capnp::FlatArrayMessageReader msg_reader(kj::arrayPtr( + reinterpret_cast(mBytes), + serialized_buffer.size() / sizeof(::capnp::word))); + auto reader = + msg_reader.getRoot(); + // Deserialize + return fragments_timestamps_from_capnp(reader); + } + default: { + throw FragmentsSerializationException( + "[fragments_timestamps_deserialize] " + "Unknown serialization type passed"); + } + } + } catch (kj::Exception& e) { + throw FragmentsSerializationException( + "[fragments_timestamps_deserialize] kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw FragmentsSerializationException( + "[fragments_timestamps_deserialize] exception " + + std::string(e.what())); + } +} + +void fragments_list_to_capnp( + std::string uri, + const std::vector& fragments, + capnp::ArrayDeleteFragmentsListRequest::Builder* builder) { + builder->setUri(uri); + auto entries_builder = builder->initEntries(fragments.size()); + for (size_t i = 0; i < fragments.size(); i++) { + const auto& relative_uri = serialize_array_uri_to_relative(fragments[i]); + entries_builder.set(i, relative_uri); + } +} + +std::tuple> fragments_list_from_capnp( + const capnp::ArrayDeleteFragmentsListRequest::Reader& reader) { + auto uri = reader.getUri().cStr(); + if (reader.hasEntries()) { + std::vector fragments; + fragments.reserve(reader.getEntries().size()); + auto get_entries_reader = reader.getEntries(); + for (auto entry : get_entries_reader) { + fragments.emplace_back( + deserialize_array_uri_to_absolute(entry.cStr(), URI(uri))); + } + return {uri, fragments}; + } else { + throw FragmentsSerializationException( + "[fragments_list_from_capnp] There are no fragments to deserialize"); + } +} + +void fragments_list_serialize( + std::string uri, + const std::vector& fragments, + SerializationType serialize_type, + Buffer* serialized_buffer) { + if (fragments.empty()) { + throw FragmentsSerializationException( + "[fragments_list_serialize] Fragments vector is empty"); + } + + try { + // Serialize + ::capnp::MallocMessageBuilder message; + auto builder = message.initRoot(); + fragments_list_to_capnp(uri, fragments, &builder); + + // Copy to buffer + serialized_buffer->reset_size(); + serialized_buffer->reset_offset(); + switch (serialize_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + kj::String capnp_json = json.encode(builder); + const auto json_len = capnp_json.size(); + const char nul = '\0'; + // size does not include needed null terminator, so add +1 + throw_if_not_ok(serialized_buffer->realloc(json_len + 1)); + throw_if_not_ok(serialized_buffer->write(capnp_json.cStr(), json_len)); + throw_if_not_ok(serialized_buffer->write(&nul, 1)); + break; + } + case SerializationType::CAPNP: { + kj::Array<::capnp::word> protomessage = messageToFlatArray(message); + kj::ArrayPtr message_chars = protomessage.asChars(); + const auto nbytes = message_chars.size(); + throw_if_not_ok(serialized_buffer->realloc(nbytes)); + throw_if_not_ok( + serialized_buffer->write(message_chars.begin(), nbytes)); + break; + } + default: { + throw FragmentsSerializationException( + "[fragments_list_serialize] Unknown serialization type passed"); + } + } + + } catch (kj::Exception& e) { + throw FragmentsSerializationException( + "[fragments_list_serialize] kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw FragmentsSerializationException( + "[fragments_list_serialize] exception " + std::string(e.what())); + } +} + +std::tuple> fragments_list_deserialize( + SerializationType serialize_type, const Buffer& serialized_buffer) { + try { + switch (serialize_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + ::capnp::MallocMessageBuilder message_builder; + auto builder = + message_builder.initRoot(); + json.decode( + kj::StringPtr(static_cast(serialized_buffer.data())), + builder); + auto reader = builder.asReader(); + // Deserialize + return fragments_list_from_capnp(reader); + } + case SerializationType::CAPNP: { + const auto mBytes = + reinterpret_cast(serialized_buffer.data()); + ::capnp::FlatArrayMessageReader msg_reader(kj::arrayPtr( + reinterpret_cast(mBytes), + serialized_buffer.size() / sizeof(::capnp::word))); + auto reader = + msg_reader.getRoot(); + // Deserialize + return fragments_list_from_capnp(reader); + } + default: { + throw FragmentsSerializationException( + "[fragments_list_deserialize] Unknown serialization type passed"); + } + } + } catch (kj::Exception& e) { + throw FragmentsSerializationException( + "[fragments_list_deserialize] kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw FragmentsSerializationException( + "[fragments_list_deserialize] exception " + std::string(e.what())); + } +} + +#else +void fragments_timestamps_serialize( + std::string, uint64_t, uint64_t, SerializationType, Buffer*) { + throw FragmentsSerializationException( + "Cannot serialize; serialization not enabled."); +} + +std::tuple fragments_timestamps_deserialize( + SerializationType, const Buffer&) { + throw FragmentsSerializationException( + "Cannot deserialize; serialization not enabled."); +} + +void fragments_list_serialize( + std::string, const std::vector&, SerializationType, Buffer*) { + throw FragmentsSerializationException( + "Cannot serialize; serialization not enabled."); +} + +std::tuple> fragments_list_deserialize( + SerializationType, const Buffer&) { + throw FragmentsSerializationException( + "Cannot deserialize; serialization not enabled."); +} + +#endif // TILEDB_SERIALIZATION +} // namespace tiledb::sm::serialization diff --git a/tiledb/sm/serialization/fragments.h b/tiledb/sm/serialization/fragments.h new file mode 100644 index 00000000000..e4cd66534a7 --- /dev/null +++ b/tiledb/sm/serialization/fragments.h @@ -0,0 +1,119 @@ +/** + * @file fragments.h + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2023 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file declares serialization functions for fragments. + */ + +#ifndef TILEDB_SERIALIZATION_FRAGMENTS_H +#define TILEDB_SERIALIZATION_FRAGMENTS_H + +#ifdef TILEDB_SERIALIZATION +#include "tiledb/sm/serialization/capnp_utils.h" +#endif + +#include "tiledb/sm/buffer/buffer.h" +#include "tiledb/sm/filesystem/uri.h" + +using namespace tiledb::common; +namespace tiledb::sm { + +class Buffer; +enum class SerializationType : uint8_t; + +namespace serialization { + +#ifdef TILEDB_SERIALIZATION +/** + * Convert ArrayDeleteFragmentsTimestampsRequest to Cap'n Proto message + * + * @param uri the URI of the fragments' parent array + * @param start_timestamp the start timestamp to serialize + * @param end_timestamp the end timestamp to serialize + * @param builder cap'n proto class + */ +void fragments_timestamps_to_capnp( + std::string uri, + uint64_t start_timestamp, + uint64_t end_timestamp, + capnp::ArrayDeleteFragmentsTimestampsRequest::Builder* builder); + +/** + * Convert Cap'n Proto message to ArrayDeleteFragmentsTimestampsRequest + * + * @param reader cap'n proto class + * @return a tuple of uri, start_timestamp, end_timestamp + */ +std::tuple fragments_timestamps_from_capnp( + const capnp::ArrayDeleteFragmentsTimestampsRequest::Reader& reader); + +/** + * Convert ArrayDeleteFragmentsListRequest to Cap'n Proto message + * + * @param uri the URI of the fragments' parent array + * @param fragments fragments to serialize + * @param builder cap'n proto class + */ +void fragments_list_to_capnp( + std::string uri, + const std::vector& fragments, + capnp::ArrayDeleteFragmentsListRequest::Builder* builder); + +/** + * Convert Cap'n Proto message to ArrayDeleteFragmentsListRequest + * + * @param reader cap'n proto class + * @return a tuple of uri, vector of deserialized fragments + */ +std::tuple> fragments_list_from_capnp( + const capnp::ArrayDeleteFragmentsListRequest::Reader& reader); +#endif + +void fragments_timestamps_serialize( + std::string uri, + uint64_t start_timestamp, + uint64_t end_timestamp, + SerializationType serialize_type, + Buffer* serialized_buffer); + +std::tuple fragments_timestamps_deserialize( + SerializationType serialize_type, const Buffer& serialized_buffer); + +void fragments_list_serialize( + std::string uri, + const std::vector& fragments, + SerializationType serialize_type, + Buffer* serialized_buffer); + +std::tuple> fragments_list_deserialize( + SerializationType serialize_type, const Buffer& serialized_buffer); + +} // namespace serialization +} // namespace tiledb::sm + +#endif // TILEDB_SERIALIZATION_FRAGMENTS_H diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ index 5c65cfd934f..85f93c51297 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ @@ -9247,6 +9247,151 @@ const ::capnp::_::RawSchema s_cd8abc9dabc4b03f = { 0, 2, i_cd8abc9dabc4b03f, nullptr, nullptr, { &s_cd8abc9dabc4b03f, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<55> b_cfea684b4bcd0721 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 33, 7, 205, 75, 75, 104, 234, 207, + 18, 0, 0, 0, 1, 0, 0, 0, + 127, 216, 135, 181, 36, 146, 125, 181, + 2, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 146, 1, 0, 0, + 45, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 41, 0, 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 116, 105, 108, 101, 100, 98, 45, 114, + 101, 115, 116, 46, 99, 97, 112, 110, + 112, 58, 65, 114, 114, 97, 121, 68, + 101, 108, 101, 116, 101, 70, 114, 97, + 103, 109, 101, 110, 116, 115, 76, 105, + 115, 116, 82, 101, 113, 117, 101, 115, + 116, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 8, 0, 0, 0, 3, 0, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 41, 0, 0, 0, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 0, 0, 3, 0, 1, 0, + 48, 0, 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 45, 0, 0, 0, 66, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 0, 0, 0, 3, 0, 1, 0, + 68, 0, 0, 0, 2, 0, 1, 0, + 117, 114, 105, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 101, 110, 116, 114, 105, 101, 115, 0, + 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, 1, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, } +}; +::capnp::word const* const bp_cfea684b4bcd0721 = b_cfea684b4bcd0721.words; +#if !CAPNP_LITE +static const uint16_t m_cfea684b4bcd0721[] = {1, 0}; +static const uint16_t i_cfea684b4bcd0721[] = {0, 1}; +const ::capnp::_::RawSchema s_cfea684b4bcd0721 = { + 0xcfea684b4bcd0721, b_cfea684b4bcd0721.words, 55, nullptr, m_cfea684b4bcd0721, + 0, 2, i_cfea684b4bcd0721, nullptr, nullptr, { &s_cfea684b4bcd0721, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<68> b_aaeeafe1e9f3ea1c = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 28, 234, 243, 233, 225, 175, 238, 170, + 18, 0, 0, 0, 1, 0, 2, 0, + 127, 216, 135, 181, 36, 146, 125, 181, + 1, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 194, 1, 0, 0, + 45, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 41, 0, 0, 0, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 116, 105, 108, 101, 100, 98, 45, 114, + 101, 115, 116, 46, 99, 97, 112, 110, + 112, 58, 65, 114, 114, 97, 121, 68, + 101, 108, 101, 116, 101, 70, 114, 97, + 103, 109, 101, 110, 116, 115, 84, 105, + 109, 101, 115, 116, 97, 109, 112, 115, + 82, 101, 113, 117, 101, 115, 116, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 12, 0, 0, 0, 3, 0, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 69, 0, 0, 0, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 3, 0, 1, 0, + 76, 0, 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 73, 0, 0, 0, 122, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 3, 0, 1, 0, + 84, 0, 0, 0, 2, 0, 1, 0, + 2, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 0, 0, 106, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 3, 0, 1, 0, + 92, 0, 0, 0, 2, 0, 1, 0, + 117, 114, 105, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 115, 116, 97, 114, 116, 84, 105, 109, + 101, 115, 116, 97, 109, 112, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 101, 110, 100, 84, 105, 109, 101, 115, + 116, 97, 109, 112, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, } +}; +::capnp::word const* const bp_aaeeafe1e9f3ea1c = b_aaeeafe1e9f3ea1c.words; +#if !CAPNP_LITE +static const uint16_t m_aaeeafe1e9f3ea1c[] = {2, 1, 0}; +static const uint16_t i_aaeeafe1e9f3ea1c[] = {0, 1, 2}; +const ::capnp::_::RawSchema s_aaeeafe1e9f3ea1c = { + 0xaaeeafe1e9f3ea1c, b_aaeeafe1e9f3ea1c.words, 68, nullptr, m_aaeeafe1e9f3ea1c, + 0, 3, i_aaeeafe1e9f3ea1c, nullptr, nullptr, { &s_aaeeafe1e9f3ea1c, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE static const ::capnp::_::AlignedData<35> b_f5a35661031194d2 = { { 0, 0, 0, 0, 5, 0, 6, 0, 210, 148, 17, 3, 97, 86, 163, 245, @@ -10109,6 +10254,22 @@ constexpr ::capnp::Kind BufferedChunk::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* BufferedChunk::_capnpPrivate::schema; #endif // !CAPNP_LITE +// ArrayDeleteFragmentsListRequest +constexpr uint16_t ArrayDeleteFragmentsListRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t ArrayDeleteFragmentsListRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind ArrayDeleteFragmentsListRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* ArrayDeleteFragmentsListRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + +// ArrayDeleteFragmentsTimestampsRequest +constexpr uint16_t ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + // ArrayConsolidationRequest constexpr uint16_t ArrayConsolidationRequest::_capnpPrivate::dataWordSize; constexpr uint16_t ArrayConsolidationRequest::_capnpPrivate::pointerCount; diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h index c37be3659e9..b4a8dc1e9bd 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h @@ -95,6 +95,8 @@ CAPNP_DECLARE_SCHEMA(d492b6734d5e3bf5); CAPNP_DECLARE_SCHEMA(bde8ebd7b13d8625); CAPNP_DECLARE_SCHEMA(a736c51d292ca752); CAPNP_DECLARE_SCHEMA(cd8abc9dabc4b03f); +CAPNP_DECLARE_SCHEMA(cfea684b4bcd0721); +CAPNP_DECLARE_SCHEMA(aaeeafe1e9f3ea1c); CAPNP_DECLARE_SCHEMA(f5a35661031194d2); CAPNP_DECLARE_SCHEMA(e68edfc0939e63df); CAPNP_DECLARE_SCHEMA(891a70a671f15cf6); @@ -1540,6 +1542,40 @@ struct BufferedChunk { }; }; +struct ArrayDeleteFragmentsListRequest { + ArrayDeleteFragmentsListRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(cfea684b4bcd0721, 0, 2) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + +struct ArrayDeleteFragmentsTimestampsRequest { + ArrayDeleteFragmentsTimestampsRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(aaeeafe1e9f3ea1c, 2, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + struct ArrayConsolidationRequest { ArrayConsolidationRequest() = delete; @@ -13885,6 +13921,228 @@ class BufferedChunk::Pipeline { }; #endif // !CAPNP_LITE +class ArrayDeleteFragmentsListRequest::Reader { + public: + typedef ArrayDeleteFragmentsListRequest Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base) + : _reader(base) { + } + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); + } +#endif // !CAPNP_LITE + + inline bool hasUri() const; + inline ::capnp::Text::Reader getUri() const; + + inline bool hasEntries() const; + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader getEntries() + const; + + private: + ::capnp::_::StructReader _reader; + template + friend struct ::capnp::ToDynamic_; + template + friend struct ::capnp::_::PointerHelpers; + template + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class ArrayDeleteFragmentsListRequest::Builder { + public: + typedef ArrayDeleteFragmentsListRequest Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) { + } + inline explicit Builder(::capnp::_::StructBuilder base) + : _builder(base) { + } + inline operator Reader() const { + return Reader(_builder.asReader()); + } + inline Reader asReader() const { + return *this; + } + + inline ::capnp::MessageSize totalSize() const { + return asReader().totalSize(); + } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return asReader().toString(); + } +#endif // !CAPNP_LITE + + inline bool hasUri(); + inline ::capnp::Text::Builder getUri(); + inline void setUri(::capnp::Text::Reader value); + inline ::capnp::Text::Builder initUri(unsigned int size); + inline void adoptUri(::capnp::Orphan<::capnp::Text>&& value); + inline ::capnp::Orphan<::capnp::Text> disownUri(); + + inline bool hasEntries(); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder + getEntries(); + inline void setEntries( + ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader value); + inline void setEntries(::kj::ArrayPtr value); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder initEntries( + unsigned int size); + inline void adoptEntries( + ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>&& + value); + inline ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>> + disownEntries(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class ArrayDeleteFragmentsListRequest::Pipeline { + public: + typedef ArrayDeleteFragmentsListRequest Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class ArrayDeleteFragmentsTimestampsRequest::Reader { + public: + typedef ArrayDeleteFragmentsTimestampsRequest Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base) + : _reader(base) { + } + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); + } +#endif // !CAPNP_LITE + + inline bool hasUri() const; + inline ::capnp::Text::Reader getUri() const; + + inline ::uint64_t getStartTimestamp() const; + + inline ::uint64_t getEndTimestamp() const; + + private: + ::capnp::_::StructReader _reader; + template + friend struct ::capnp::ToDynamic_; + template + friend struct ::capnp::_::PointerHelpers; + template + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class ArrayDeleteFragmentsTimestampsRequest::Builder { + public: + typedef ArrayDeleteFragmentsTimestampsRequest Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) { + } + inline explicit Builder(::capnp::_::StructBuilder base) + : _builder(base) { + } + inline operator Reader() const { + return Reader(_builder.asReader()); + } + inline Reader asReader() const { + return *this; + } + + inline ::capnp::MessageSize totalSize() const { + return asReader().totalSize(); + } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return asReader().toString(); + } +#endif // !CAPNP_LITE + + inline bool hasUri(); + inline ::capnp::Text::Builder getUri(); + inline void setUri(::capnp::Text::Reader value); + inline ::capnp::Text::Builder initUri(unsigned int size); + inline void adoptUri(::capnp::Orphan<::capnp::Text>&& value); + inline ::capnp::Orphan<::capnp::Text> disownUri(); + + inline ::uint64_t getStartTimestamp(); + inline void setStartTimestamp(::uint64_t value); + + inline ::uint64_t getEndTimestamp(); + inline void setEndTimestamp(::uint64_t value); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class ArrayDeleteFragmentsTimestampsRequest::Pipeline { + public: + typedef ArrayDeleteFragmentsTimestampsRequest Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + class ArrayConsolidationRequest::Reader { public: typedef ArrayConsolidationRequest Reads; @@ -30463,6 +30721,180 @@ inline void BufferedChunk::Builder::setSize(::uint64_t value) { ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); } +inline bool ArrayDeleteFragmentsListRequest::Reader::hasUri() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool ArrayDeleteFragmentsListRequest::Builder::hasUri() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::Text::Reader ArrayDeleteFragmentsListRequest::Reader::getUri() + const { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder +ArrayDeleteFragmentsListRequest::Builder::getUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void ArrayDeleteFragmentsListRequest::Builder::setUri( + ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers<::capnp::Text>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::Text::Builder ArrayDeleteFragmentsListRequest::Builder::initUri( + unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::Text>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void ArrayDeleteFragmentsListRequest::Builder::adoptUri( + ::capnp::Orphan<::capnp::Text>&& value) { + ::capnp::_::PointerHelpers<::capnp::Text>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::Text> +ArrayDeleteFragmentsListRequest::Builder::disownUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool ArrayDeleteFragmentsListRequest::Reader::hasEntries() const { + return !_reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline bool ArrayDeleteFragmentsListRequest::Builder::hasEntries() { + return !_builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader +ArrayDeleteFragmentsListRequest::Reader::getEntries() const { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::get( + _reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder +ArrayDeleteFragmentsListRequest::Builder::getEntries() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::get( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void ArrayDeleteFragmentsListRequest::Builder::setEntries( + ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader value) { + ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::set( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + value); +} +inline void ArrayDeleteFragmentsListRequest::Builder::setEntries( + ::kj::ArrayPtr value) { + ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::set( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + value); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder +ArrayDeleteFragmentsListRequest::Builder::initEntries(unsigned int size) { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::init( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + size); +} +inline void ArrayDeleteFragmentsListRequest::Builder::adoptEntries( + ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>&& + value) { + ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::adopt( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>> +ArrayDeleteFragmentsListRequest::Builder::disownEntries() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::disown( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool ArrayDeleteFragmentsTimestampsRequest::Reader::hasUri() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool ArrayDeleteFragmentsTimestampsRequest::Builder::hasUri() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::Text::Reader +ArrayDeleteFragmentsTimestampsRequest::Reader::getUri() const { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder +ArrayDeleteFragmentsTimestampsRequest::Builder::getUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::setUri( + ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers<::capnp::Text>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::Text::Builder +ArrayDeleteFragmentsTimestampsRequest::Builder::initUri(unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::Text>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::adoptUri( + ::capnp::Orphan<::capnp::Text>&& value) { + ::capnp::_::PointerHelpers<::capnp::Text>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::Text> +ArrayDeleteFragmentsTimestampsRequest::Builder::disownUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Reader::getStartTimestamp() const { + return _reader.getDataField<::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Builder::getStartTimestamp() { + return _builder.getDataField<::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::setStartTimestamp( + ::uint64_t value) { + _builder.setDataField<::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Reader::getEndTimestamp() const { + return _reader.getDataField<::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Builder::getEndTimestamp() { + return _builder.getDataField<::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::setEndTimestamp( + ::uint64_t value) { + _builder.setDataField<::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + inline bool ArrayConsolidationRequest::Reader::hasConfig() const { return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) .isNull(); diff --git a/tiledb/sm/serialization/tiledb-rest.capnp b/tiledb/sm/serialization/tiledb-rest.capnp index 1baa767dbce..d939b2cb304 100644 --- a/tiledb/sm/serialization/tiledb-rest.capnp +++ b/tiledb/sm/serialization/tiledb-rest.capnp @@ -1199,6 +1199,17 @@ struct BufferedChunk { # the size in bytes of the intermediate chunk } +struct ArrayDeleteFragmentsListRequest { + uri @0 :Text; + entries @1 :List(Text); +} + +struct ArrayDeleteFragmentsTimestampsRequest { + uri @0 :Text; + startTimestamp @1 :UInt64; + endTimestamp @2 :UInt64; +} + struct ArrayConsolidationRequest { config @0 :Config; # Config diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ index 5c65cfd934f..85f93c51297 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ @@ -9247,6 +9247,151 @@ const ::capnp::_::RawSchema s_cd8abc9dabc4b03f = { 0, 2, i_cd8abc9dabc4b03f, nullptr, nullptr, { &s_cd8abc9dabc4b03f, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<55> b_cfea684b4bcd0721 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 33, 7, 205, 75, 75, 104, 234, 207, + 18, 0, 0, 0, 1, 0, 0, 0, + 127, 216, 135, 181, 36, 146, 125, 181, + 2, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 146, 1, 0, 0, + 45, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 41, 0, 0, 0, 119, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 116, 105, 108, 101, 100, 98, 45, 114, + 101, 115, 116, 46, 99, 97, 112, 110, + 112, 58, 65, 114, 114, 97, 121, 68, + 101, 108, 101, 116, 101, 70, 114, 97, + 103, 109, 101, 110, 116, 115, 76, 105, + 115, 116, 82, 101, 113, 117, 101, 115, + 116, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 8, 0, 0, 0, 3, 0, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 41, 0, 0, 0, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 0, 0, 3, 0, 1, 0, + 48, 0, 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 45, 0, 0, 0, 66, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 0, 0, 0, 3, 0, 1, 0, + 68, 0, 0, 0, 2, 0, 1, 0, + 117, 114, 105, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 101, 110, 116, 114, 105, 101, 115, 0, + 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, 1, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, } +}; +::capnp::word const* const bp_cfea684b4bcd0721 = b_cfea684b4bcd0721.words; +#if !CAPNP_LITE +static const uint16_t m_cfea684b4bcd0721[] = {1, 0}; +static const uint16_t i_cfea684b4bcd0721[] = {0, 1}; +const ::capnp::_::RawSchema s_cfea684b4bcd0721 = { + 0xcfea684b4bcd0721, b_cfea684b4bcd0721.words, 55, nullptr, m_cfea684b4bcd0721, + 0, 2, i_cfea684b4bcd0721, nullptr, nullptr, { &s_cfea684b4bcd0721, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<68> b_aaeeafe1e9f3ea1c = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 28, 234, 243, 233, 225, 175, 238, 170, + 18, 0, 0, 0, 1, 0, 2, 0, + 127, 216, 135, 181, 36, 146, 125, 181, + 1, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 194, 1, 0, 0, + 45, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 41, 0, 0, 0, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 116, 105, 108, 101, 100, 98, 45, 114, + 101, 115, 116, 46, 99, 97, 112, 110, + 112, 58, 65, 114, 114, 97, 121, 68, + 101, 108, 101, 116, 101, 70, 114, 97, + 103, 109, 101, 110, 116, 115, 84, 105, + 109, 101, 115, 116, 97, 109, 112, 115, + 82, 101, 113, 117, 101, 115, 116, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 12, 0, 0, 0, 3, 0, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 69, 0, 0, 0, 34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 3, 0, 1, 0, + 76, 0, 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 73, 0, 0, 0, 122, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 3, 0, 1, 0, + 84, 0, 0, 0, 2, 0, 1, 0, + 2, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 0, 0, 106, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 3, 0, 1, 0, + 92, 0, 0, 0, 2, 0, 1, 0, + 117, 114, 105, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 115, 116, 97, 114, 116, 84, 105, 109, + 101, 115, 116, 97, 109, 112, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 101, 110, 100, 84, 105, 109, 101, 115, + 116, 97, 109, 112, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, } +}; +::capnp::word const* const bp_aaeeafe1e9f3ea1c = b_aaeeafe1e9f3ea1c.words; +#if !CAPNP_LITE +static const uint16_t m_aaeeafe1e9f3ea1c[] = {2, 1, 0}; +static const uint16_t i_aaeeafe1e9f3ea1c[] = {0, 1, 2}; +const ::capnp::_::RawSchema s_aaeeafe1e9f3ea1c = { + 0xaaeeafe1e9f3ea1c, b_aaeeafe1e9f3ea1c.words, 68, nullptr, m_aaeeafe1e9f3ea1c, + 0, 3, i_aaeeafe1e9f3ea1c, nullptr, nullptr, { &s_aaeeafe1e9f3ea1c, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE static const ::capnp::_::AlignedData<35> b_f5a35661031194d2 = { { 0, 0, 0, 0, 5, 0, 6, 0, 210, 148, 17, 3, 97, 86, 163, 245, @@ -10109,6 +10254,22 @@ constexpr ::capnp::Kind BufferedChunk::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* BufferedChunk::_capnpPrivate::schema; #endif // !CAPNP_LITE +// ArrayDeleteFragmentsListRequest +constexpr uint16_t ArrayDeleteFragmentsListRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t ArrayDeleteFragmentsListRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind ArrayDeleteFragmentsListRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* ArrayDeleteFragmentsListRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + +// ArrayDeleteFragmentsTimestampsRequest +constexpr uint16_t ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* ArrayDeleteFragmentsTimestampsRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + // ArrayConsolidationRequest constexpr uint16_t ArrayConsolidationRequest::_capnpPrivate::dataWordSize; constexpr uint16_t ArrayConsolidationRequest::_capnpPrivate::pointerCount; diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h index c37be3659e9..b4a8dc1e9bd 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h @@ -95,6 +95,8 @@ CAPNP_DECLARE_SCHEMA(d492b6734d5e3bf5); CAPNP_DECLARE_SCHEMA(bde8ebd7b13d8625); CAPNP_DECLARE_SCHEMA(a736c51d292ca752); CAPNP_DECLARE_SCHEMA(cd8abc9dabc4b03f); +CAPNP_DECLARE_SCHEMA(cfea684b4bcd0721); +CAPNP_DECLARE_SCHEMA(aaeeafe1e9f3ea1c); CAPNP_DECLARE_SCHEMA(f5a35661031194d2); CAPNP_DECLARE_SCHEMA(e68edfc0939e63df); CAPNP_DECLARE_SCHEMA(891a70a671f15cf6); @@ -1540,6 +1542,40 @@ struct BufferedChunk { }; }; +struct ArrayDeleteFragmentsListRequest { + ArrayDeleteFragmentsListRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(cfea684b4bcd0721, 0, 2) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + +struct ArrayDeleteFragmentsTimestampsRequest { + ArrayDeleteFragmentsTimestampsRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(aaeeafe1e9f3ea1c, 2, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + struct ArrayConsolidationRequest { ArrayConsolidationRequest() = delete; @@ -13885,6 +13921,228 @@ class BufferedChunk::Pipeline { }; #endif // !CAPNP_LITE +class ArrayDeleteFragmentsListRequest::Reader { + public: + typedef ArrayDeleteFragmentsListRequest Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base) + : _reader(base) { + } + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); + } +#endif // !CAPNP_LITE + + inline bool hasUri() const; + inline ::capnp::Text::Reader getUri() const; + + inline bool hasEntries() const; + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader getEntries() + const; + + private: + ::capnp::_::StructReader _reader; + template + friend struct ::capnp::ToDynamic_; + template + friend struct ::capnp::_::PointerHelpers; + template + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class ArrayDeleteFragmentsListRequest::Builder { + public: + typedef ArrayDeleteFragmentsListRequest Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) { + } + inline explicit Builder(::capnp::_::StructBuilder base) + : _builder(base) { + } + inline operator Reader() const { + return Reader(_builder.asReader()); + } + inline Reader asReader() const { + return *this; + } + + inline ::capnp::MessageSize totalSize() const { + return asReader().totalSize(); + } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return asReader().toString(); + } +#endif // !CAPNP_LITE + + inline bool hasUri(); + inline ::capnp::Text::Builder getUri(); + inline void setUri(::capnp::Text::Reader value); + inline ::capnp::Text::Builder initUri(unsigned int size); + inline void adoptUri(::capnp::Orphan<::capnp::Text>&& value); + inline ::capnp::Orphan<::capnp::Text> disownUri(); + + inline bool hasEntries(); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder + getEntries(); + inline void setEntries( + ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader value); + inline void setEntries(::kj::ArrayPtr value); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder initEntries( + unsigned int size); + inline void adoptEntries( + ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>&& + value); + inline ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>> + disownEntries(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class ArrayDeleteFragmentsListRequest::Pipeline { + public: + typedef ArrayDeleteFragmentsListRequest Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class ArrayDeleteFragmentsTimestampsRequest::Reader { + public: + typedef ArrayDeleteFragmentsTimestampsRequest Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base) + : _reader(base) { + } + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); + } +#endif // !CAPNP_LITE + + inline bool hasUri() const; + inline ::capnp::Text::Reader getUri() const; + + inline ::uint64_t getStartTimestamp() const; + + inline ::uint64_t getEndTimestamp() const; + + private: + ::capnp::_::StructReader _reader; + template + friend struct ::capnp::ToDynamic_; + template + friend struct ::capnp::_::PointerHelpers; + template + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class ArrayDeleteFragmentsTimestampsRequest::Builder { + public: + typedef ArrayDeleteFragmentsTimestampsRequest Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) { + } + inline explicit Builder(::capnp::_::StructBuilder base) + : _builder(base) { + } + inline operator Reader() const { + return Reader(_builder.asReader()); + } + inline Reader asReader() const { + return *this; + } + + inline ::capnp::MessageSize totalSize() const { + return asReader().totalSize(); + } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return asReader().toString(); + } +#endif // !CAPNP_LITE + + inline bool hasUri(); + inline ::capnp::Text::Builder getUri(); + inline void setUri(::capnp::Text::Reader value); + inline ::capnp::Text::Builder initUri(unsigned int size); + inline void adoptUri(::capnp::Orphan<::capnp::Text>&& value); + inline ::capnp::Orphan<::capnp::Text> disownUri(); + + inline ::uint64_t getStartTimestamp(); + inline void setStartTimestamp(::uint64_t value); + + inline ::uint64_t getEndTimestamp(); + inline void setEndTimestamp(::uint64_t value); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class ArrayDeleteFragmentsTimestampsRequest::Pipeline { + public: + typedef ArrayDeleteFragmentsTimestampsRequest Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + class ArrayConsolidationRequest::Reader { public: typedef ArrayConsolidationRequest Reads; @@ -30463,6 +30721,180 @@ inline void BufferedChunk::Builder::setSize(::uint64_t value) { ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); } +inline bool ArrayDeleteFragmentsListRequest::Reader::hasUri() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool ArrayDeleteFragmentsListRequest::Builder::hasUri() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::Text::Reader ArrayDeleteFragmentsListRequest::Reader::getUri() + const { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder +ArrayDeleteFragmentsListRequest::Builder::getUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void ArrayDeleteFragmentsListRequest::Builder::setUri( + ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers<::capnp::Text>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::Text::Builder ArrayDeleteFragmentsListRequest::Builder::initUri( + unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::Text>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void ArrayDeleteFragmentsListRequest::Builder::adoptUri( + ::capnp::Orphan<::capnp::Text>&& value) { + ::capnp::_::PointerHelpers<::capnp::Text>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::Text> +ArrayDeleteFragmentsListRequest::Builder::disownUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool ArrayDeleteFragmentsListRequest::Reader::hasEntries() const { + return !_reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline bool ArrayDeleteFragmentsListRequest::Builder::hasEntries() { + return !_builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader +ArrayDeleteFragmentsListRequest::Reader::getEntries() const { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::get( + _reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder +ArrayDeleteFragmentsListRequest::Builder::getEntries() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::get( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void ArrayDeleteFragmentsListRequest::Builder::setEntries( + ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader value) { + ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::set( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + value); +} +inline void ArrayDeleteFragmentsListRequest::Builder::setEntries( + ::kj::ArrayPtr value) { + ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::set( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + value); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder +ArrayDeleteFragmentsListRequest::Builder::initEntries(unsigned int size) { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::init( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + size); +} +inline void ArrayDeleteFragmentsListRequest::Builder::adoptEntries( + ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>&& + value) { + ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::adopt( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>> +ArrayDeleteFragmentsListRequest::Builder::disownEntries() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::disown( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool ArrayDeleteFragmentsTimestampsRequest::Reader::hasUri() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool ArrayDeleteFragmentsTimestampsRequest::Builder::hasUri() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::Text::Reader +ArrayDeleteFragmentsTimestampsRequest::Reader::getUri() const { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder +ArrayDeleteFragmentsTimestampsRequest::Builder::getUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::setUri( + ::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers<::capnp::Text>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::Text::Builder +ArrayDeleteFragmentsTimestampsRequest::Builder::initUri(unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::Text>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::adoptUri( + ::capnp::Orphan<::capnp::Text>&& value) { + ::capnp::_::PointerHelpers<::capnp::Text>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::Text> +ArrayDeleteFragmentsTimestampsRequest::Builder::disownUri() { + return ::capnp::_::PointerHelpers<::capnp::Text>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Reader::getStartTimestamp() const { + return _reader.getDataField<::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Builder::getStartTimestamp() { + return _builder.getDataField<::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::setStartTimestamp( + ::uint64_t value) { + _builder.setDataField<::uint64_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Reader::getEndTimestamp() const { + return _reader.getDataField<::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} + +inline ::uint64_t +ArrayDeleteFragmentsTimestampsRequest::Builder::getEndTimestamp() { + return _builder.getDataField<::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS); +} +inline void ArrayDeleteFragmentsTimestampsRequest::Builder::setEndTimestamp( + ::uint64_t value) { + _builder.setDataField<::uint64_t>( + ::capnp::bounded<1>() * ::capnp::ELEMENTS, value); +} + inline bool ArrayConsolidationRequest::Reader::hasConfig() const { return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) .isNull();