| 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 = object_fetcher->FetchReflog(reflog_hash, |
| 17 |
|
|
&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 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 |
|
|
|
| 33 |
|
✗ |
case ObjectFetcherT::kFailBadData: |
| 34 |
|
✗ |
LogCvmfs(kLogCvmfs, kLogStderr, |
| 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: |
| 41 |
|
✗ |
LogCvmfs(kLogCvmfs, kLogStderr, "failed loading reflog (%d - %s)", f, |
| 42 |
|
|
Code2Ascii(f)); |
| 43 |
|
✗ |
return NULL; |
| 44 |
|
|
} |
| 45 |
|
|
|
| 46 |
|
✗ |
assert(reflog != NULL); |
| 47 |
|
✗ |
return reflog; |
| 48 |
|
|
} |
| 49 |
|
|
|
| 50 |
|
|
#endif // CVMFS_SERVER_TOOL_IMPL_H_ |
| 51 |
|
|
|