MCPcopy Create free account
hub / github.com/ByConity/ByConity / insertImpl

Method insertImpl

src/Access/MultipleAccessStorage.cpp:217–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216
217UUID MultipleAccessStorage::insertImpl(const AccessEntityPtr & entity, bool replace_if_exists)
218{
219 auto storages = getStoragesInternal();
220
221 std::shared_ptr<IAccessStorage> storage_for_insertion;
222 for (const auto & storage : *storages)
223 {
224 if (storage->canInsert(entity) ||
225 storage->find(entity->getType(), entity->getName()))
226 {
227 storage_for_insertion = storage;
228 break;
229 }
230 }
231
232 if (!storage_for_insertion)
233 throw Exception("Not found a storage to insert " + entity->outputTypeAndName(), ErrorCodes::ACCESS_STORAGE_FOR_INSERTION_NOT_FOUND);
234
235 auto id = replace_if_exists ? storage_for_insertion->insertOrReplace(entity) : storage_for_insertion->insert(entity);
236 std::lock_guard lock{mutex};
237 ids_cache.set(id, storage_for_insertion);
238 return id;
239}
240
241
242void MultipleAccessStorage::removeImpl(const UUID & id)

Callers

nothing calls this directly

Calls 9

canInsertMethod · 0.80
outputTypeAndNameMethod · 0.80
ExceptionClass · 0.50
findMethod · 0.45
getTypeMethod · 0.45
getNameMethod · 0.45
insertOrReplaceMethod · 0.45
insertMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected