| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/** |
| 2 |
|
|
* This file is part of the CernVM File System. |
| 3 |
|
|
*/ |
| 4 |
|
|
|
| 5 |
|
|
#ifndef CVMFS_SWISSKNIFE_LSREPO_H_ |
| 6 |
|
|
#define CVMFS_SWISSKNIFE_LSREPO_H_ |
| 7 |
|
|
|
| 8 |
|
|
#include <string> |
| 9 |
|
|
|
| 10 |
|
|
#include "catalog_traversal.h" |
| 11 |
|
|
#include "crypto/hash.h" |
| 12 |
|
|
#include "object_fetcher.h" |
| 13 |
|
|
#include "swissknife.h" |
| 14 |
|
|
|
| 15 |
|
|
namespace catalog { |
| 16 |
|
|
class Catalog; |
| 17 |
|
|
} |
| 18 |
|
|
|
| 19 |
|
|
namespace swissknife { |
| 20 |
|
|
|
| 21 |
|
|
class CommandListCatalogs : public Command { |
| 22 |
|
|
public: |
| 23 |
|
|
CommandListCatalogs(); |
| 24 |
|
✗ |
~CommandListCatalogs() { } |
| 25 |
|
✗ |
virtual std::string GetName() const { return "lsrepo"; } |
| 26 |
|
✗ |
virtual std::string GetDescription() const { |
| 27 |
|
|
return "CernVM File System Repository Traversal\n" |
| 28 |
|
|
"This command lists the nested catalog tree that builds up a " |
| 29 |
|
✗ |
"cvmfs repository structure."; |
| 30 |
|
|
} |
| 31 |
|
|
virtual ParameterList GetParams() const; |
| 32 |
|
|
|
| 33 |
|
|
int Main(const ArgumentList &args); |
| 34 |
|
|
|
| 35 |
|
|
protected: |
| 36 |
|
|
template<class ObjectFetcherT> |
| 37 |
|
✗ |
bool Run(const shash::Any &manual_root_hash, ObjectFetcherT *object_fetcher) { |
| 38 |
|
✗ |
typename CatalogTraversal<ObjectFetcherT>::Parameters params; |
| 39 |
|
✗ |
params.object_fetcher = object_fetcher; |
| 40 |
|
✗ |
CatalogTraversal<ObjectFetcherT> traversal(params); |
| 41 |
|
✗ |
traversal.RegisterListener(&CommandListCatalogs::CatalogCallback, this); |
| 42 |
|
✗ |
if (manual_root_hash.IsNull()) |
| 43 |
|
✗ |
return traversal.Traverse(); |
| 44 |
|
✗ |
return traversal.Traverse(manual_root_hash); |
| 45 |
|
|
} |
| 46 |
|
|
|
| 47 |
|
|
void CatalogCallback(const CatalogTraversalData<catalog::Catalog> &data); |
| 48 |
|
|
|
| 49 |
|
|
private: |
| 50 |
|
|
bool print_tree_; |
| 51 |
|
|
bool print_hash_; |
| 52 |
|
|
bool print_size_; |
| 53 |
|
|
bool print_entries_; |
| 54 |
|
|
}; |
| 55 |
|
|
|
| 56 |
|
|
} // namespace swissknife |
| 57 |
|
|
|
| 58 |
|
|
#endif // CVMFS_SWISSKNIFE_LSREPO_H_ |
| 59 |
|
|
|