MCPcopy Create free account
hub / github.com/apache/mesos / fetchBlob

Method fetchBlob

src/uri/fetchers/docker.cpp:979–1013  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

977
978
979Future<Nothing> DockerFetcherPluginProcess::fetchBlob(
980 const URI& uri,
981 const string& directory,
982 const http::Headers& authHeaders)
983{
984 URI blobUri = getBlobUri(uri);
985
986 return download(
987 blobUri,
988 strings::trim(stringify(blobUri)),
989 directory,
990 authHeaders,
991 stallTimeout)
992 .then(defer(self(), [=](int code) -> Future<Nothing> {
993 if (code == http::Status::UNAUTHORIZED) {
994 // If we get a '401 Unauthorized', we assume that 'authHeaders'
995 // is either empty or contains the 'Basic' credential, and we
996 // can use it to request an auth token.
997 // TODO(chhsiao): What if 'authHeaders' has an expired token?
998 return _fetchBlob(uri, directory, blobUri, authHeaders);
999 }
1000
1001 if (code == http::Status::OK) {
1002 return Nothing();
1003 }
1004
1005#ifdef __WINDOWS__
1006 return urlFetchBlob(uri, directory, blobUri, authHeaders);
1007#else
1008 return Failure(
1009 "Unexpected HTTP response '" + http::Status::string(code) + "' "
1010 "when trying to download the blob");
1011#endif
1012 }));
1013}
1014
1015
1016Future<Nothing> DockerFetcherPluginProcess::_fetchBlob(

Callers

nothing calls this directly

Calls 8

getBlobUriFunction · 0.85
trimFunction · 0.85
deferFunction · 0.85
NothingClass · 0.85
FailureClass · 0.85
downloadFunction · 0.70
stringifyFunction · 0.50
thenMethod · 0.45

Tested by

no test coverage detected