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

Method deleteModuleIfExists

src/Interpreters/WasmModuleManager.cpp:281–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void WasmModuleManager::deleteModuleIfExists(std::function<bool(std::string_view)> name_match)
282{
283 UniqueLock lock(modules_mutex);
284
285 for (auto it = modules.begin(); it != modules.end();)
286 {
287 if (!name_match(it->first))
288 {
289 ++it;
290 continue;
291 }
292
293 if (std::ranges::any_of(it->second.ptrs, [](const auto & ptr) { return !ptr.expired(); }))
294 throw Exception(
295 ErrorCodes::CANNOT_DROP_FUNCTION,
296 "Cannot delete WebAssembly module '{}' while it is in use. "
297 "Drop all functions referring to it first",
298 it->first);
299
300 user_scripts_disk->removeFileIfExists(getFilePath(it->first));
301 it = modules.erase(it);
302 }
303}
304
305void WasmModuleManager::deleteModuleIfExists(std::string_view module_name)
306{

Callers 1

mutateMethod · 0.80

Calls 7

ExceptionClass · 0.70
beginMethod · 0.45
endMethod · 0.45
expiredMethod · 0.45
removeFileIfExistsMethod · 0.45
eraseMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected