CernVM-FS  2.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
swissknife_list_reflog.h
Go to the documentation of this file.
1 
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 "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:
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:
33 
34  template <class ObjectFetcherT>
35  bool Run(ObjectFetcherT *object_fetcher, std::string repo_name,
36  std::string output_path, shash::Any reflog_hash);
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_
void CatalogCallback(const CatalogTraversalData< catalog::Catalog > &data)
std::vector< Parameter > ParameterList
Definition: swissknife.h:71
virtual std::string GetName() const
int Main(const ArgumentList &args)
unsigned char digest[digest_size_]
Definition: hash.h:123
virtual ParameterList GetParams() const
UniquePtr< SmallHashDynamic< shash::Any, bool > > objects_
virtual std::string GetDescription() const
bool Run(ObjectFetcherT *object_fetcher, std::string repo_name, std::string output_path, shash::Any reflog_hash)
static uint32_t hasher(const shash::Any &key)
std::map< char, SharedPtr< std::string > > ArgumentList
Definition: swissknife.h:72
void InsertObjects(const std::vector< shash::Any > &list)