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

Method downloadItem

valdi/src/valdi/runtime/Resources/AssetBytesStore.cpp:34–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34Shared<snap::valdi_core::Cancelable> AssetBytesStore::downloadItem(
35 const StringBox& url, Function<void(const Result<BytesView>&)> completion) {
36 Result<BytesView> result;
37 {
38 std::lock_guard<Mutex> lock(_mutex);
39 const auto& it = _bytesByUrl.find(url);
40 if (it != _bytesByUrl.end()) {
41 result = Result<BytesView>(it->second);
42 } else {
43 result = Result<BytesView>(Error("Did not find associated bytes with url"));
44 }
45 }
46 completion(result);
47 return nullptr;
48}
49
50StringBox AssetBytesStore::getUrlScheme() {
51 const auto& prefix = getAssetBytesStoreUrlPrefix();

Callers 4

loadAssetMethod · 0.45
loadAssetMethod · 0.45
loadImageMethod · 0.45
loadAssetMethod · 0.45

Calls 3

endMethod · 0.65
ErrorInterface · 0.50
findMethod · 0.45

Tested by

no test coverage detected