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

Method load_all_array_schemas

tiledb/sm/array/array_directory.cc:153–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153std::unordered_map<std::string, shared_ptr<ArraySchema>>
154ArrayDirectory::load_all_array_schemas(
155 const EncryptionKey& encryption_key,
156 shared_ptr<MemoryTracker> memory_tracker) const {
157 auto timer_se =
158 resources_.get().stats().start_timer("sm_load_all_array_schemas");
159
160 if (uri_.is_invalid()) {
161 throw ArrayDirectoryException(
162 "Cannot load all array schemas; Invalid array URI");
163 }
164
165 const std::vector<URI>& schema_uris = array_schema_uris();
166 if (schema_uris.empty()) {
167 throw ArrayDirectoryException(
168 "Cannot get the array schema vector; No array schemas found.");
169 }
170
171 std::vector<shared_ptr<ArraySchema>> schema_vector;
172 auto schema_num = schema_uris.size();
173 schema_vector.resize(schema_num);
174
175 auto status = parallel_for(
176 &resources_.get().compute_tp(), 0, schema_num, [&](size_t schema_ith) {
177 auto& schema_uri = schema_uris[schema_ith];
178 try {
179 auto&& array_schema = load_array_schema_from_uri(
180 resources_.get(), schema_uri, encryption_key, memory_tracker);
181 array_schema->set_array_uri(uri_);
182 schema_vector[schema_ith] = array_schema;
183 } catch (std::exception& e) {
184 // TODO: We could throw a nested exception, but converting exceptions
185 // to statuses loses the inner exception messages. We can revisit this
186 // when Status gets removed from this module.
187 throw ArrayDirectoryException(e.what());
188 }
189
190 return Status::Ok();
191 });
192 throw_if_not_ok(status);
193
194 std::unordered_map<std::string, shared_ptr<ArraySchema>> array_schemas;
195 for (const auto& schema : schema_vector) {
196 array_schemas[schema->name()] = schema;
197 }
198
199 return array_schemas;
200}
201
202std::vector<shared_ptr<const Enumeration>>
203ArrayDirectory::load_enumerations_from_paths(

Callers

nothing calls this directly

Calls 14

parallel_forFunction · 0.85
throw_if_not_okFunction · 0.85
is_invalidMethod · 0.80
compute_tpMethod · 0.80
start_timerMethod · 0.45
statsMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
set_array_uriMethod · 0.45

Tested by

no test coverage detected