| 276 | } |
| 277 | |
| 278 | int StringDimsFx::array_create_wrapper( |
| 279 | const std::string& path, tiledb_array_schema_t* array_schema) { |
| 280 | #ifndef TILEDB_SERIALIZATION |
| 281 | return tiledb_array_create(ctx_, path.c_str(), array_schema); |
| 282 | #endif |
| 283 | |
| 284 | if (!serialize_) { |
| 285 | return tiledb_array_create(ctx_, path.c_str(), array_schema); |
| 286 | } |
| 287 | |
| 288 | // Serialize the array |
| 289 | tiledb_buffer_t* buff; |
| 290 | REQUIRE( |
| 291 | tiledb_serialize_array_schema( |
| 292 | ctx_, |
| 293 | array_schema, |
| 294 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 295 | 1, |
| 296 | &buff) == TILEDB_OK); |
| 297 | |
| 298 | // Load array schema from the rest server |
| 299 | tiledb_array_schema_t* new_array_schema = nullptr; |
| 300 | REQUIRE( |
| 301 | tiledb_deserialize_array_schema( |
| 302 | ctx_, |
| 303 | buff, |
| 304 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 305 | 0, |
| 306 | &new_array_schema) == TILEDB_OK); |
| 307 | |
| 308 | // Create array from new schema |
| 309 | int rc = tiledb_array_create(ctx_, path.c_str(), new_array_schema); |
| 310 | |
| 311 | // Serialize the new array schema and deserialize into the original array |
| 312 | // schema. |
| 313 | tiledb_buffer_t* buff2; |
| 314 | tiledb_array_schema_t* new_array_schema2 = nullptr; |
| 315 | REQUIRE( |
| 316 | tiledb_serialize_array_schema( |
| 317 | ctx_, |
| 318 | new_array_schema, |
| 319 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 320 | 0, |
| 321 | &buff2) == TILEDB_OK); |
| 322 | REQUIRE( |
| 323 | tiledb_deserialize_array_schema( |
| 324 | ctx_, |
| 325 | buff2, |
| 326 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 327 | 1, |
| 328 | &new_array_schema2) == TILEDB_OK); |
| 329 | |
| 330 | // Clean up. |
| 331 | tiledb_array_schema_free(&new_array_schema); |
| 332 | tiledb_array_schema_free(&new_array_schema2); |
| 333 | tiledb_buffer_free(&buff); |
| 334 | tiledb_buffer_free(&buff2); |
| 335 |
nothing calls this directly
no test coverage detected