GCC Code Coverage Report
Directory: cvmfs/ Exec Total Coverage
File: cvmfs/server_tool_impl.h Lines: 0 14 0.0 %
Date: 2019-02-03 02:48:13 Branches: 0 6 0.0 %

Line Branch Exec Source
1
/**
2
 * This file is part of the CernVM File System.
3
 */
4
5
#ifndef CVMFS_SERVER_TOOL_IMPL_H_
6
#define CVMFS_SERVER_TOOL_IMPL_H_
7
8
#include <string>
9
10
template <class ObjectFetcherT>
11
manifest::Reflog *ServerTool::FetchReflog(ObjectFetcherT *object_fetcher,
12
                                          const std::string &repo_name,
13
                                          const shash::Any &reflog_hash) {
14
  // try to fetch the Reflog from the backend storage first
15
  manifest::Reflog *reflog = NULL;
16
  typename ObjectFetcherT::Failures f =
17
      object_fetcher->FetchReflog(reflog_hash, &reflog);
18
19
  switch (f) {
20
    case ObjectFetcherT::kFailOk:
21
      LogCvmfs(kLogCvmfs, kLogDebug, "fetched reflog '%s' from backend storage",
22
               reflog->database_file().c_str());
23
      break;
24
25
    case ObjectFetcherT::kFailNotFound:
26
      LogCvmfs(kLogCvmfs, kLogStderr,
27
               "reflog for '%s' not found but reflog.chksum is present; "
28
               "remove reflog.chksum to recreate the reflog",
29
               repo_name.c_str());
30
      return NULL;
31
32
    case ObjectFetcherT::kFailBadData:
33
      LogCvmfs(kLogCvmfs, kLogStderr,
34
               "data corruption in .cvmfsreflog for %s, remove for automatic "
35
               "recreation or verify reflog.chksum file",
36
               repo_name.c_str());
37
      return NULL;
38
39
    default:
40
      LogCvmfs(kLogCvmfs, kLogStderr,
41
               "failed loading reflog from '%s' (%d - %s)",
42
               object_fetcher->GetUrl(reflog_hash).c_str(), f, Code2Ascii(f));
43
      return NULL;
44
  }
45
46
  assert(reflog != NULL);
47
  return reflog;
48
}
49
50
#endif  // CVMFS_SERVER_TOOL_IMPL_H_