MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / array_schema_load_wrapper

Method array_schema_load_wrapper

test/src/unit-capi-array_schema.cc:400–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400int ArraySchemaFx::array_schema_load_wrapper(
401 const std::string& path, tiledb_array_schema_t** array_schema) {
402#ifndef TILEDB_SERIALIZATION
403 return tiledb_array_schema_load(ctx_, path.c_str(), array_schema);
404#endif
405
406 if (!serialize_array_schema_) {
407 return tiledb_array_schema_load(ctx_, path.c_str(), array_schema);
408 }
409
410 // Load array.
411 int rc = tiledb_array_schema_load(ctx_, path.c_str(), array_schema);
412 REQUIRE(rc == TILEDB_OK);
413
414 // Serialize the array
415 tiledb_buffer_t* buff;
416 REQUIRE(
417 tiledb_serialize_array_schema(
418 ctx_,
419 *array_schema,
420 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
421 1,
422 &buff) == TILEDB_OK);
423
424 // Load array schema from the rest server
425 tiledb_array_schema_t* new_array_schema = nullptr;
426 REQUIRE(
427 tiledb_deserialize_array_schema(
428 ctx_,
429 buff,
430 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
431 0,
432 &new_array_schema) == TILEDB_OK);
433
434 // Serialize the new array schema and deserialize into the original array
435 // schema.
436 tiledb_array_schema_free(array_schema);
437 tiledb_buffer_t* buff2;
438 REQUIRE(
439 tiledb_serialize_array_schema(
440 ctx_,
441 new_array_schema,
442 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
443 0,
444 &buff2) == TILEDB_OK);
445 REQUIRE(
446 tiledb_deserialize_array_schema(
447 ctx_,
448 buff2,
449 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
450 1,
451 array_schema) == TILEDB_OK);
452
453 // Clean up.
454 tiledb_array_schema_free(&new_array_schema);
455 tiledb_buffer_free(&buff);
456 tiledb_buffer_free(&buff2);
457

Callers

nothing calls this directly

Calls 6

tiledb_array_schema_loadFunction · 0.85
tiledb_array_schema_freeFunction · 0.85
tiledb_buffer_freeFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected