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

Function array_schema_deserialize

tiledb/sm/serialization/array_schema.cc:1232–1274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1230}
1231
1232shared_ptr<ArraySchema> array_schema_deserialize(
1233 SerializationType serialize_type,
1234 span<const char> serialized_buffer,
1235 shared_ptr<MemoryTracker> memory_tracker) {
1236 capnp::ArraySchema::Reader array_schema_reader;
1237 ::capnp::MallocMessageBuilder message_builder;
1238
1239 try {
1240 switch (serialize_type) {
1241 case SerializationType::JSON: {
1242 capnp::ArraySchema::Builder array_schema_builder =
1243 message_builder.initRoot<capnp::ArraySchema>();
1244 utils::decode_json_message(serialized_buffer, array_schema_builder);
1245 array_schema_reader = array_schema_builder.asReader();
1246 return array_schema_from_capnp(
1247 array_schema_reader, URI(), memory_tracker);
1248 }
1249 case SerializationType::CAPNP: {
1250 const auto mBytes =
1251 reinterpret_cast<const kj::byte*>(serialized_buffer.data());
1252 ::capnp::FlatArrayMessageReader reader(kj::arrayPtr(
1253 reinterpret_cast<const ::capnp::word*>(mBytes),
1254 serialized_buffer.size() / sizeof(::capnp::word)));
1255 array_schema_reader = reader.getRoot<capnp::ArraySchema>();
1256 return array_schema_from_capnp(
1257 array_schema_reader, URI(), memory_tracker);
1258 }
1259 default: {
1260 throw StatusException(Status_SerializationError(
1261 "Error deserializing array schema; Unknown serialization type "
1262 "passed"));
1263 }
1264 }
1265 } catch (kj::Exception& e) {
1266 throw StatusException(Status_SerializationError(
1267 "Error deserializing array schema; kj::Exception: " +
1268 std::string(e.getDescription().cStr())));
1269 } catch (std::exception& e) {
1270 throw StatusException(Status_SerializationError(
1271 "Error deserializing array schema; exception " +
1272 std::string(e.what())));
1273 }
1274}
1275
1276void array_create_to_capnp(
1277 capnp::ArrayCreateRequest::Builder* array_create_builder,

Callers 3

ser_des_array_schemaMethod · 0.85

Calls 10

decode_json_messageFunction · 0.85
array_schema_from_capnpFunction · 0.85
StatusExceptionClass · 0.85
URIClass · 0.70
asReaderMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected