CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
swissknife_lsrepo.h
Go to the documentation of this file.
1 
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:
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  {
41  params.object_fetcher = object_fetcher;
42  CatalogTraversal<ObjectFetcherT> traversal(params);
44  if (manual_root_hash.IsNull())
45  return traversal.Traverse();
46  return traversal.Traverse(manual_root_hash);
47  }
48 
50 
51  private:
56 };
57 
58 } // namespace swissknife
59 
60 #endif // CVMFS_SWISSKNIFE_LSREPO_H_
CallbackPtr RegisterListener(typename BoundClosure< CatalogTraversalData< ObjectFetcherT::CatalogTN >, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data)
bool IsNull() const
Definition: hash.h:379
std::vector< Parameter > ParameterList
Definition: swissknife.h:71
virtual std::string GetName() const
bool Run(const shash::Any &manual_root_hash, ObjectFetcherT *object_fetcher)
virtual ParameterList GetParams() const
int Main(const ArgumentList &args)
bool Traverse(const TraversalType type=Base::kBreadthFirst)
std::map< char, SharedPtr< std::string > > ArgumentList
Definition: swissknife.h:72
void CatalogCallback(const CatalogTraversalData< catalog::Catalog > &data)
virtual std::string GetDescription() const