GCC Code Coverage Report
Directory: cvmfs/ Exec Total Coverage
File: cvmfs/swissknife_lsrepo.h Lines: 0 12 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_SWISSKNIFE_LSREPO_H_
6
#define CVMFS_SWISSKNIFE_LSREPO_H_
7
8
#include <string>
9
10
#include "catalog_traversal.h"
11
#include "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,
38
           ObjectFetcherT *object_fetcher)
39
  {
40
    typename CatalogTraversal<ObjectFetcherT>::Parameters params;
41
    params.object_fetcher = object_fetcher;
42
    CatalogTraversal<ObjectFetcherT> traversal(params);
43
    traversal.RegisterListener(&CommandListCatalogs::CatalogCallback, this);
44
    if (manual_root_hash.IsNull())
45
      return traversal.Traverse();
46
    return traversal.Traverse(manual_root_hash);
47
  }
48
49
  void CatalogCallback(const CatalogTraversalData<catalog::Catalog> &data);
50
51
 private:
52
  bool print_tree_;
53
  bool print_hash_;
54
  bool print_size_;
55
  bool print_entries_;
56
};
57
58
}  // namespace swissknife
59
60
#endif  // CVMFS_SWISSKNIFE_LSREPO_H_