CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
catalog_virtual.h
Go to the documentation of this file.
1 
4 #ifndef CVMFS_CATALOG_VIRTUAL_H_
5 #define CVMFS_CATALOG_VIRTUAL_H_
6 
7 #include <string>
8 #include <vector>
9 
10 #include "crypto/hash.h"
11 #include "shortstring.h"
12 #include "swissknife_assistant.h"
13 
14 namespace catalog {
15 class WritableCatalogManager;
16 }
17 namespace download {
18 class DownloadManager;
19 }
20 namespace manifest {
21 class Manifest;
22 }
23 struct SyncParameters;
24 
25 
26 namespace catalog {
27 
29  public:
30  static const char *kVirtualPath; // = ".cvmfs"
31  static const int kActionNone; // = 0x00
32  static const int kActionGenerateSnapshots; // = 0x01
33  static const int kActionRemove; // 0x02;
34 
35  static bool ParseActions(const std::string &action_desc, int *actions);
36 
40  SyncParameters *p);
41  void Generate(int actions);
42 
43  private:
44  static const char *kSnapshotDirectory;
45 
46  struct TagId {
47  TagId() { }
48  TagId(const std::string &n, const shash::Any &h) : name(n), hash(h) { }
49  bool operator ==(const TagId &other) const {
50  return (this->name == other.name) && (this->hash == other.hash);
51  }
52  bool operator <(const TagId &other) const {
53  if (this->name < other.name) { return true; }
54  else if (this->name > other.name) { return false; }
55  return this->hash < other.hash;
56  }
57 
58  std::string name;
60  };
61 
62  void GenerateSnapshots();
63  void EnsurePresence();
64  void CreateCatalog();
65  void CreateBaseDirectory();
68  void GetSortedTagsFromHistory(std::vector<TagId> *tags);
69  void GetSortedTagsFromCatalog(std::vector<TagId> *tags);
70  void RemoveSnapshot(TagId tag);
71  void InsertSnapshot(TagId tag);
72  void Remove();
73  void RemoveRecursively(const std::string &directory);
74 
77 }; // class VirtualCatalog
78 
79 } // namespace catalog
80 
81 #endif // CVMFS_CATALOG_VIRTUAL_H_
VirtualCatalog(manifest::Manifest *m, download::DownloadManager *d, catalog::WritableCatalogManager *c, SyncParameters *p)
catalog::WritableCatalogManager * catalog_mgr_
const manifest::Manifest * manifest() const
Definition: repository.h:125
void InsertSnapshot(TagId tag)
bool operator<(const TagId &other) const
static bool ParseActions(const std::string &action_desc, int *actions)
TagId(const std::string &n, const shash::Any &h)
void RemoveSnapshot(TagId tag)
void GetSortedTagsFromCatalog(std::vector< TagId > *tags)
static const char * kSnapshotDirectory
static const int kActionRemove
static const int kActionNone
void RemoveRecursively(const std::string &directory)
void GetSortedTagsFromHistory(std::vector< TagId > *tags)
void Generate(int actions)
bool operator==(const TagId &other) const
static const char * kVirtualPath
static const int kActionGenerateSnapshots
swissknife::Assistant assistant_