| 321 | } |
| 322 | |
| 323 | void WasmModuleManager::registerExistingModules() |
| 324 | { |
| 325 | UniqueLock lock(modules_mutex); |
| 326 | LOG_DEBUG(log, "Loading WASM modules from '{}/{}' at disk '{}'", user_scripts_disk->getPath(), user_scripts_path, user_scripts_disk->getName()); |
| 327 | |
| 328 | auto files_it = user_scripts_disk->iterateDirectory(user_scripts_path); |
| 329 | for (; files_it->isValid(); files_it->next()) |
| 330 | { |
| 331 | const auto & file_path = files_it->path(); |
| 332 | const auto & file_name = files_it->name(); |
| 333 | auto res = validateModuleFile(user_scripts_disk, file_path); |
| 334 | if (!res) |
| 335 | { |
| 336 | LOG_DEBUG(log, "Ignoring file '{}' which is not a valid WASM module: {}", file_path, res.error().text); |
| 337 | continue; |
| 338 | } |
| 339 | |
| 340 | auto [_, inserted] = modules.insert({res.value(), {}}); |
| 341 | if (!inserted) |
| 342 | { |
| 343 | LOG_DEBUG(log, "Ignoring file '{}' with duplicate module name", file_path); |
| 344 | continue; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | LOG_DEBUG(log, "Found {} WASM modules", modules.size()); |
| 349 | } |
| 350 | |
| 351 | std::string WasmModuleManager::getFilePath(std::string_view module_name) const |
| 352 | { |
nothing calls this directly
no test coverage detected