MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getHash

Method getHash

valdi/src/valdi/runtime/Resources/Bundle.cpp:358–368  ·  view source on GitHub ↗

* Retrieves the 'hash' file form the bundle * * Returns: * - A Result containing the 'hash' entry if it exists. Error if it does not. * Notes: * - Thread-safe. Using a recursive mutex to guard access. * - See BundleResourcesProcessor.swift for how the 'hash' file is generated. */

Source from the content-addressed store, hash-verified

356 * - See BundleResourcesProcessor.swift for how the 'hash' file is generated.
357 */
358Result<StringBox> Bundle::getHash() {
359 static auto kHashName = STRING_LITERAL("hash");
360 std::lock_guard<std::recursive_mutex> guard(_mutex);
361
362 auto entryResult = getResourceContent(kHashName);
363 if (!entryResult) {
364 return entryResult.moveError();
365 }
366 auto hash = StringCache::getGlobal().makeString(entryResult.value().raw.asStringView());
367 return hash;
368}
369
370void Bundle::setLoadedArchiveIfNeeded(const Ref<ValdiModuleArchive>& archive) {
371 std::lock_guard<std::recursive_mutex> guard(_mutex);

Callers 1

getAllModuleHashesMethod · 0.45

Calls 4

getGlobalFunction · 0.85
makeStringMethod · 0.80
asStringViewMethod · 0.80
valueMethod · 0.65

Tested by

no test coverage detected