CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
server_tool_impl.h
Go to the documentation of this file.
1 
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) {
21  LogCvmfs(kLogCvmfs, kLogDebug, "fetched reflog '%s' from backend storage",
22  reflog->database_file().c_str());
23  break;
24 
27  "reflog for '%s' not found but reflog checksum is present "
28  "(either in the manifest key 'Y' or in the reflog.chksum file); "
29  "run `cvmfs_server check -r` to fix.",
30  repo_name.c_str());
31  return NULL;
32 
35  "data corruption in .cvmfsreflog for %s, run "
36  "`cvmfs_server check -r` to fix",
37  repo_name.c_str());
38  return NULL;
39 
40  default:
42  "failed loading reflog (%d - %s)", f, Code2Ascii(f));
43  return NULL;
44  }
45 
46  assert(reflog != NULL);
47  return reflog;
48 }
49 
50 #endif // CVMFS_SERVER_TOOL_IMPL_H_
const char * Code2Ascii(const ObjectFetcherFailures::Failures error)
std::string database_file() const
Definition: reflog.cc:337
Failures
Definition: letter.h:18
manifest::Reflog * FetchReflog(ObjectFetcherT *object_fetcher, const std::string &repo_name, const shash::Any &reflog_hash)
assert((mem||(size==0))&&"Out Of Memory")
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)
Definition: logging.cc:528