diff --git a/test/src/unit-enumerations.cc b/test/src/unit-enumerations.cc index 7f07adb534cc..cca5a3edc0cb 100644 --- a/test/src/unit-enumerations.cc +++ b/test/src/unit-enumerations.cc @@ -598,7 +598,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( EnumerationFx, "Array - Get Enumeration Repeated", - "[enumeration][array][get-enumeration]") { + "[enumeration][array][get-enumeration][repeated]") { create_array(); auto array = get_array(QueryType::READ); auto enmr1 = array->get_enumeration("test_enmr"); @@ -606,22 +606,13 @@ TEST_CASE_METHOD( REQUIRE(enmr1 == enmr2); } -TEST_CASE_METHOD( - EnumerationFx, - "Array - Get Enumeration Error - REMOTE NOT YET SUPPORTED", - "[enumeration][array][error][get-remote]") { - std::string uri_str = "tiledb://namespace/array_name"; - auto array = make_shared(HERE(), URI(uri_str), ctx_.storage_manager()); - auto matcher = Catch::Matchers::ContainsSubstring("Array is remote"); - REQUIRE_THROWS_WITH(array->get_enumeration("something_here"), matcher); -} - TEST_CASE_METHOD( EnumerationFx, "Array - Get Enumeration Error - Not Open", "[enumeration][array][error][not-open]") { auto array = make_shared(HERE(), uri_, ctx_.storage_manager()); - REQUIRE_THROWS(array->get_enumeration("foo")); + auto matcher = Catch::Matchers::ContainsSubstring("Array is not open"); + REQUIRE_THROWS(array->get_enumeration("foo"), matcher); } TEST_CASE_METHOD( @@ -662,21 +653,12 @@ TEST_CASE_METHOD( REQUIRE(schema->is_enumeration_loaded("test_enmr") == true); } -TEST_CASE_METHOD( - EnumerationFx, - "Array - Load All Enumerations Error - REMOTE NOT YET SUPPORTED", - "[enumeration][array][error][get-remote]") { - std::string uri_str = "tiledb://namespace/array_name"; - auto array = make_shared(HERE(), URI(uri_str), ctx_.storage_manager()); - auto matcher = Catch::Matchers::ContainsSubstring("Array is remote"); - REQUIRE_THROWS_WITH(array->load_all_enumerations(), matcher); -} - TEST_CASE_METHOD( EnumerationFx, "Array - Load All Enumerations Error - Not Open", "[enumeration][array][error][not-open]") { auto array = make_shared(HERE(), uri_, ctx_.storage_manager()); + auto matcher = Catch::Matchers::ContainsSubstring("Array is not open"); REQUIRE_THROWS(array->load_all_enumerations()); } @@ -687,7 +669,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( EnumerationFx, "ArrayDirectory - Load Enumerations From Paths", - "[enumeration][array-directory][load-enumeration]") { + "[enumeration][array-directory][load-enumerations-from-paths]") { create_array(); auto schema = get_array_schema_latest(); diff --git a/tiledb/CMakeLists.txt b/tiledb/CMakeLists.txt index b161353b8485..87a6e97f3352 100644 --- a/tiledb/CMakeLists.txt +++ b/tiledb/CMakeLists.txt @@ -89,7 +89,7 @@ if (TILEDB_CPP_API) ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_evolution.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/array_schema_experimental.h - ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/as_built_experimental.h + ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/as_built_experimental.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/attribute.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/attribute_experimental.h ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/cpp_api/config.h @@ -278,6 +278,7 @@ set(TILEDB_CORE_SOURCES ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/array_schema.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/array_schema_evolution.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/config.cc + ${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/group.cc @@ -328,6 +329,7 @@ if (TILEDB_SERIALIZATION) ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/array_schema.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/array_schema_evolution.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/config.cc + ${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/group.cc @@ -347,6 +349,7 @@ if (TILEDB_SERIALIZATION) ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/array_schema.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/array_schema_evolution.cc ${TILEDB_CORE_INCLUDE_DIR}/tiledb/sm/serialization/config.cc + ${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/group.cc diff --git a/tiledb/sm/array/array.cc b/tiledb/sm/array/array.cc index 98426b4708ac..3c4edd5f0643 100644 --- a/tiledb/sm/array/array.cc +++ b/tiledb/sm/array/array.cc @@ -586,10 +586,6 @@ shared_ptr Array::get_enumeration( std::vector> Array::get_enumerations( const std::vector& enumeration_names) { - if (remote_) { - throw ArrayException("Unable to load enumerations; Array is remote."); - } - if (!is_open_) { throw ArrayException("Unable to load enumerations; Array is not open."); } @@ -600,19 +596,36 @@ std::vector> Array::get_enumerations( deduped.insert(enmr_name); } - // Create a vector of paths to be loaded. - std::vector paths_to_load; - for (auto& enmr_name : deduped) { - if (array_schema_latest_->is_enumeration_loaded(enmr_name)) { - continue; + std::vector> loaded; + + if (remote_) { + auto rest_client = resources_.rest_client(); + if (rest_client == nullptr) { + throw ArrayException( + "Error loading enumerations; " + "Remote array with no REST client."); + } + loaded = rest_client->post_enumerations_from_rest( + array_uri_, + timestamp_start_, + timestamp_end_opened_at_, + this, + enumeration_names); + } else { + // Create a vector of paths to be loaded. + std::vector paths_to_load; + for (auto& enmr_name : deduped) { + if (array_schema_latest_->is_enumeration_loaded(enmr_name)) { + continue; + } + auto path = array_schema_latest_->get_enumeration_path_name(enmr_name); + paths_to_load.push_back(path); } - auto path = array_schema_latest_->get_enumeration_path_name(enmr_name); - paths_to_load.push_back(path); - } - // Load the enumerations from storage - auto loaded = array_dir_.load_enumerations_from_paths( - paths_to_load, get_encryption_key()); + // Load the enumerations from storage + loaded = array_dir_.load_enumerations_from_paths( + paths_to_load, get_encryption_key()); + } // Store the loaded enumerations in the schema for (auto& enmr : loaded) { @@ -628,10 +641,6 @@ std::vector> Array::get_enumerations( } void Array::load_all_enumerations() { - if (remote_) { - throw ArrayException("Unable to load enumerations; Array is remote."); - } - if (!is_open_) { throw ArrayException("Unable to load all enumerations; Array is not open."); } diff --git a/tiledb/sm/array/array.h b/tiledb/sm/array/array.h index 29500ed0e7a7..b51211cb884c 100644 --- a/tiledb/sm/array/array.h +++ b/tiledb/sm/array/array.h @@ -271,14 +271,14 @@ class Array { const std::string& enumeration_name); /** - * Get the enumerations for the given names. + * Get the enumerations with the given names. * - * This function retrieves the enumerations for the given names. If any of the + * This function retrieves the enumerations with the given names. If the * corresponding enumerations have not been loaded from storage they are * loaded before this function returns. * - * @param enumeration_names The name of the enumeration. - * @return std::vector> The enumerations. + * @param enumeration_names The names of the enumerations. + * @return std::vector> The loaded enumerations. */ std::vector> get_enumerations( const std::vector& enumeration_names); diff --git a/tiledb/sm/array/array_directory.h b/tiledb/sm/array/array_directory.h index 00a7bd0a1b76..b8f05468dc02 100644 --- a/tiledb/sm/array/array_directory.h +++ b/tiledb/sm/array/array_directory.h @@ -386,7 +386,7 @@ class ArrayDirectory { load_all_array_schemas(const EncryptionKey& encryption_key) const; /** - * Load all enumerations for the given schema. + * Load the enumerations from the provided list of paths. * * @param enumeration_paths The list of enumeration paths to load. * @param encryption_key The encryption key to use. @@ -818,9 +818,8 @@ class ArrayDirectory { bool consolidation_with_timestamps_supported(const URI& uri) const; /** - * Load an enumeration from schema with the given name. + * Load an enumeration from the given path. * - * @param schema The ArraySchema that references the enumeration name. * @param enumeration_path The enumeration path to load. * @param encryption_key The encryption key to use. * @return shared_ptr The loaded enumeration. diff --git a/tiledb/sm/c_api/tiledb.cc b/tiledb/sm/c_api/tiledb.cc index e06a4eb355e0..0712bb685347 100644 --- a/tiledb/sm/c_api/tiledb.cc +++ b/tiledb/sm/c_api/tiledb.cc @@ -77,6 +77,7 @@ #include "tiledb/sm/serialization/array_schema.h" #include "tiledb/sm/serialization/array_schema_evolution.h" #include "tiledb/sm/serialization/config.h" +#include "tiledb/sm/serialization/enumeration.h" #include "tiledb/sm/serialization/fragment_info.h" #include "tiledb/sm/serialization/query.h" #include "tiledb/sm/stats/global_stats.h" @@ -4324,6 +4325,33 @@ int32_t tiledb_deserialize_fragment_info( return TILEDB_OK; } +capi_return_t tiledb_handle_load_enumerations_request( + tiledb_ctx_t* ctx, + tiledb_array_t* array, + tiledb_serialization_type_t serialization_type, + const tiledb_buffer_t* request, + tiledb_buffer_t* response) { + if (sanity_check(ctx, array) == TILEDB_ERR) { + throw std::invalid_argument("Array paramter must be valid."); + } + + api::ensure_buffer_is_valid(request); + api::ensure_buffer_is_valid(response); + + auto enumeration_names = + tiledb::sm::serialization::deserialize_load_enumerations_request( + static_cast(serialization_type), + request->buffer()); + auto enumerations = array->array_->get_enumerations(enumeration_names); + + tiledb::sm::serialization::serialize_load_enumerations_response( + enumerations, + static_cast(serialization_type), + response->buffer()); + + return TILEDB_OK; +} + /* ****************************** */ /* C++ API */ /* ****************************** */ @@ -6973,6 +7001,16 @@ int32_t tiledb_deserialize_fragment_info( ctx, buffer, serialize_type, array_uri, client_side, fragment_info); } +capi_return_t tiledb_handle_load_enumerations_request( + tiledb_ctx_t* ctx, + tiledb_array_t* array, + tiledb_serialization_type_t serialization_type, + const tiledb_buffer_t* request, + tiledb_buffer_t* response) noexcept { + return api_entry( + ctx, array, serialization_type, request, response); +} + /* ****************************** */ /* C++ API */ /* ****************************** */ diff --git a/tiledb/sm/c_api/tiledb_serialization.h b/tiledb/sm/c_api/tiledb_serialization.h index 2c46847d5e60..9c9b72cd3b9e 100644 --- a/tiledb/sm/c_api/tiledb_serialization.h +++ b/tiledb/sm/c_api/tiledb_serialization.h @@ -716,6 +716,24 @@ TILEDB_EXPORT int32_t tiledb_deserialize_group_metadata( tiledb_group_t* group, tiledb_serialization_type_t serialization_type, const tiledb_buffer_t* buffer) TILEDB_NOEXCEPT; + +/** + * Process a load enumerations request. + * + * @param ctx The TileDB context. + * @param array The TileDB Array. + * @param request A buffer containing the LoadEnumerationsRequest Capnp message. + * @param response An allocated buffer that will contain the + * LoadEnumerationsResponse Capnp message. + * @return capi_return_t TILEDB_OK on success, TILEDB_ERR on error. + */ +TILEDB_EXPORT capi_return_t tiledb_handle_load_enumerations_request( + tiledb_ctx_t* ctx, + tiledb_array_t* array, + tiledb_serialization_type_t serialization_type, + const tiledb_buffer_t* request, + tiledb_buffer_t* response) TILEDB_NOEXCEPT; + #ifdef __cplusplus } #endif diff --git a/tiledb/sm/rest/rest_client.cc b/tiledb/sm/rest/rest_client.cc index 9751fb578aa3..4738d75a5895 100644 --- a/tiledb/sm/rest/rest_client.cc +++ b/tiledb/sm/rest/rest_client.cc @@ -38,6 +38,7 @@ #include "tiledb/sm/serialization/array.h" #include "tiledb/sm/serialization/config.h" #include "tiledb/sm/serialization/consolidation.h" +#include "tiledb/sm/serialization/enumeration.h" #include "tiledb/sm/serialization/fragment_info.h" #include "tiledb/sm/serialization/group.h" #include "tiledb/sm/serialization/query.h" @@ -511,6 +512,58 @@ Status RestClient::post_array_metadata_to_rest( stats_, url, serialization_type_, &serialized, &returned_data, cache_key); } +std::vector> +RestClient::post_enumerations_from_rest( + const URI& uri, + uint64_t timestamp_start, + uint64_t timestamp_end, + Array* array, + const std::vector& enumeration_names) { + if (array == nullptr) { + throw Status_RestError( + "Error getting enumerations from REST; array is null."); + } + + Buffer buf; + serialization::serialize_load_enumerations_request( + array->config(), enumeration_names, serialization_type_, buf); + + // Wrap in a list + BufferList serialized; + throw_if_not_ok(serialized.add_buffer(std::move(buf))); + + // 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) + "/enumerations?" + + "start_timestamp=" + std::to_string(timestamp_start) + + "&end_timestamp=" + std::to_string(timestamp_end); + + // Get the data + Buffer returned_data; + throw_if_not_ok(curlc.post_data( + stats_, + url, + serialization_type_, + &serialized, + &returned_data, + cache_key)); + if (returned_data.data() == nullptr || returned_data.size() == 0) { + throw Status_RestError( + "Error getting enumerations from REST; server returned no data."); + } + + // Ensure data has a null delimiter for cap'n proto if using JSON + throw_if_not_ok(ensure_json_null_delimited_string(&returned_data)); + return serialization::deserialize_load_enumerations_response( + serialization_type_, returned_data); +} + Status RestClient::submit_query_to_rest(const URI& uri, Query* query) { // Local state tracking for the current offsets into the user's query buffers. // This allows resubmission of incomplete queries while appending to the @@ -1458,6 +1511,11 @@ Status RestClient::post_array_metadata_to_rest( Status_RestError("Cannot use rest client; serialization not enabled.")); } +void RestClient::post_enumerations_from_rest( + const URI&, uint64_t, uint64_t, Array*, const std::vector&) { + throw Status_RestError("Cannot use rest client; serialization not enabled."); +} + Status RestClient::submit_query_to_rest(const URI&, Query*) { 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 62d8c7e9ce7b..99c1eb6ed221 100644 --- a/tiledb/sm/rest/rest_client.h +++ b/tiledb/sm/rest/rest_client.h @@ -193,6 +193,22 @@ class RestClient { uint64_t timestamp_end, Array* array); + /** + * Get the requested enumerations from the REST server via POST request. + * + * @param uri Array URI. + * @param timestamp_start Inclusive starting timestamp at which to open array. + * @param timestamp_end Inclusive ending timestamp at which to open array. + * @param array Array to fetch metadata for. + * @param enumeration_names The names of the enumerations to get. + */ + std::vector> post_enumerations_from_rest( + const URI& uri, + uint64_t timestamp_start, + uint64_t timestamp_end, + Array* array, + const std::vector& enumeration_names); + /** * Post a data query to rest server * diff --git a/tiledb/sm/serialization/array_schema.cc b/tiledb/sm/serialization/array_schema.cc index 66db43722d2a..133f2dd50c20 100644 --- a/tiledb/sm/serialization/array_schema.cc +++ b/tiledb/sm/serialization/array_schema.cc @@ -66,6 +66,7 @@ #include "tiledb/sm/filter/xor_filter.h" #include "tiledb/sm/misc/constants.h" #include "tiledb/sm/serialization/array_schema.h" +#include "tiledb/sm/serialization/enumeration.h" #include #include @@ -812,61 +813,6 @@ shared_ptr dimension_label_from_capnp( is_relative); } -void enumeration_to_capnp( - shared_ptr enumeration, - capnp::Enumeration::Builder& enmr_builder) { - enmr_builder.setName(enumeration->name()); - enmr_builder.setType(datatype_str(enumeration->type())); - enmr_builder.setCellValNum(enumeration->cell_val_num()); - enmr_builder.setOrdered(enumeration->ordered()); - - auto dspan = enumeration->data(); - enmr_builder.setData(::kj::arrayPtr(dspan.data(), dspan.size())); - - if (enumeration->var_size()) { - auto ospan = enumeration->offsets(); - enmr_builder.setOffsets(::kj::arrayPtr(ospan.data(), ospan.size())); - } -} - -shared_ptr enumeration_from_capnp( - const capnp::Enumeration::Reader& reader) { - auto name = reader.getName(); - auto path_name = reader.getPathName(); - Datatype datatype = Datatype::ANY; - throw_if_not_ok(datatype_enum(reader.getType(), &datatype)); - - if (!reader.hasData()) { - throw SerializationStatusException( - "[Deserialization::enumeration_from_capnp] Deserialization of " - "Enumeration is missing its data buffer."); - } - - auto data_reader = reader.getData().asBytes(); - auto data = data_reader.begin(); - auto data_size = data_reader.size(); - - const void* offsets = nullptr; - uint64_t offsets_size = 0; - - if (reader.hasOffsets()) { - auto offsets_reader = reader.getOffsets().asBytes(); - offsets = offsets_reader.begin(); - offsets_size = offsets_reader.size(); - } - - return Enumeration::create( - name, - path_name, - datatype, - reader.getCellValNum(), - reader.getOrdered(), - data, - data_size, - offsets, - offsets_size); -} - Status array_schema_to_capnp( const ArraySchema& array_schema, capnp::ArraySchema::Builder* array_schema_builder, diff --git a/tiledb/sm/serialization/array_schema.h b/tiledb/sm/serialization/array_schema.h index 01aa4a3788ca..5db781bad183 100644 --- a/tiledb/sm/serialization/array_schema.h +++ b/tiledb/sm/serialization/array_schema.h @@ -120,25 +120,6 @@ void dimension_label_to_capnp( shared_ptr dimension_label_from_capnp( const capnp::DimensionLabel::Reader& reader); -/** - * Serialize an Enumeration do cap'n proto object - * - * @param enumeration Enumeration to serialize. - * @param enmr_builder Cap'n proto class. - */ -void enumeration_to_capnp( - shared_ptr enumeration, - capnp::Enumeration::Builder& enmr_builder); - -/** - * Deserialize a dimension label from a cap'n proto object - * - * @param reader Cap'n proto reader object - * @return A new Enumeration - */ -shared_ptr enumeration_from_capnp( - const capnp::Enumeration::Reader& reader); - #endif // TILEDB_SERIALIZATION /** diff --git a/tiledb/sm/serialization/array_schema_evolution.cc b/tiledb/sm/serialization/array_schema_evolution.cc index 46bfbb067bca..ae993b384a4c 100644 --- a/tiledb/sm/serialization/array_schema_evolution.cc +++ b/tiledb/sm/serialization/array_schema_evolution.cc @@ -53,6 +53,7 @@ #include "tiledb/sm/enums/serialization_type.h" #include "tiledb/sm/misc/constants.h" #include "tiledb/sm/serialization/array_schema.h" +#include "tiledb/sm/serialization/enumeration.h" #include diff --git a/tiledb/sm/serialization/enumeration.cc b/tiledb/sm/serialization/enumeration.cc new file mode 100644 index 000000000000..9a78648c4a5e --- /dev/null +++ b/tiledb/sm/serialization/enumeration.cc @@ -0,0 +1,375 @@ +/** + * @file enumeration.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 implements serialization for the Enumeration class + */ + +// clang-format off +#ifdef TILEDB_SERIALIZATION +#include +#include +#include +#include "tiledb/sm/serialization/capnp_utils.h" +#endif +// clang-format on + +#include "tiledb/sm/array_schema/enumeration.h" +#include "tiledb/sm/enums/serialization_type.h" + +using namespace tiledb::common; + +namespace tiledb::sm::serialization { + +#ifdef TILEDB_SERIALIZATION + +void enumeration_to_capnp( + shared_ptr enumeration, + capnp::Enumeration::Builder& enmr_builder) { + enmr_builder.setName(enumeration->name()); + enmr_builder.setPathName(enumeration->path_name()); + enmr_builder.setType(datatype_str(enumeration->type())); + enmr_builder.setCellValNum(enumeration->cell_val_num()); + enmr_builder.setOrdered(enumeration->ordered()); + + auto dspan = enumeration->data(); + enmr_builder.setData(::kj::arrayPtr(dspan.data(), dspan.size())); + + if (enumeration->var_size()) { + auto ospan = enumeration->offsets(); + enmr_builder.setOffsets(::kj::arrayPtr(ospan.data(), ospan.size())); + } +} + +shared_ptr enumeration_from_capnp( + const capnp::Enumeration::Reader& reader) { + auto name = reader.getName(); + auto path_name = reader.getPathName(); + Datatype datatype = Datatype::ANY; + throw_if_not_ok(datatype_enum(reader.getType(), &datatype)); + + if (!reader.hasData()) { + throw SerializationStatusException( + "[Deserialization::enumeration_from_capnp] Deserialization of " + "Enumeration is missing its data buffer."); + } + + auto data_reader = reader.getData().asBytes(); + auto data = data_reader.begin(); + auto data_size = data_reader.size(); + + const void* offsets = nullptr; + uint64_t offsets_size = 0; + + if (reader.hasOffsets()) { + auto offsets_reader = reader.getOffsets().asBytes(); + offsets = offsets_reader.begin(); + offsets_size = offsets_reader.size(); + } + + return Enumeration::create( + name, + path_name, + datatype, + reader.getCellValNum(), + reader.getOrdered(), + data, + data_size, + offsets, + offsets_size); +} + +void load_enumerations_request_to_capnp( + capnp::LoadEnumerationsRequest::Builder& builder, + const Config& config, + const std::vector& enumeration_names) { + auto config_builder = builder.initConfig(); + throw_if_not_ok(config_to_capnp(config, &config_builder)); + + auto num_names = enumeration_names.size(); + if (num_names > 0) { + auto names_builder = builder.initEnumerations(num_names); + for (size_t i = 0; i < num_names; i++) { + names_builder.set(i, enumeration_names[i]); + } + } +} + +std::vector load_enumerations_request_from_capnp( + capnp::LoadEnumerationsRequest::Reader& reader) { + std::vector ret; + if (reader.hasEnumerations()) { + for (auto name_reader : reader.getEnumerations()) { + ret.push_back(name_reader.cStr()); + } + } + + return ret; +} + +void load_enumerations_response_to_capnp( + capnp::LoadEnumerationsResponse::Builder& builder, + const std::vector>& enumerations) { + auto num_enmrs = enumerations.size(); + if (num_enmrs > 0) { + auto enmr_builders = builder.initEnumerations(num_enmrs); + for (size_t i = 0; i < num_enmrs; i++) { + auto enmr_builder = enmr_builders[i]; + enumeration_to_capnp(enumerations[i], enmr_builder); + } + } +} + +std::vector> +load_enumerations_response_from_capnp( + capnp::LoadEnumerationsResponse::Reader& reader) { + std::vector> ret; + if (reader.hasEnumerations()) { + auto enmr_readers = reader.getEnumerations(); + for (auto enmr_reader : enmr_readers) { + ret.push_back(enumeration_from_capnp(enmr_reader)); + } + } + return ret; +} + +void serialize_load_enumerations_request( + const Config& config, + const std::vector& enumeration_names, + SerializationType serialize_type, + Buffer& request) { + try { + ::capnp::MallocMessageBuilder message; + capnp::LoadEnumerationsRequest::Builder builder = + message.initRoot(); + load_enumerations_request_to_capnp(builder, config, enumeration_names); + + request.reset_size(); + request.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(request.realloc(json_len + 1)); + throw_if_not_ok(request.write(capnp_json.cStr(), json_len)); + throw_if_not_ok(request.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(request.realloc(nbytes)); + throw_if_not_ok(request.write(message_chars.begin(), nbytes)); + break; + } + default: { + throw Status_SerializationError( + "Error serializing load enumerations request; " + "Unknown serialization type passed"); + } + } + + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error serializing load enumerations request; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error serializing load enumerations request; exception " + + std::string(e.what())); + } +} + +std::vector deserialize_load_enumerations_request( + SerializationType serialize_type, const Buffer& request) { + try { + switch (serialize_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + ::capnp::MallocMessageBuilder message_builder; + capnp::LoadEnumerationsRequest::Builder builder = + message_builder.initRoot(); + json.decode( + kj::StringPtr(static_cast(request.data())), builder); + capnp::LoadEnumerationsRequest::Reader reader = builder.asReader(); + return load_enumerations_request_from_capnp(reader); + } + case SerializationType::CAPNP: { + const auto mBytes = reinterpret_cast(request.data()); + ::capnp::FlatArrayMessageReader array_reader(kj::arrayPtr( + reinterpret_cast(mBytes), + request.size() / sizeof(::capnp::word))); + capnp::LoadEnumerationsRequest::Reader reader = + array_reader.getRoot(); + return load_enumerations_request_from_capnp(reader); + } + default: { + throw Status_SerializationError( + "Error deserializing load enumerations request; " + "Unknown serialization type passed"); + } + } + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error deserializing load enumerations request; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error deserializing load enumerations request; exception " + + std::string(e.what())); + } +} + +void serialize_load_enumerations_response( + const std::vector> enumerations, + SerializationType serialize_type, + Buffer& response) { + try { + ::capnp::MallocMessageBuilder message; + capnp::LoadEnumerationsResponse::Builder builder = + message.initRoot(); + load_enumerations_response_to_capnp(builder, enumerations); + + response.reset_size(); + response.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(response.realloc(json_len + 1)); + throw_if_not_ok(response.write(capnp_json.cStr(), json_len)); + throw_if_not_ok(response.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(response.realloc(nbytes)); + throw_if_not_ok(response.write(message_chars.begin(), nbytes)); + break; + } + default: { + throw Status_SerializationError( + "Error serializing load enumerations response; " + "Unknown serialization type passed"); + } + } + + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error serializing load enumerations response; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error serializing load enumerations response; exception " + + std::string(e.what())); + } +} + +std::vector> +deserialize_load_enumerations_response( + SerializationType serialize_type, const Buffer& response) { + try { + switch (serialize_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + ::capnp::MallocMessageBuilder message_builder; + capnp::LoadEnumerationsResponse::Builder builder = + message_builder.initRoot(); + json.decode( + kj::StringPtr(static_cast(response.data())), builder); + capnp::LoadEnumerationsResponse::Reader reader = builder.asReader(); + return load_enumerations_response_from_capnp(reader); + } + case SerializationType::CAPNP: { + const auto mBytes = reinterpret_cast(response.data()); + ::capnp::FlatArrayMessageReader array_reader(kj::arrayPtr( + reinterpret_cast(mBytes), + response.size() / sizeof(::capnp::word))); + capnp::LoadEnumerationsResponse::Reader reader = + array_reader.getRoot(); + return load_enumerations_response_from_capnp(reader); + } + default: { + throw Status_SerializationError( + "Error deserializing load enumerations response; " + "Unknown serialization type passed"); + } + } + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error deserializing load enumerations response; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error deserializing load enumerations response; exception " + + std::string(e.what())); + } +} + +#else + +void serialize_load_enumerations_request( + const std::vector&, SerializationType, Buffer&) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled.")); +} + +std::vector deserialize_load_enumerations_request( + SerializationType, const Buffer&) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled.")); +} + +void serialize_load_enumerations_response( + const std::vector>, + SerializationType, + Buffer&) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled.")); +} + +std::vector> +deserialize_load_enumerations_response(SerializationType, const Buffer&) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled.")); +} + +#endif // TILEDB_SERIALIZATION + +} // namespace tiledb::sm::serialization diff --git a/tiledb/sm/serialization/enumeration.h b/tiledb/sm/serialization/enumeration.h new file mode 100644 index 000000000000..0c74702276ae --- /dev/null +++ b/tiledb/sm/serialization/enumeration.h @@ -0,0 +1,95 @@ +/** + * @file enumeration.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 Enumeration. + */ + +#ifndef TILEDB_SERIALIZATION_ENUMERATION_H +#define TILEDB_SERIALIZATION_ENUMERATION_H + +#ifdef TILEDB_SERIALIZATION +#include "tiledb/sm/serialization/capnp_utils.h" +#endif + +#include "tiledb/sm/array_schema/enumeration.h" +#include "tiledb/sm/buffer/buffer.h" + +using namespace tiledb::common; + +namespace tiledb::sm { + +enum class SerializationType : uint8_t; + +namespace serialization { + +#ifdef TILEDB_SERIALIZATION + +/** + * Serialize an Enumeration to cap'n proto object + * + * @param enumeration Enumeration to serialize. + * @param enmr_builder Cap'n proto class. + */ +void enumeration_to_capnp( + shared_ptr enumeration, + capnp::Enumeration::Builder& enmr_builder); + +/** + * Deserialize an enumeration from a cap'n proto object + * + * @param reader Cap'n proto reader object + * @return A new Enumeration + */ +shared_ptr enumeration_from_capnp( + const capnp::Enumeration::Reader& reader); + +#endif + +void serialize_load_enumerations_request( + const Config& config, + const std::vector& enumeration_names, + SerializationType serialization_type, + Buffer& request); + +std::vector deserialize_load_enumerations_request( + SerializationType serialization_type, const Buffer& request); + +void serialize_load_enumerations_response( + const std::vector> enumerations, + SerializationType serialization_type, + Buffer& response); + +std::vector> +deserialize_load_enumerations_response( + SerializationType serialization_type, const Buffer& response); + +} // namespace serialization +} // namespace tiledb::sm + +#endif // TILEDB_SERIALIZATION_ENUMERATION_H diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ index 28adb987c606..5c65cfd934fc 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ @@ -9344,6 +9344,129 @@ const ::capnp::_::RawSchema s_e68edfc0939e63df = { 1, 1, i_e68edfc0939e63df, nullptr, nullptr, { &s_e68edfc0939e63df, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<55> b_891a70a671f15cf6 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 246, 92, 241, 113, 166, 112, 26, 137, + 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, 82, 1, 0, 0, + 41, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 37, 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, 76, 111, 97, 100, 69, 110, + 117, 109, 101, 114, 97, 116, 105, 111, + 110, 115, 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, 58, 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, 106, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 44, 0, 0, 0, 3, 0, 1, 0, + 72, 0, 0, 0, 2, 0, 1, 0, + 99, 111, 110, 102, 105, 103, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 54, 173, 17, 129, 75, 91, 201, 182, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 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, 117, 109, 101, 114, 97, 116, + 105, 111, 110, 115, 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, + 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_891a70a671f15cf6 = b_891a70a671f15cf6.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_891a70a671f15cf6[] = { + &s_b6c95b4b8111ad36, +}; +static const uint16_t m_891a70a671f15cf6[] = {0, 1}; +static const uint16_t i_891a70a671f15cf6[] = {0, 1}; +const ::capnp::_::RawSchema s_891a70a671f15cf6 = { + 0x891a70a671f15cf6, b_891a70a671f15cf6.words, 55, d_891a70a671f15cf6, m_891a70a671f15cf6, + 1, 2, i_891a70a671f15cf6, nullptr, nullptr, { &s_891a70a671f15cf6, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<40> b_805c080c10c1e959 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 89, 233, 193, 16, 12, 8, 92, 128, + 18, 0, 0, 0, 1, 0, 0, 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, 90, 1, 0, 0, + 41, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 37, 0, 0, 0, 63, 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, 76, 111, 97, 100, 69, 110, + 117, 109, 101, 114, 97, 116, 105, 111, + 110, 115, 82, 101, 115, 112, 111, 110, + 115, 101, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 4, 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, + 13, 0, 0, 0, 106, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 3, 0, 1, 0, + 40, 0, 0, 0, 2, 0, 1, 0, + 101, 110, 117, 109, 101, 114, 97, 116, + 105, 111, 110, 115, 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, + 0, 0, 0, 0, 3, 0, 1, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 180, 185, 33, 204, 25, 47, 11, 208, + 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_805c080c10c1e959 = b_805c080c10c1e959.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_805c080c10c1e959[] = { + &s_d00b2f19cc21b9b4, +}; +static const uint16_t m_805c080c10c1e959[] = {0}; +static const uint16_t i_805c080c10c1e959[] = {0}; +const ::capnp::_::RawSchema s_805c080c10c1e959 = { + 0x805c080c10c1e959, b_805c080c10c1e959.words, 40, d_805c080c10c1e959, m_805c080c10c1e959, + 1, 1, i_805c080c10c1e959, nullptr, nullptr, { &s_805c080c10c1e959, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE } // namespace schemas } // namespace capnp @@ -10002,6 +10125,22 @@ constexpr ::capnp::Kind ArrayVacuumRequest::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* ArrayVacuumRequest::_capnpPrivate::schema; #endif // !CAPNP_LITE +// LoadEnumerationsRequest +constexpr uint16_t LoadEnumerationsRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadEnumerationsRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadEnumerationsRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadEnumerationsRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + +// LoadEnumerationsResponse +constexpr uint16_t LoadEnumerationsResponse::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadEnumerationsResponse::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadEnumerationsResponse::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadEnumerationsResponse::_capnpPrivate::schema; +#endif // !CAPNP_LITE + } // namespace } // namespace diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h index 4c1e2248272f..c37be3659e96 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h @@ -97,6 +97,8 @@ CAPNP_DECLARE_SCHEMA(a736c51d292ca752); CAPNP_DECLARE_SCHEMA(cd8abc9dabc4b03f); CAPNP_DECLARE_SCHEMA(f5a35661031194d2); CAPNP_DECLARE_SCHEMA(e68edfc0939e63df); +CAPNP_DECLARE_SCHEMA(891a70a671f15cf6); +CAPNP_DECLARE_SCHEMA(805c080c10c1e959); } // namespace schemas } // namespace capnp @@ -1572,6 +1574,40 @@ struct ArrayVacuumRequest { }; }; +struct LoadEnumerationsRequest { + LoadEnumerationsRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(891a70a671f15cf6, 0, 2) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + +struct LoadEnumerationsResponse { + LoadEnumerationsResponse() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(805c080c10c1e959, 0, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + // ======================================================================================= class DomainArray::Reader { @@ -14053,6 +14089,241 @@ class ArrayVacuumRequest::Pipeline { }; #endif // !CAPNP_LITE +class LoadEnumerationsRequest::Reader { + public: + typedef LoadEnumerationsRequest 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 hasConfig() const; + inline ::tiledb::sm::serialization::capnp::Config::Reader getConfig() const; + + inline bool hasEnumerations() const; + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader + getEnumerations() 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 LoadEnumerationsRequest::Builder { + public: + typedef LoadEnumerationsRequest 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 hasConfig(); + inline ::tiledb::sm::serialization::capnp::Config::Builder getConfig(); + inline void setConfig( + ::tiledb::sm::serialization::capnp::Config::Reader value); + inline ::tiledb::sm::serialization::capnp::Config::Builder initConfig(); + inline void adoptConfig( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config>&& value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config> + disownConfig(); + + inline bool hasEnumerations(); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder + getEnumerations(); + inline void setEnumerations( + ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader value); + inline void setEnumerations( + ::kj::ArrayPtr value); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder + initEnumerations(unsigned int size); + inline void adoptEnumerations( + ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>&& + value); + inline ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>> + disownEnumerations(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadEnumerationsRequest::Pipeline { + public: + typedef LoadEnumerationsRequest Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + inline ::tiledb::sm::serialization::capnp::Config::Pipeline getConfig(); + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class LoadEnumerationsResponse::Reader { + public: + typedef LoadEnumerationsResponse 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 hasEnumerations() const; + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader + getEnumerations() 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 LoadEnumerationsResponse::Builder { + public: + typedef LoadEnumerationsResponse 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 hasEnumerations(); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder + getEnumerations(); + inline void setEnumerations(::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader value); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder + initEnumerations(unsigned int size); + inline void adoptEnumerations( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>&& value); + inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>> + disownEnumerations(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadEnumerationsResponse::Pipeline { + public: + typedef LoadEnumerationsResponse 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 + // ======================================================================================= inline bool DomainArray::Reader::hasInt8() const { @@ -30296,6 +30567,188 @@ ArrayVacuumRequest::Builder::disownConfig() { _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); } +inline bool LoadEnumerationsRequest::Reader::hasConfig() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadEnumerationsRequest::Builder::hasConfig() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::Config::Reader +LoadEnumerationsRequest::Reader::getConfig() const { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::Config::Builder +LoadEnumerationsRequest::Builder::getConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::Config::Pipeline +LoadEnumerationsRequest::Pipeline::getConfig() { + return ::tiledb::sm::serialization::capnp::Config::Pipeline( + _typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void LoadEnumerationsRequest::Builder::setConfig( + ::tiledb::sm::serialization::capnp::Config::Reader value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Config>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::Config::Builder +LoadEnumerationsRequest::Builder::initConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LoadEnumerationsRequest::Builder::adoptConfig( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config>&& value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Config>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config> +LoadEnumerationsRequest::Builder::disownConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LoadEnumerationsRequest::Reader::hasEnumerations() const { + return !_reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadEnumerationsRequest::Builder::hasEnumerations() { + return !_builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader +LoadEnumerationsRequest::Reader::getEnumerations() 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 +LoadEnumerationsRequest::Builder::getEnumerations() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::get( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void LoadEnumerationsRequest::Builder::setEnumerations( + ::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 LoadEnumerationsRequest::Builder::setEnumerations( + ::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 +LoadEnumerationsRequest::Builder::initEnumerations(unsigned int size) { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::init( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + size); +} +inline void LoadEnumerationsRequest::Builder::adoptEnumerations( + ::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>> +LoadEnumerationsRequest::Builder::disownEnumerations() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::disown( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool LoadEnumerationsResponse::Reader::hasEnumerations() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadEnumerationsResponse::Builder::hasEnumerations() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader +LoadEnumerationsResponse::Reader::getEnumerations() const { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>::get(_reader + .getPointerField( + ::capnp::bounded<0>() * + ::capnp::POINTERS)); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder +LoadEnumerationsResponse::Builder::getEnumerations() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>::get(_builder + .getPointerField( + ::capnp::bounded<0>() * + ::capnp::POINTERS)); +} +inline void LoadEnumerationsResponse::Builder::setEnumerations( + ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>:: + set(_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder +LoadEnumerationsResponse::Builder::initEnumerations(unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>:: + init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void LoadEnumerationsResponse::Builder::adoptEnumerations( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>&& value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>:: + adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>> +LoadEnumerationsResponse::Builder::disownEnumerations() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>::disown(_builder + .getPointerField( + ::capnp::bounded<0>() * + ::capnp::POINTERS)); +} + } // namespace capnp } // namespace serialization } // namespace sm diff --git a/tiledb/sm/serialization/tiledb-rest.capnp b/tiledb/sm/serialization/tiledb-rest.capnp index c2254f28d2b6..1baa767dbceb 100644 --- a/tiledb/sm/serialization/tiledb-rest.capnp +++ b/tiledb/sm/serialization/tiledb-rest.capnp @@ -1208,3 +1208,16 @@ struct ArrayVacuumRequest { config @0 :Config; # Config } + +struct LoadEnumerationsRequest { + config @0 :Config; + # Config + + enumerations @1 :List(Text); + # Enumeration names to load +} + +struct LoadEnumerationsResponse { + enumerations @0 :List(Enumeration); + # The loaded enumerations +} diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ index 28adb987c606..5c65cfd934fc 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ @@ -9344,6 +9344,129 @@ const ::capnp::_::RawSchema s_e68edfc0939e63df = { 1, 1, i_e68edfc0939e63df, nullptr, nullptr, { &s_e68edfc0939e63df, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<55> b_891a70a671f15cf6 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 246, 92, 241, 113, 166, 112, 26, 137, + 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, 82, 1, 0, 0, + 41, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 37, 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, 76, 111, 97, 100, 69, 110, + 117, 109, 101, 114, 97, 116, 105, 111, + 110, 115, 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, 58, 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, 106, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 44, 0, 0, 0, 3, 0, 1, 0, + 72, 0, 0, 0, 2, 0, 1, 0, + 99, 111, 110, 102, 105, 103, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 54, 173, 17, 129, 75, 91, 201, 182, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 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, 117, 109, 101, 114, 97, 116, + 105, 111, 110, 115, 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, + 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_891a70a671f15cf6 = b_891a70a671f15cf6.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_891a70a671f15cf6[] = { + &s_b6c95b4b8111ad36, +}; +static const uint16_t m_891a70a671f15cf6[] = {0, 1}; +static const uint16_t i_891a70a671f15cf6[] = {0, 1}; +const ::capnp::_::RawSchema s_891a70a671f15cf6 = { + 0x891a70a671f15cf6, b_891a70a671f15cf6.words, 55, d_891a70a671f15cf6, m_891a70a671f15cf6, + 1, 2, i_891a70a671f15cf6, nullptr, nullptr, { &s_891a70a671f15cf6, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<40> b_805c080c10c1e959 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 89, 233, 193, 16, 12, 8, 92, 128, + 18, 0, 0, 0, 1, 0, 0, 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, 90, 1, 0, 0, + 41, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 37, 0, 0, 0, 63, 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, 76, 111, 97, 100, 69, 110, + 117, 109, 101, 114, 97, 116, 105, 111, + 110, 115, 82, 101, 115, 112, 111, 110, + 115, 101, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 4, 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, + 13, 0, 0, 0, 106, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 3, 0, 1, 0, + 40, 0, 0, 0, 2, 0, 1, 0, + 101, 110, 117, 109, 101, 114, 97, 116, + 105, 111, 110, 115, 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, + 0, 0, 0, 0, 3, 0, 1, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 180, 185, 33, 204, 25, 47, 11, 208, + 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_805c080c10c1e959 = b_805c080c10c1e959.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_805c080c10c1e959[] = { + &s_d00b2f19cc21b9b4, +}; +static const uint16_t m_805c080c10c1e959[] = {0}; +static const uint16_t i_805c080c10c1e959[] = {0}; +const ::capnp::_::RawSchema s_805c080c10c1e959 = { + 0x805c080c10c1e959, b_805c080c10c1e959.words, 40, d_805c080c10c1e959, m_805c080c10c1e959, + 1, 1, i_805c080c10c1e959, nullptr, nullptr, { &s_805c080c10c1e959, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE } // namespace schemas } // namespace capnp @@ -10002,6 +10125,22 @@ constexpr ::capnp::Kind ArrayVacuumRequest::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* ArrayVacuumRequest::_capnpPrivate::schema; #endif // !CAPNP_LITE +// LoadEnumerationsRequest +constexpr uint16_t LoadEnumerationsRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadEnumerationsRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadEnumerationsRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadEnumerationsRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + +// LoadEnumerationsResponse +constexpr uint16_t LoadEnumerationsResponse::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadEnumerationsResponse::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadEnumerationsResponse::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadEnumerationsResponse::_capnpPrivate::schema; +#endif // !CAPNP_LITE + } // namespace } // namespace diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h index 4c1e2248272f..c37be3659e96 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h @@ -97,6 +97,8 @@ CAPNP_DECLARE_SCHEMA(a736c51d292ca752); CAPNP_DECLARE_SCHEMA(cd8abc9dabc4b03f); CAPNP_DECLARE_SCHEMA(f5a35661031194d2); CAPNP_DECLARE_SCHEMA(e68edfc0939e63df); +CAPNP_DECLARE_SCHEMA(891a70a671f15cf6); +CAPNP_DECLARE_SCHEMA(805c080c10c1e959); } // namespace schemas } // namespace capnp @@ -1572,6 +1574,40 @@ struct ArrayVacuumRequest { }; }; +struct LoadEnumerationsRequest { + LoadEnumerationsRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(891a70a671f15cf6, 0, 2) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + +struct LoadEnumerationsResponse { + LoadEnumerationsResponse() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(805c080c10c1e959, 0, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + // ======================================================================================= class DomainArray::Reader { @@ -14053,6 +14089,241 @@ class ArrayVacuumRequest::Pipeline { }; #endif // !CAPNP_LITE +class LoadEnumerationsRequest::Reader { + public: + typedef LoadEnumerationsRequest 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 hasConfig() const; + inline ::tiledb::sm::serialization::capnp::Config::Reader getConfig() const; + + inline bool hasEnumerations() const; + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader + getEnumerations() 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 LoadEnumerationsRequest::Builder { + public: + typedef LoadEnumerationsRequest 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 hasConfig(); + inline ::tiledb::sm::serialization::capnp::Config::Builder getConfig(); + inline void setConfig( + ::tiledb::sm::serialization::capnp::Config::Reader value); + inline ::tiledb::sm::serialization::capnp::Config::Builder initConfig(); + inline void adoptConfig( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config>&& value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config> + disownConfig(); + + inline bool hasEnumerations(); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder + getEnumerations(); + inline void setEnumerations( + ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader value); + inline void setEnumerations( + ::kj::ArrayPtr value); + inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Builder + initEnumerations(unsigned int size); + inline void adoptEnumerations( + ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>&& + value); + inline ::capnp::Orphan<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>> + disownEnumerations(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadEnumerationsRequest::Pipeline { + public: + typedef LoadEnumerationsRequest Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + inline ::tiledb::sm::serialization::capnp::Config::Pipeline getConfig(); + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + +class LoadEnumerationsResponse::Reader { + public: + typedef LoadEnumerationsResponse 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 hasEnumerations() const; + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader + getEnumerations() 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 LoadEnumerationsResponse::Builder { + public: + typedef LoadEnumerationsResponse 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 hasEnumerations(); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder + getEnumerations(); + inline void setEnumerations(::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader value); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder + initEnumerations(unsigned int size); + inline void adoptEnumerations( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>&& value); + inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>> + disownEnumerations(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadEnumerationsResponse::Pipeline { + public: + typedef LoadEnumerationsResponse 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 + // ======================================================================================= inline bool DomainArray::Reader::hasInt8() const { @@ -30296,6 +30567,188 @@ ArrayVacuumRequest::Builder::disownConfig() { _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); } +inline bool LoadEnumerationsRequest::Reader::hasConfig() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadEnumerationsRequest::Builder::hasConfig() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::Config::Reader +LoadEnumerationsRequest::Reader::getConfig() const { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::Config::Builder +LoadEnumerationsRequest::Builder::getConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::Config::Pipeline +LoadEnumerationsRequest::Pipeline::getConfig() { + return ::tiledb::sm::serialization::capnp::Config::Pipeline( + _typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void LoadEnumerationsRequest::Builder::setConfig( + ::tiledb::sm::serialization::capnp::Config::Reader value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Config>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::Config::Builder +LoadEnumerationsRequest::Builder::initConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LoadEnumerationsRequest::Builder::adoptConfig( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config>&& value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Config>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Config> +LoadEnumerationsRequest::Builder::disownConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LoadEnumerationsRequest::Reader::hasEnumerations() const { + return !_reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadEnumerationsRequest::Builder::hasEnumerations() { + return !_builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>::Reader +LoadEnumerationsRequest::Reader::getEnumerations() 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 +LoadEnumerationsRequest::Builder::getEnumerations() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::get( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void LoadEnumerationsRequest::Builder::setEnumerations( + ::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 LoadEnumerationsRequest::Builder::setEnumerations( + ::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 +LoadEnumerationsRequest::Builder::initEnumerations(unsigned int size) { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::init( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + size); +} +inline void LoadEnumerationsRequest::Builder::adoptEnumerations( + ::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>> +LoadEnumerationsRequest::Builder::disownEnumerations() { + return ::capnp::_:: + PointerHelpers<::capnp::List<::capnp::Text, ::capnp::Kind::BLOB>>::disown( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} + +inline bool LoadEnumerationsResponse::Reader::hasEnumerations() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadEnumerationsResponse::Builder::hasEnumerations() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader +LoadEnumerationsResponse::Reader::getEnumerations() const { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>::get(_reader + .getPointerField( + ::capnp::bounded<0>() * + ::capnp::POINTERS)); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder +LoadEnumerationsResponse::Builder::getEnumerations() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>::get(_builder + .getPointerField( + ::capnp::bounded<0>() * + ::capnp::POINTERS)); +} +inline void LoadEnumerationsResponse::Builder::setEnumerations( + ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Reader value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>:: + set(_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>::Builder +LoadEnumerationsResponse::Builder::initEnumerations(unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>:: + init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void LoadEnumerationsResponse::Builder::adoptEnumerations( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>&& value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>:: + adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>> +LoadEnumerationsResponse::Builder::disownEnumerations() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::Enumeration, + ::capnp::Kind::STRUCT>>::disown(_builder + .getPointerField( + ::capnp::bounded<0>() * + ::capnp::POINTERS)); +} + } // namespace capnp } // namespace serialization } // namespace sm