Repository: mesos Updated Branches: refs/heads/master 870dde216 -> 6c7ab8777
Minor code refactor for fetcher.cpp. Review: https://reviews.apache.org/r/39707 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6c7ab877 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6c7ab877 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6c7ab877 Branch: refs/heads/master Commit: 6c7ab87772ee2b82d48e0acfa9c768be05ced0d2 Parents: 870dde2 Author: Vinod Kone <[email protected]> Authored: Tue Oct 27 18:42:20 2015 -0700 Committer: Vinod Kone <[email protected]> Committed: Wed Nov 4 13:04:51 2015 -0800 ---------------------------------------------------------------------- src/launcher/fetcher.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/6c7ab877/src/launcher/fetcher.cpp ---------------------------------------------------------------------- diff --git a/src/launcher/fetcher.cpp b/src/launcher/fetcher.cpp index 8fb6c83..07ba330 100644 --- a/src/launcher/fetcher.cpp +++ b/src/launcher/fetcher.cpp @@ -293,6 +293,9 @@ static Try<string> fetchFromCache( string destinationPath = path::join(sandboxDirectory, basename.get()); + // Non-empty cache filename is guaranteed by the callers of this function. + CHECK(!item.cache_filename().empty()); + string sourcePath = path::join(cacheDirectory, item.cache_filename()); if (item.uri().executable()) { @@ -337,10 +340,10 @@ static Try<string> fetchThroughCache( return Error("No cache file name for: " + item.uri().value()); } - if (item.action() != FetcherInfo::Item::RETRIEVE_FROM_CACHE) { - CHECK_EQ(FetcherInfo::Item::DOWNLOAD_AND_CACHE, item.action()) - << "Unexpected fetcher action selector"; + CHECK_NE(FetcherInfo::Item::BYPASS_CACHE, item.action()) + << "Unexpected fetcher action selector"; + if (item.action() == FetcherInfo::Item::DOWNLOAD_AND_CACHE) { LOG(INFO) << "Downloading into cache"; Try<Nothing> mkdir = os::mkdir(cacheDirectory.get());
