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

Method loadRemote

valdi/src/valdi/runtime/Resources/Remote/RemoteDownloader.cpp:317–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317void RemoteDownloader::loadRemote(const Shared<RemoteDownloaderTask>& task) {
318 auto requestManager = getRequestManager();
319
320 if (requestManager == nullptr) {
321 loadCompleted(task, Error(STRING_LITERAL("No RequestManager set in the RemoteDownloader")), false);
322 return;
323 }
324
325 int32_t priority = 4;
326
327 static auto kGetMethod = STRING_LITERAL("GET");
328
329 snap::valdi_core::HTTPRequest request(task->getUrl(), kGetMethod, Value(), {}, priority);
330
331 VALDI_INFO(_logger, "Starting load of {} at {}", task->getItemDescription(), task->getUrl());
332
333 auto weakThis = weak_from_this();
334 requestManager->performRequest(
335 request, HTTPRequestManagerUtils::makeRequestCompletion([=](Result<snap::valdi_core::HTTPResponse> response) {
336 auto strongThis = weakThis.lock();
337 if (strongThis == nullptr) {
338 return;
339 }
340
341 strongThis->remoteResponseReceived(task, std::move(response));
342 }));
343}
344
345void RemoteDownloader::doLoad(const Shared<RemoteDownloaderTask>& task) {
346 if (task->getUrl().hasPrefix("file://")) {

Callers

nothing calls this directly

Calls 8

getRequestManagerFunction · 0.85
getUrlMethod · 0.80
getItemDescriptionMethod · 0.80
performRequestMethod · 0.65
ErrorInterface · 0.50
ValueClass · 0.50
lockMethod · 0.45

Tested by

no test coverage detected