GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/catalog_virtual.h
Date: 2024-04-28 02:33:07
Exec Total Coverage
Lines: 0 7 0.0%
Branches: 0 8 0.0%

Line Branch Exec Source
1 /**
2 * This file is part of the CernVM File System.
3 */
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
28 class VirtualCatalog {
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
37 VirtualCatalog(manifest::Manifest *m,
38 download::DownloadManager *d,
39 catalog::WritableCatalogManager *c,
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;
59 shash::Any hash;
60 };
61
62 void GenerateSnapshots();
63 void EnsurePresence();
64 void CreateCatalog();
65 void CreateBaseDirectory();
66 void CreateNestedCatalogMarker();
67 void CreateSnapshotDirectory();
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
75 catalog::WritableCatalogManager *catalog_mgr_;
76 swissknife::Assistant assistant_;
77 }; // class VirtualCatalog
78
79 } // namespace catalog
80
81 #endif // CVMFS_CATALOG_VIRTUAL_H_
82