| 158 | auto flatName = |
| 159 | BytesUtils::sha256String(reinterpret_cast<const Byte*>(modulePathView.data()), modulePathView.size()); |
| 160 | auto mmapPath = mmapCacheDir.appending(std::string_view(flatName)); |
| 161 | return ValdiModuleArchive::decompress(data.data(), data.size(), mmapPath, &usedMmap, &mmapPublishFailed); |
| 162 | } |
| 163 | return ValdiModuleArchive::decompress(data.data(), data.size()); |
| 164 | }(); |
| 165 | auto decompressDuration = decompressStopWatch.elapsed(); |
| 166 | |
| 167 | // A/B telemetry. Emit a single path counter and a latency timer per call. |
| 168 | // Failures don't get a path counter — they wouldn't tell us anything useful |
| 169 | // about realized mmap rate. |
| 170 | if (result && metrics != nullptr) { |
| 171 | if (useMmap) { |
| 172 | if (usedMmap) { |
| 173 | metrics->emitModuleArchiveMmapSuccess(modulePath); |
| 174 | // Emitted alongside Mmap_Success when the rename-into-cache step |
| 175 | // failed; the in-memory buffer is still valid but no file was |
| 176 | // published. Expected to be ~0 in production. |
| 177 | if (mmapPublishFailed) { |
| 178 | metrics->emitModuleArchiveMmapPublishFail(modulePath); |
| 179 | } |
| 180 | } else { |
| 181 | metrics->emitModuleArchiveMmapFallback(modulePath); |
| 182 | } |
| 183 | } else { |
| 184 | metrics->emitModuleArchiveHeap(modulePath); |
| 185 | } |
| 186 | metrics->emitModuleDecompressLatency(modulePath, decompressDuration); |
| 187 | } |
| 188 | |
| 189 | if (!result) { |
| 190 | return result.moveError(); |
| 191 | } |
| 192 | return Valdi::makeShared<ValdiModuleArchive>(result.moveValue()); |
| 193 | } |
| 194 | |
| 195 | BundleInitializer ResourceManager::registerBundle(const StringBox& bundleName) { |
nothing calls this directly
no test coverage detected