diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 92346d106e59..42a839d50e6b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -188,6 +188,7 @@ set(TILEDB_UNIT_TEST_SOURCES src/unit-tile-metadata-generator.cc src/unit-ReadCellSlabIter.cc src/unit-Reader.cc + src/unit-request-handlers.cc src/unit-resource-pool.cc src/unit-result-coords.cc src/unit-result-tile.cc diff --git a/test/src/unit-request-handlers.cc b/test/src/unit-request-handlers.cc new file mode 100644 index 000000000000..3e3e0f8ee80b --- /dev/null +++ b/test/src/unit-request-handlers.cc @@ -0,0 +1,266 @@ +/** + * @file unit-request-handlers.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 + * + * Tests for the C API request handlers. + */ + +#ifdef TILEDB_SERIALIZATION + +#include "test/support/tdb_catch.h" +#include "tiledb/api/c_api/buffer/buffer_api_internal.h" +#include "tiledb/sm/array_schema/enumeration.h" +#include "tiledb/sm/c_api/tiledb_serialization.h" +#include "tiledb/sm/cpp_api/tiledb" +#include "tiledb/sm/crypto/encryption_key.h" +#include "tiledb/sm/enums/array_type.h" +#include "tiledb/sm/enums/encryption_type.h" +#include "tiledb/sm/enums/serialization_type.h" +#include "tiledb/sm/serialization/array_schema.h" +#include "tiledb/sm/storage_manager/context.h" + +using namespace tiledb::sm; + +struct RequestHandlerFx { + RequestHandlerFx(const std::string array_uri); + virtual ~RequestHandlerFx(); + + virtual shared_ptr create_schema() = 0; + + void create_array(); + void delete_array(); + + shared_ptr get_array(QueryType type); + + shared_ptr create_string_enumeration( + std::string name, std::vector& values); + + URI uri_; + Config cfg_; + Context ctx_; + EncryptionKey enc_key_; +}; + +struct HandleLoadArraySchemaRequestFx : RequestHandlerFx { + HandleLoadArraySchemaRequestFx() + : RequestHandlerFx("load_array_schema_handler") { + } + + virtual shared_ptr create_schema() override; + ArraySchema call_handler( + serialization::LoadArraySchemaRequest req, SerializationType stype); +}; + +/* ********************************* */ +/* Testing Array Schema Loading */ +/* ********************************* */ + +TEST_CASE_METHOD( + HandleLoadArraySchemaRequestFx, + "tiledb_handle_load_array_schema_request - default request", + "[request_handler][load_array_schema][default]") { + auto stype = GENERATE(SerializationType::JSON, SerializationType::CAPNP); + + create_array(); + auto schema = + call_handler(serialization::LoadArraySchemaRequest(false), stype); + REQUIRE(schema.has_enumeration("enmr")); + REQUIRE(schema.get_loaded_enumeration_names().size() == 0); +} + +TEST_CASE_METHOD( + HandleLoadArraySchemaRequestFx, + "tiledb_handle_load_array_schema_request - load enumerations", + "[request_handler][load_array_schema][with-enumerations]") { + auto stype = GENERATE(SerializationType::JSON, SerializationType::CAPNP); + + create_array(); + auto schema = + call_handler(serialization::LoadArraySchemaRequest(true), stype); + REQUIRE(schema.has_enumeration("enmr")); + REQUIRE(schema.get_loaded_enumeration_names().size() == 1); + REQUIRE(schema.get_loaded_enumeration_names()[0] == "enmr"); + REQUIRE(schema.get_enumeration("enmr") != nullptr); +} + +TEST_CASE_METHOD( + HandleLoadArraySchemaRequestFx, + "Error Checks: tiledb_handle_load_array_schema_request", + "[request_handler][load_array_schema][errors]") { + create_array(); + + auto ctx = tiledb::Context(); + auto array = tiledb::Array(ctx, uri_.to_string(), TILEDB_READ); + auto stype = TILEDB_CAPNP; + auto req_buf = tiledb_buffer_handle_t::make_handle(); + auto resp_buf = tiledb_buffer_handle_t::make_handle(); + + auto rval = tiledb_handle_load_array_schema_request( + nullptr, + array.ptr().get(), + static_cast(stype), + req_buf, + resp_buf); + REQUIRE(rval != TILEDB_OK); + + rval = tiledb_handle_load_array_schema_request( + ctx.ptr().get(), + nullptr, + static_cast(stype), + req_buf, + resp_buf); + REQUIRE(rval != TILEDB_OK); + + rval = tiledb_handle_load_array_schema_request( + ctx.ptr().get(), + array.ptr().get(), + static_cast(stype), + nullptr, + resp_buf); + REQUIRE(rval != TILEDB_OK); + + rval = tiledb_handle_load_array_schema_request( + ctx.ptr().get(), + array.ptr().get(), + static_cast(stype), + req_buf, + nullptr); + REQUIRE(rval != TILEDB_OK); +} + +/* ********************************* */ +/* Testing Support Code */ +/* ********************************* */ + +RequestHandlerFx::RequestHandlerFx(const std::string uri) + : uri_(uri) + , ctx_(cfg_) { + delete_array(); + throw_if_not_ok(enc_key_.set_key(EncryptionType::NO_ENCRYPTION, nullptr, 0)); +} + +RequestHandlerFx::~RequestHandlerFx() { + delete_array(); +} + +void RequestHandlerFx::create_array() { + auto schema = create_schema(); + throw_if_not_ok(ctx_.storage_manager()->array_create(uri_, schema, enc_key_)); +} + +void RequestHandlerFx::delete_array() { + bool is_dir; + throw_if_not_ok(ctx_.resources().vfs().is_dir(uri_, &is_dir)); + if (is_dir) { + throw_if_not_ok(ctx_.resources().vfs().remove_dir(uri_)); + } +} + +shared_ptr RequestHandlerFx::get_array(QueryType type) { + auto array = make_shared(HERE(), uri_, ctx_.storage_manager()); + throw_if_not_ok(array->open(type, EncryptionType::NO_ENCRYPTION, nullptr, 0)); + return array; +} + +shared_ptr RequestHandlerFx::create_string_enumeration( + std::string name, std::vector& values) { + uint64_t total_size = 0; + for (auto v : values) { + total_size += v.size(); + } + + std::vector data(total_size, 0); + std::vector offsets; + offsets.reserve(values.size()); + uint64_t curr_offset = 0; + + for (auto v : values) { + std::memcpy(data.data() + curr_offset, v.data(), v.size()); + offsets.push_back(curr_offset); + curr_offset += v.size(); + } + + return Enumeration::create( + name, + Datatype::STRING_ASCII, + constants::var_num, + false, + data.data(), + total_size, + offsets.data(), + offsets.size() * sizeof(uint64_t)); +} + +shared_ptr HandleLoadArraySchemaRequestFx::create_schema() { + // Create a schema to serialize + auto schema = make_shared(HERE(), ArrayType::SPARSE); + auto dim = make_shared(HERE(), "dim1", Datatype::INT32); + int range[2] = {0, 1000}; + throw_if_not_ok(dim->set_domain(range)); + + auto dom = make_shared(HERE()); + throw_if_not_ok(dom->add_dimension(dim)); + throw_if_not_ok(schema->set_domain(dom)); + + std::vector values = {"pig", "cow", "chicken", "dog", "cat"}; + auto enmr = create_string_enumeration("enmr", values); + schema->add_enumeration(enmr); + + auto attr = make_shared(HERE(), "attr", Datatype::INT32); + attr->set_enumeration_name("enmr"); + throw_if_not_ok(schema->add_attribute(attr)); + + return schema; +} + +ArraySchema HandleLoadArraySchemaRequestFx::call_handler( + serialization::LoadArraySchemaRequest req, SerializationType stype) { + // If this looks weird, its because we're using the public C++ API to create + // these objets instead of the internal APIs elsewhere in this test suite. + // This is because the handlers are C API so accept API handles, not internal + // objects. + auto ctx = tiledb::Context(); + auto array = tiledb::Array(ctx, uri_.to_string(), TILEDB_READ); + auto req_buf = tiledb_buffer_handle_t::make_handle(); + auto resp_buf = tiledb_buffer_handle_t::make_handle(); + + serialization::serialize_load_array_schema_request( + cfg_, req, stype, req_buf->buffer()); + auto rval = tiledb_handle_load_array_schema_request( + ctx.ptr().get(), + array.ptr().get(), + static_cast(stype), + req_buf, + resp_buf); + REQUIRE(rval == TILEDB_OK); + + return serialization::deserialize_load_array_schema_response( + stype, resp_buf->buffer()); +} + +#endif // TILEDB_SERIALIZATION diff --git a/tiledb/sm/c_api/tiledb.cc b/tiledb/sm/c_api/tiledb.cc index 067a2d2856f5..2d6ef1599b2e 100644 --- a/tiledb/sm/c_api/tiledb.cc +++ b/tiledb/sm/c_api/tiledb.cc @@ -4454,6 +4454,36 @@ int32_t tiledb_deserialize_fragment_info( return TILEDB_OK; } +capi_return_t tiledb_handle_load_array_schema_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 load_schema_req = + tiledb::sm::serialization::deserialize_load_array_schema_request( + static_cast(serialization_type), + request->buffer()); + + if (load_schema_req.include_enumerations()) { + array->array_->load_all_enumerations(); + } + + tiledb::sm::serialization::serialize_load_array_schema_response( + array->array_->array_schema_latest(), + static_cast(serialization_type), + response->buffer()); + + return TILEDB_OK; +} + capi_return_t tiledb_handle_load_enumerations_request( tiledb_ctx_t* ctx, tiledb_array_t* array, @@ -7150,6 +7180,16 @@ int32_t tiledb_deserialize_fragment_info( ctx, buffer, serialize_type, array_uri, client_side, fragment_info); } +capi_return_t tiledb_handle_load_array_schema_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); +} + capi_return_t tiledb_handle_load_enumerations_request( tiledb_ctx_t* ctx, tiledb_array_t* array, diff --git a/tiledb/sm/c_api/tiledb_serialization.h b/tiledb/sm/c_api/tiledb_serialization.h index 3c0ab674be85..ad7d1bfb862a 100644 --- a/tiledb/sm/c_api/tiledb_serialization.h +++ b/tiledb/sm/c_api/tiledb_serialization.h @@ -745,6 +745,25 @@ TILEDB_EXPORT int32_t tiledb_deserialize_group_metadata( tiledb_serialization_type_t serialization_type, const tiledb_buffer_t* buffer) TILEDB_NOEXCEPT; +/** + * Process a load array schema request. + * + * @param ctx The TileDB context. + * @param array The TileDB Array. + * @param serialization_type The type of Cap'n Proto serialization used. + * @param request A buffer containing the LoadArraySchemaRequest Cap'n Proto + * message. + * @param response An allocated buffer that will contain the + * LoadArraySchemaResponse Cap'n Proto message. + * @return capi_return_t TILEDB_OK on success, TILEDB_ERR on error. + */ +TILEDB_EXPORT capi_return_t tiledb_handle_load_array_schema_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; + /** * Process a load enumerations request. * diff --git a/tiledb/sm/rest/rest_client.cc b/tiledb/sm/rest/rest_client.cc index e4d44ac8050a..413d66e6ee10 100644 --- a/tiledb/sm/rest/rest_client.cc +++ b/tiledb/sm/rest/rest_client.cc @@ -246,6 +246,56 @@ RestClient::get_array_schema_from_rest(const URI& uri) { serialization_type_, returned_data))}; } +shared_ptr RestClient::post_array_schema_from_rest( + const Config& config, + const URI& uri, + uint64_t timestamp_start, + uint64_t timestamp_end, + bool include_enumerations) { + serialization::LoadArraySchemaRequest req(include_enumerations); + + Buffer buf; + serialization::serialize_load_array_schema_request( + config, req, 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) + "/schema?" + + "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 array schema 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 make_shared( + HERE(), + serialization::deserialize_load_array_schema_response( + serialization_type_, returned_data)); +} + Status RestClient::post_array_schema_to_rest( const URI& uri, const ArraySchema& array_schema) { Buffer buff; diff --git a/tiledb/sm/rest/rest_client.h b/tiledb/sm/rest/rest_client.h index c02d84584f91..e1b05e908f4d 100644 --- a/tiledb/sm/rest/rest_client.h +++ b/tiledb/sm/rest/rest_client.h @@ -100,6 +100,21 @@ class RestClient { tuple>> get_array_schema_from_rest( const URI& uri); + /** + * Get an array schema from the rest server. This will eventually replace the + * get_array_schema_from_rest after TileDB-Cloud-REST merges support for the + * POST endpoint. + * + * @param uri The Array URI to load the schema from. + * @return shared_ptr The loaded array schema. + */ + shared_ptr post_array_schema_from_rest( + const Config& config, + const URI& uri, + uint64_t timestamp_start, + uint64_t timestamp_end, + bool include_enumerations = false); + /** * Post the array config and get an array from rest server * diff --git a/tiledb/sm/serialization/array_schema.cc b/tiledb/sm/serialization/array_schema.cc index 8255fc776ae0..40c2f9f4caae 100644 --- a/tiledb/sm/serialization/array_schema.cc +++ b/tiledb/sm/serialization/array_schema.cc @@ -1802,6 +1802,212 @@ Status max_buffer_sizes_deserialize( return Status::Ok(); } +void load_array_schema_request_to_capnp( + capnp::LoadArraySchemaRequest::Builder& builder, + const Config& config, + const LoadArraySchemaRequest& req) { + auto config_builder = builder.initConfig(); + throw_if_not_ok(config_to_capnp(config, &config_builder)); + builder.setIncludeEnumerations(req.include_enumerations()); +} + +void serialize_load_array_schema_request( + const Config& config, + const LoadArraySchemaRequest& req, + SerializationType serialization_type, + Buffer& data) { + try { + ::capnp::MallocMessageBuilder message; + auto builder = message.initRoot(); + load_array_schema_request_to_capnp(builder, config, req); + + data.reset_size(); + data.reset_offset(); + + switch (serialization_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(data.realloc(json_len + 1)); + throw_if_not_ok(data.write(capnp_json.cStr(), json_len)); + throw_if_not_ok(data.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(data.realloc(nbytes)); + throw_if_not_ok(data.write(message_chars.begin(), nbytes)); + break; + } + default: { + throw Status_SerializationError( + "Error serializing load array schema request; " + "Unknown serialization type passed"); + } + } + + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error serializing load array schema request; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error serializing load array schema request; exception " + + std::string(e.what())); + } +} + +LoadArraySchemaRequest load_array_schema_request_from_capnp( + capnp::LoadArraySchemaRequest::Reader& reader) { + return LoadArraySchemaRequest(reader.getIncludeEnumerations()); +} + +LoadArraySchemaRequest deserialize_load_array_schema_request( + SerializationType serialization_type, const Buffer& data) { + try { + switch (serialization_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + ::capnp::MallocMessageBuilder message_builder; + auto builder = + message_builder.initRoot(); + json.decode( + kj::StringPtr(static_cast(data.data())), builder); + auto reader = builder.asReader(); + return load_array_schema_request_from_capnp(reader); + } + case SerializationType::CAPNP: { + const auto mBytes = reinterpret_cast(data.data()); + ::capnp::FlatArrayMessageReader message_reader(kj::arrayPtr( + reinterpret_cast(mBytes), + data.size() / sizeof(::capnp::word))); + auto reader = message_reader.getRoot(); + return load_array_schema_request_from_capnp(reader); + } + default: { + throw Status_SerializationError( + "Error deserializing load array schema request; " + "Unknown serialization type passed"); + } + } + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error deserializing load array schema request; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error deserializing load array schema request; exception " + + std::string(e.what())); + } +} + +void load_array_schema_response_to_capnp( + capnp::LoadArraySchemaResponse::Builder& builder, + const ArraySchema& schema) { + auto schema_builder = builder.initSchema(); + throw_if_not_ok(array_schema_to_capnp(schema, &schema_builder, false)); +} + +void serialize_load_array_schema_response( + const ArraySchema& schema, + SerializationType serialization_type, + Buffer& data) { + try { + ::capnp::MallocMessageBuilder message; + auto builder = message.initRoot(); + load_array_schema_response_to_capnp(builder, schema); + + data.reset_size(); + data.reset_offset(); + + switch (serialization_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(data.realloc(json_len + 1)); + throw_if_not_ok(data.write(capnp_json.cStr(), json_len)); + throw_if_not_ok(data.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(data.realloc(nbytes)); + throw_if_not_ok(data.write(message_chars.begin(), nbytes)); + break; + } + default: { + throw Status_SerializationError( + "Error serializing load array schema response; " + "Unknown serialization type passed"); + } + } + + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error serializing load array schema response; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error serializing load array schema response; exception " + + std::string(e.what())); + } +} + +ArraySchema load_array_schema_response_from_capnp( + capnp::LoadArraySchemaResponse::Reader& reader) { + auto schema_reader = reader.getSchema(); + return array_schema_from_capnp(schema_reader, URI()); +} + +ArraySchema deserialize_load_array_schema_response( + SerializationType serialization_type, const Buffer& data) { + try { + switch (serialization_type) { + case SerializationType::JSON: { + ::capnp::JsonCodec json; + ::capnp::MallocMessageBuilder message_builder; + auto builder = + message_builder.initRoot(); + json.decode( + kj::StringPtr(static_cast(data.data())), builder); + auto reader = builder.asReader(); + return load_array_schema_response_from_capnp(reader); + } + case SerializationType::CAPNP: { + const auto mBytes = reinterpret_cast(data.data()); + ::capnp::FlatArrayMessageReader array_reader(kj::arrayPtr( + reinterpret_cast(mBytes), + data.size() / sizeof(::capnp::word))); + auto reader = array_reader.getRoot(); + return load_array_schema_response_from_capnp(reader); + } + default: { + throw Status_SerializationError( + "Error deserializing load array schema response; " + "Unknown serialization type passed"); + } + } + } catch (kj::Exception& e) { + throw Status_SerializationError( + "Error deserializing load array schema response; kj::Exception: " + + std::string(e.getDescription().cStr())); + } catch (std::exception& e) { + throw Status_SerializationError( + "Error deserializing load array schema response; exception " + + std::string(e.what())); + } +} + #else Status array_schema_serialize( @@ -1852,6 +2058,35 @@ Status max_buffer_sizes_deserialize( "Cannot serialize; serialization not enabled.")); } +void serialize_load_array_schema_request( + const Config& config, + const LoadAraySchemaRequest& req, + SerializationType serialization_type, + Buffer& request) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled."); +} + +LoadArraySchemaRequest deserialize_load_array_schema_request( + SerializationType serialization_type, const Buffer& request) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled."); +} + +void serialize_load_array_schema_response( + const ArraySchema& schema, + SerializationType serialization_type, + Buffer& response) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled."); +} + +ArraySchema deserialize_load_array_schema_response( + SerializationType serialization_type, const Buffer& response) { + throw Status_SerializationError( + "Cannot serialize; serialization not enabled."); +} + #endif // TILEDB_SERIALIZATION } // namespace tiledb::sm::serialization diff --git a/tiledb/sm/serialization/array_schema.h b/tiledb/sm/serialization/array_schema.h index 5db781bad183..7b8dd216038c 100644 --- a/tiledb/sm/serialization/array_schema.h +++ b/tiledb/sm/serialization/array_schema.h @@ -54,6 +54,20 @@ enum class SerializationType : uint8_t; namespace serialization { +class LoadArraySchemaRequest { + public: + LoadArraySchemaRequest(bool include_enumerations = false) + : include_enumerations_(include_enumerations) { + } + + inline bool include_enumerations() const { + return include_enumerations_; + } + + private: + bool include_enumerations_; +}; + #ifdef TILEDB_SERIALIZATION /** * Serialize a filter to cap'n proto object @@ -175,6 +189,23 @@ Status max_buffer_sizes_deserialize( std::unordered_map>* buffer_sizes); +void serialize_load_array_schema_request( + const Config& config, + const LoadArraySchemaRequest& req, + SerializationType serialization_type, + Buffer& data); + +LoadArraySchemaRequest deserialize_load_array_schema_request( + SerializationType serialization_type, const Buffer& data); + +void serialize_load_array_schema_response( + const ArraySchema& schema, + SerializationType serialization_type, + Buffer& data); + +ArraySchema deserialize_load_array_schema_response( + SerializationType serialization_type, const Buffer& data); + } // namespace serialization } // namespace sm } // namespace tiledb diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ index 85f93c512972..6df858596420 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ @@ -9612,6 +9612,121 @@ const ::capnp::_::RawSchema s_805c080c10c1e959 = { 1, 1, i_805c080c10c1e959, nullptr, nullptr, { &s_805c080c10c1e959, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<52> b_83f094010132ff21 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 33, 255, 50, 1, 1, 148, 240, 131, + 18, 0, 0, 0, 1, 0, 1, 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, 74, 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, 65, 114, + 114, 97, 121, 83, 99, 104, 101, 109, + 97, 82, 101, 113, 117, 101, 115, 116, + 0, 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, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 45, 0, 0, 0, 162, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 3, 0, 1, 0, + 60, 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, + 105, 110, 99, 108, 117, 100, 101, 69, + 110, 117, 109, 101, 114, 97, 116, 105, + 111, 110, 115, 0, 0, 0, 0, 0, + 1, 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, + 1, 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_83f094010132ff21 = b_83f094010132ff21.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_83f094010132ff21[] = { + &s_b6c95b4b8111ad36, +}; +static const uint16_t m_83f094010132ff21[] = {0, 1}; +static const uint16_t i_83f094010132ff21[] = {0, 1}; +const ::capnp::_::RawSchema s_83f094010132ff21 = { + 0x83f094010132ff21, b_83f094010132ff21.words, 52, d_83f094010132ff21, m_83f094010132ff21, + 1, 2, i_83f094010132ff21, nullptr, nullptr, { &s_83f094010132ff21, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<35> b_ebe17f59ac9a1df1 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 241, 29, 154, 172, 89, 127, 225, 235, + 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, 82, 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, 65, 114, + 114, 97, 121, 83, 99, 104, 101, 109, + 97, 82, 101, 115, 112, 111, 110, 115, + 101, 0, 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, 58, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 3, 0, 1, 0, + 20, 0, 0, 0, 2, 0, 1, 0, + 115, 99, 104, 101, 109, 97, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 254, 150, 226, 152, 47, 227, 29, 215, + 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, } +}; +::capnp::word const* const bp_ebe17f59ac9a1df1 = b_ebe17f59ac9a1df1.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_ebe17f59ac9a1df1[] = { + &s_d71de32f98e296fe, +}; +static const uint16_t m_ebe17f59ac9a1df1[] = {0}; +static const uint16_t i_ebe17f59ac9a1df1[] = {0}; +const ::capnp::_::RawSchema s_ebe17f59ac9a1df1 = { + 0xebe17f59ac9a1df1, b_ebe17f59ac9a1df1.words, 35, d_ebe17f59ac9a1df1, m_ebe17f59ac9a1df1, + 1, 1, i_ebe17f59ac9a1df1, nullptr, nullptr, { &s_ebe17f59ac9a1df1, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE } // namespace schemas } // namespace capnp @@ -10302,6 +10417,22 @@ constexpr ::capnp::Kind LoadEnumerationsResponse::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* LoadEnumerationsResponse::_capnpPrivate::schema; #endif // !CAPNP_LITE +// LoadArraySchemaRequest +constexpr uint16_t LoadArraySchemaRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadArraySchemaRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadArraySchemaRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadArraySchemaRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + +// LoadArraySchemaResponse +constexpr uint16_t LoadArraySchemaResponse::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadArraySchemaResponse::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadArraySchemaResponse::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadArraySchemaResponse::_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 b4a8dc1e9bde..948d31c8e157 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h @@ -101,6 +101,8 @@ CAPNP_DECLARE_SCHEMA(f5a35661031194d2); CAPNP_DECLARE_SCHEMA(e68edfc0939e63df); CAPNP_DECLARE_SCHEMA(891a70a671f15cf6); CAPNP_DECLARE_SCHEMA(805c080c10c1e959); +CAPNP_DECLARE_SCHEMA(83f094010132ff21); +CAPNP_DECLARE_SCHEMA(ebe17f59ac9a1df1); } // namespace schemas } // namespace capnp @@ -1644,6 +1646,40 @@ struct LoadEnumerationsResponse { }; }; +struct LoadArraySchemaRequest { + LoadArraySchemaRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(83f094010132ff21, 1, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + +struct LoadArraySchemaResponse { + LoadArraySchemaResponse() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(ebe17f59ac9a1df1, 0, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + // ======================================================================================= class DomainArray::Reader { @@ -14582,6 +14618,216 @@ class LoadEnumerationsResponse::Pipeline { }; #endif // !CAPNP_LITE +class LoadArraySchemaRequest::Reader { + public: + typedef LoadArraySchemaRequest 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 getIncludeEnumerations() 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 LoadArraySchemaRequest::Builder { + public: + typedef LoadArraySchemaRequest 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 getIncludeEnumerations(); + inline void setIncludeEnumerations(bool value); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadArraySchemaRequest::Pipeline { + public: + typedef LoadArraySchemaRequest 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 LoadArraySchemaResponse::Reader { + public: + typedef LoadArraySchemaResponse 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 hasSchema() const; + inline ::tiledb::sm::serialization::capnp::ArraySchema::Reader getSchema() + 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 LoadArraySchemaResponse::Builder { + public: + typedef LoadArraySchemaResponse 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 hasSchema(); + inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder getSchema(); + inline void setSchema( + ::tiledb::sm::serialization::capnp::ArraySchema::Reader value); + inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder initSchema(); + inline void adoptSchema( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema>&& value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema> + disownSchema(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadArraySchemaResponse::Pipeline { + public: + typedef LoadArraySchemaResponse Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + inline ::tiledb::sm::serialization::capnp::ArraySchema::Pipeline getSchema(); + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + // ======================================================================================= inline bool DomainArray::Reader::hasInt8() const { @@ -31181,6 +31427,123 @@ LoadEnumerationsResponse::Builder::disownEnumerations() { ::capnp::POINTERS)); } +inline bool LoadArraySchemaRequest::Reader::hasConfig() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadArraySchemaRequest::Builder::hasConfig() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::Config::Reader +LoadArraySchemaRequest::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 +LoadArraySchemaRequest::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 +LoadArraySchemaRequest::Pipeline::getConfig() { + return ::tiledb::sm::serialization::capnp::Config::Pipeline( + _typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void LoadArraySchemaRequest::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 +LoadArraySchemaRequest::Builder::initConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LoadArraySchemaRequest::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> +LoadArraySchemaRequest::Builder::disownConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LoadArraySchemaRequest::Reader::getIncludeEnumerations() const { + return _reader.getDataField(::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool LoadArraySchemaRequest::Builder::getIncludeEnumerations() { + return _builder.getDataField(::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LoadArraySchemaRequest::Builder::setIncludeEnumerations( + bool value) { + _builder.setDataField(::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool LoadArraySchemaResponse::Reader::hasSchema() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadArraySchemaResponse::Builder::hasSchema() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::ArraySchema::Reader +LoadArraySchemaResponse::Reader::getSchema() const { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder +LoadArraySchemaResponse::Builder::getSchema() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::ArraySchema::Pipeline +LoadArraySchemaResponse::Pipeline::getSchema() { + return ::tiledb::sm::serialization::capnp::ArraySchema::Pipeline( + _typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void LoadArraySchemaResponse::Builder::setSchema( + ::tiledb::sm::serialization::capnp::ArraySchema::Reader value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>:: + set(_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder +LoadArraySchemaResponse::Builder::initSchema() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LoadArraySchemaResponse::Builder::adoptSchema( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema>&& value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>:: + adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema> +LoadArraySchemaResponse::Builder::disownSchema() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::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 d939b2cb3049..7531bdb7f884 100644 --- a/tiledb/sm/serialization/tiledb-rest.capnp +++ b/tiledb/sm/serialization/tiledb-rest.capnp @@ -1232,3 +1232,16 @@ struct LoadEnumerationsResponse { enumerations @0 :List(Enumeration); # The loaded enumerations } + +struct LoadArraySchemaRequest { + config @0 :Config; + # Config + + includeEnumerations @1 :Bool; + # When true, include all enumeration data in the returned ArraySchema +} + +struct LoadArraySchemaResponse { + schema @0 :ArraySchema; + # The loaded ArraySchema +} diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ index 85f93c512972..6df858596420 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ @@ -9612,6 +9612,121 @@ const ::capnp::_::RawSchema s_805c080c10c1e959 = { 1, 1, i_805c080c10c1e959, nullptr, nullptr, { &s_805c080c10c1e959, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<52> b_83f094010132ff21 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 33, 255, 50, 1, 1, 148, 240, 131, + 18, 0, 0, 0, 1, 0, 1, 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, 74, 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, 65, 114, + 114, 97, 121, 83, 99, 104, 101, 109, + 97, 82, 101, 113, 117, 101, 115, 116, + 0, 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, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 45, 0, 0, 0, 162, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 3, 0, 1, 0, + 60, 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, + 105, 110, 99, 108, 117, 100, 101, 69, + 110, 117, 109, 101, 114, 97, 116, 105, + 111, 110, 115, 0, 0, 0, 0, 0, + 1, 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, + 1, 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_83f094010132ff21 = b_83f094010132ff21.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_83f094010132ff21[] = { + &s_b6c95b4b8111ad36, +}; +static const uint16_t m_83f094010132ff21[] = {0, 1}; +static const uint16_t i_83f094010132ff21[] = {0, 1}; +const ::capnp::_::RawSchema s_83f094010132ff21 = { + 0x83f094010132ff21, b_83f094010132ff21.words, 52, d_83f094010132ff21, m_83f094010132ff21, + 1, 2, i_83f094010132ff21, nullptr, nullptr, { &s_83f094010132ff21, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<35> b_ebe17f59ac9a1df1 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 241, 29, 154, 172, 89, 127, 225, 235, + 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, 82, 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, 65, 114, + 114, 97, 121, 83, 99, 104, 101, 109, + 97, 82, 101, 115, 112, 111, 110, 115, + 101, 0, 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, 58, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 3, 0, 1, 0, + 20, 0, 0, 0, 2, 0, 1, 0, + 115, 99, 104, 101, 109, 97, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 254, 150, 226, 152, 47, 227, 29, 215, + 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, } +}; +::capnp::word const* const bp_ebe17f59ac9a1df1 = b_ebe17f59ac9a1df1.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_ebe17f59ac9a1df1[] = { + &s_d71de32f98e296fe, +}; +static const uint16_t m_ebe17f59ac9a1df1[] = {0}; +static const uint16_t i_ebe17f59ac9a1df1[] = {0}; +const ::capnp::_::RawSchema s_ebe17f59ac9a1df1 = { + 0xebe17f59ac9a1df1, b_ebe17f59ac9a1df1.words, 35, d_ebe17f59ac9a1df1, m_ebe17f59ac9a1df1, + 1, 1, i_ebe17f59ac9a1df1, nullptr, nullptr, { &s_ebe17f59ac9a1df1, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE } // namespace schemas } // namespace capnp @@ -10302,6 +10417,22 @@ constexpr ::capnp::Kind LoadEnumerationsResponse::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* LoadEnumerationsResponse::_capnpPrivate::schema; #endif // !CAPNP_LITE +// LoadArraySchemaRequest +constexpr uint16_t LoadArraySchemaRequest::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadArraySchemaRequest::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadArraySchemaRequest::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadArraySchemaRequest::_capnpPrivate::schema; +#endif // !CAPNP_LITE + +// LoadArraySchemaResponse +constexpr uint16_t LoadArraySchemaResponse::_capnpPrivate::dataWordSize; +constexpr uint16_t LoadArraySchemaResponse::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LoadArraySchemaResponse::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LoadArraySchemaResponse::_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 b4a8dc1e9bde..948d31c8e157 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h @@ -101,6 +101,8 @@ CAPNP_DECLARE_SCHEMA(f5a35661031194d2); CAPNP_DECLARE_SCHEMA(e68edfc0939e63df); CAPNP_DECLARE_SCHEMA(891a70a671f15cf6); CAPNP_DECLARE_SCHEMA(805c080c10c1e959); +CAPNP_DECLARE_SCHEMA(83f094010132ff21); +CAPNP_DECLARE_SCHEMA(ebe17f59ac9a1df1); } // namespace schemas } // namespace capnp @@ -1644,6 +1646,40 @@ struct LoadEnumerationsResponse { }; }; +struct LoadArraySchemaRequest { + LoadArraySchemaRequest() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(83f094010132ff21, 1, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + +struct LoadArraySchemaResponse { + LoadArraySchemaResponse() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(ebe17f59ac9a1df1, 0, 1) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + // ======================================================================================= class DomainArray::Reader { @@ -14582,6 +14618,216 @@ class LoadEnumerationsResponse::Pipeline { }; #endif // !CAPNP_LITE +class LoadArraySchemaRequest::Reader { + public: + typedef LoadArraySchemaRequest 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 getIncludeEnumerations() 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 LoadArraySchemaRequest::Builder { + public: + typedef LoadArraySchemaRequest 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 getIncludeEnumerations(); + inline void setIncludeEnumerations(bool value); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadArraySchemaRequest::Pipeline { + public: + typedef LoadArraySchemaRequest 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 LoadArraySchemaResponse::Reader { + public: + typedef LoadArraySchemaResponse 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 hasSchema() const; + inline ::tiledb::sm::serialization::capnp::ArraySchema::Reader getSchema() + 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 LoadArraySchemaResponse::Builder { + public: + typedef LoadArraySchemaResponse 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 hasSchema(); + inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder getSchema(); + inline void setSchema( + ::tiledb::sm::serialization::capnp::ArraySchema::Reader value); + inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder initSchema(); + inline void adoptSchema( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema>&& value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema> + disownSchema(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LoadArraySchemaResponse::Pipeline { + public: + typedef LoadArraySchemaResponse Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + inline ::tiledb::sm::serialization::capnp::ArraySchema::Pipeline getSchema(); + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + // ======================================================================================= inline bool DomainArray::Reader::hasInt8() const { @@ -31181,6 +31427,123 @@ LoadEnumerationsResponse::Builder::disownEnumerations() { ::capnp::POINTERS)); } +inline bool LoadArraySchemaRequest::Reader::hasConfig() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadArraySchemaRequest::Builder::hasConfig() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::Config::Reader +LoadArraySchemaRequest::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 +LoadArraySchemaRequest::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 +LoadArraySchemaRequest::Pipeline::getConfig() { + return ::tiledb::sm::serialization::capnp::Config::Pipeline( + _typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void LoadArraySchemaRequest::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 +LoadArraySchemaRequest::Builder::initConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LoadArraySchemaRequest::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> +LoadArraySchemaRequest::Builder::disownConfig() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::Config>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LoadArraySchemaRequest::Reader::getIncludeEnumerations() const { + return _reader.getDataField(::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline bool LoadArraySchemaRequest::Builder::getIncludeEnumerations() { + return _builder.getDataField(::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LoadArraySchemaRequest::Builder::setIncludeEnumerations( + bool value) { + _builder.setDataField(::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool LoadArraySchemaResponse::Reader::hasSchema() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LoadArraySchemaResponse::Builder::hasSchema() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::ArraySchema::Reader +LoadArraySchemaResponse::Reader::getSchema() const { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder +LoadArraySchemaResponse::Builder::getSchema() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::ArraySchema::Pipeline +LoadArraySchemaResponse::Pipeline::getSchema() { + return ::tiledb::sm::serialization::capnp::ArraySchema::Pipeline( + _typeless.getPointerField(0)); +} +#endif // !CAPNP_LITE +inline void LoadArraySchemaResponse::Builder::setSchema( + ::tiledb::sm::serialization::capnp::ArraySchema::Reader value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>:: + set(_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::ArraySchema::Builder +LoadArraySchemaResponse::Builder::initSchema() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LoadArraySchemaResponse::Builder::adoptSchema( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema>&& value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>:: + adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::ArraySchema> +LoadArraySchemaResponse::Builder::disownSchema() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::ArraySchema>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + } // namespace capnp } // namespace serialization } // namespace sm