Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* This file is part of the CernVM File System. |
3 |
|
|
*/ |
4 |
|
|
|
5 |
|
|
#ifndef CVMFS_SWISSKNIFE_LIST_REFLOG_H_ |
6 |
|
|
#define CVMFS_SWISSKNIFE_LIST_REFLOG_H_ |
7 |
|
|
|
8 |
|
|
#include <set> |
9 |
|
|
#include <string> |
10 |
|
|
#include <vector> |
11 |
|
|
|
12 |
|
|
#include "catalog_traversal.h" |
13 |
|
|
#include "crypto/hash.h" |
14 |
|
|
#include "smallhash.h" |
15 |
|
|
#include "swissknife.h" |
16 |
|
|
#include "util/pointer.h" |
17 |
|
|
|
18 |
|
|
namespace swissknife { |
19 |
|
|
|
20 |
|
|
class CommandListReflog : public Command { |
21 |
|
|
public: |
22 |
|
✗ |
~CommandListReflog() { } |
23 |
|
✗ |
virtual std::string GetName() const { return "list_reflog"; } |
24 |
|
✗ |
virtual std::string GetDescription() const { |
25 |
|
|
return "List all objects reachable through the reference log " |
26 |
|
✗ |
"of a CVMFS repository."; |
27 |
|
|
} |
28 |
|
|
virtual ParameterList GetParams() const; |
29 |
|
|
int Main(const ArgumentList &args); |
30 |
|
|
|
31 |
|
|
protected: |
32 |
|
|
UniquePtr<SmallHashDynamic<shash::Any, bool> > objects_; |
33 |
|
|
|
34 |
|
|
template <class ObjectFetcherT> |
35 |
|
|
bool Run(ObjectFetcherT *object_fetcher, std::string repo_name, |
36 |
|
|
std::string output_path, shash::Any reflog_hash); |
37 |
|
|
void CatalogCallback(const CatalogTraversalData<catalog::Catalog> &data); |
38 |
|
|
void InsertObjects(const std::vector<shash::Any> &list); |
39 |
|
|
void DumpObjects(FILE *stream); |
40 |
|
|
|
41 |
|
✗ |
static uint32_t hasher(const shash::Any &key) { |
42 |
|
|
// Don't start with the first bytes, because == is using them as well |
43 |
|
✗ |
return (uint32_t) *(reinterpret_cast<const uint32_t *>(key.digest) + 1); |
44 |
|
|
} |
45 |
|
|
}; |
46 |
|
|
|
47 |
|
|
} // namespace swissknife |
48 |
|
|
|
49 |
|
|
#endif // CVMFS_SWISSKNIFE_LIST_REFLOG_H_ |
50 |
|
|
|