GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/catalog_virtual.h
Date: 2025-07-13 02:35:07
Exec Total Coverage
Lines: 0 9 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) {
54 return true;
55 } else if (this->name > other.name) {
56 return false;
57 }
58 return this->hash < other.hash;
59 }
60
61 std::string name;
62 shash::Any hash;
63 };
64
65 void GenerateSnapshots();
66 void EnsurePresence();
67 void CreateCatalog();
68 void CreateBaseDirectory();
69 void CreateNestedCatalogMarker();
70 void CreateSnapshotDirectory();
71 void GetSortedTagsFromHistory(std::vector<TagId> *tags);
72 void GetSortedTagsFromCatalog(std::vector<TagId> *tags);
73 void RemoveSnapshot(TagId tag);
74 void InsertSnapshot(TagId tag);
75 void Remove();
76 void RemoveRecursively(const std::string &directory);
77
78 catalog::WritableCatalogManager *catalog_mgr_;
79 swissknife::Assistant assistant_;
80 }; // class VirtualCatalog
81
82 } // namespace catalog
83
84 #endif // CVMFS_CATALOG_VIRTUAL_H_
85