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

Function load_array_schema

tiledb/sm/array_schema/array_schema_operations.cc:224–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224shared_ptr<ArraySchema> load_array_schema(
225 const Context& ctx, const URI& uri, const Config& config) {
226 // Check array name
227 if (uri.is_invalid()) {
228 throw std::runtime_error("Failed to load array schema; Invalid array URI");
229 }
230
231 // Load enumerations if config option is set.
232 const bool incl_enums = config.get<bool>(
233 "rest.load_enumerations_on_array_open", Config::must_find);
234
235 if (uri.is_tiledb()) {
236 auto& rest_client = ctx.rest_client();
237 auto&& [st, array_schema_response] =
238 rest_client.get_array_schema_from_rest(uri);
239 throw_if_not_ok(st);
240 auto array_schema = std::move(array_schema_response).value();
241
242 if (incl_enums) {
243 auto tracker = ctx.resources().ephemeral_memory_tracker();
244 // Pass an empty list of enumeration names. REST will use timestamps to
245 // load all enumerations on all schemas for the array within that range.
246 auto ret = rest_client.post_enumerations_from_rest(
247 uri,
248 array_schema->timestamp_start(),
249 array_schema->timestamp_end(),
250 config,
251 *array_schema,
252 array_schema->get_enumeration_names(),
253 tracker);
254
255 for (auto& enmr : ret[array_schema->name()]) {
256 array_schema->store_enumeration(enmr);
257 }
258 }
259 return array_schema;
260 } else {
261 // Create key
262 tiledb::sm::EncryptionKey key;
263 throw_if_not_ok(
264 key.set_key(tiledb::sm::EncryptionType::NO_ENCRYPTION, nullptr, 0));
265
266 // Load URIs from the array directory
267 optional<tiledb::sm::ArrayDirectory> array_dir;
268 array_dir.emplace(
269 ctx.resources(),
270 uri,
271 0,
272 UINT64_MAX,
273 tiledb::sm::ArrayDirectoryMode::SCHEMA_ONLY);
274
275 auto tracker = ctx.resources().ephemeral_memory_tracker();
276 // Load latest array schema
277 auto&& array_schema_latest =
278 array_dir->load_array_schema_latest(key, tracker);
279
280 if (incl_enums) {
281 std::vector<std::string> enmr_paths_to_load;

Callers 2

tiledb_array_schema_loadFunction · 0.85

Calls 15

throw_if_not_okFunction · 0.85
is_invalidMethod · 0.80
is_tiledbMethod · 0.80
resourcesMethod · 0.80
get_enumeration_namesMethod · 0.80
store_enumerationMethod · 0.80
emplaceMethod · 0.80
is_enumeration_loadedMethod · 0.80
rest_clientMethod · 0.45

Tested by

no test coverage detected