MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / addDiskStorage

Method addDiskStorage

src/Access/AccessControl.cpp:391–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391void AccessControl::addDiskStorage(const String & storage_name_, const String & directory_, bool readonly_, bool allow_backup_)
392{
393 auto storages = getStoragesPtr();
394 for (const auto & storage : *storages)
395 {
396 if (auto disk_storage = typeid_cast<std::shared_ptr<DiskAccessStorage>>(storage))
397 {
398 if (disk_storage->isPathEqual(directory_))
399 {
400 if (readonly_)
401 disk_storage->setReadOnly(readonly_);
402 return;
403 }
404 }
405 }
406 auto new_storage = std::make_shared<DiskAccessStorage>(storage_name_, directory_, *changes_notifier, readonly_, allow_backup_);
407 addStorage(new_storage);
408 LOG_DEBUG(getLogger(), "Added {} access storage '{}', path: {}", String(new_storage->getStorageType()), new_storage->getStorageName(), new_storage->getPath());
409}
410
411
412void AccessControl::addMemoryStorage(const String & storage_name_, bool allow_backup_)

Callers 1

setupUsersMethod · 0.80

Calls 6

getLoggerFunction · 0.50
StringClass · 0.50
isPathEqualMethod · 0.45
setReadOnlyMethod · 0.45
getStorageTypeMethod · 0.45
getPathMethod · 0.45

Tested by

no test coverage detected