| 215 | } |
| 216 | |
| 217 | int StringDimsFx::array_schema_load_wrapper( |
| 218 | const std::string& path, tiledb_array_schema_t** array_schema) { |
| 219 | #ifndef TILEDB_SERIALIZATION |
| 220 | return tiledb_array_schema_load(ctx_, path.c_str(), array_schema); |
| 221 | #endif |
| 222 | |
| 223 | if (!serialize_) { |
| 224 | return tiledb_array_schema_load(ctx_, path.c_str(), array_schema); |
| 225 | } |
| 226 | |
| 227 | // Load array. |
| 228 | int rc = tiledb_array_schema_load(ctx_, path.c_str(), array_schema); |
| 229 | REQUIRE(rc == TILEDB_OK); |
| 230 | |
| 231 | // Serialize the array |
| 232 | tiledb_buffer_t* buff; |
| 233 | REQUIRE( |
| 234 | tiledb_serialize_array_schema( |
| 235 | ctx_, |
| 236 | *array_schema, |
| 237 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 238 | 1, |
| 239 | &buff) == TILEDB_OK); |
| 240 | |
| 241 | // Load array schema from the rest server |
| 242 | tiledb_array_schema_t* new_array_schema = nullptr; |
| 243 | REQUIRE( |
| 244 | tiledb_deserialize_array_schema( |
| 245 | ctx_, |
| 246 | buff, |
| 247 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 248 | 0, |
| 249 | &new_array_schema) == TILEDB_OK); |
| 250 | |
| 251 | // Serialize the new array schema and deserialize into the original array |
| 252 | // schema. |
| 253 | tiledb_array_schema_free(array_schema); |
| 254 | tiledb_buffer_t* buff2; |
| 255 | REQUIRE( |
| 256 | tiledb_serialize_array_schema( |
| 257 | ctx_, |
| 258 | new_array_schema, |
| 259 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 260 | 0, |
| 261 | &buff2) == TILEDB_OK); |
| 262 | REQUIRE( |
| 263 | tiledb_deserialize_array_schema( |
| 264 | ctx_, |
| 265 | buff2, |
| 266 | (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP, |
| 267 | 1, |
| 268 | array_schema) == TILEDB_OK); |
| 269 | |
| 270 | // Clean up. |
| 271 | tiledb_array_schema_free(&new_array_schema); |
| 272 | tiledb_buffer_free(&buff); |
| 273 | tiledb_buffer_free(&buff2); |
| 274 |
nothing calls this directly
no test coverage detected