CernVM-FS  2.11.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
catalog_mgr_client.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_CATALOG_MGR_CLIENT_H_
6 #define CVMFS_CATALOG_MGR_CLIENT_H_
7 
8 #include "catalog_mgr.h"
9 
10 #include <inttypes.h>
11 
12 #include <map>
13 #include <string>
14 
15 #include "backoff.h"
16 #include "crypto/hash.h"
17 #include "manifest_fetch.h"
18 #include "shortstring.h"
19 
20 class CacheManager;
21 namespace cvmfs {
22 class Fetcher;
23 }
24 class MountPoint;
25 namespace perf {
26 class Counter;
27 class Statistics;
28 }
29 namespace signature {
30 class SignatureManager;
31 }
32 
33 namespace catalog {
34 
50  // Maintains certificate hit/miss counters
51  friend class CachedManifestEnsemble;
52 
53  public:
54  explicit ClientCatalogManager(MountPoint *mountpoint);
55  virtual ~ClientCatalogManager();
56 
57  bool InitFixed(const shash::Any &root_hash, bool alternative_path);
58 
60 
61  bool IsRevisionBlacklisted();
62 
63  bool offline_mode() const { return offline_mode_; }
64  uint64_t all_inodes() const { return all_inodes_; }
65  uint64_t loaded_inodes() const { return loaded_inodes_; }
66  std::string repo_name() const { return repo_name_; }
68  int root_fd() const { return root_fd_; }
69 
70  protected:
71  LoadError LoadCatalog(const PathString &mountpoint,
72  const shash::Any &hash,
73  std::string *catalog_path,
74  shash::Any *catalog_hash);
75  void UnloadCatalog(const catalog::Catalog *catalog);
76  catalog::Catalog* CreateCatalog(const PathString &mountpoint,
77  const shash::Any &catalog_hash,
78  catalog::Catalog *parent_catalog);
79  void ActivateCatalog(catalog::Catalog *catalog);
80 
81  private:
83  const std::string &name,
84  const std::string &alt_catalog_path,
85  std::string *catalog_path);
86 
90  std::map<PathString, shash::Any> loaded_catalogs_;
91  std::map<PathString, shash::Any> mounted_catalogs_;
92 
94 
95  std::string repo_name_;
98  std::string workspace_;
100  uint64_t all_inodes_;
101  uint64_t loaded_inodes_;
106 
111  int root_fd_;
112 };
113 
114 
119  public:
121  CacheManager *cache_mgr,
122  ClientCatalogManager *catalog_mgr)
123  : cache_mgr_(cache_mgr)
124  , catalog_mgr_(catalog_mgr)
125  { }
126  void FetchCertificate(const shash::Any &hash);
127 
128  private:
131 };
132 
133 } // namespace catalog
134 
135 #endif // CVMFS_CATALOG_MGR_CLIENT_H_
T * weak_ref() const
Definition: pointer.h:42
LoadError LoadCatalog(const PathString &mountpoint, const shash::Any &hash, std::string *catalog_path, shash::Any *catalog_hash)
UniquePtr< manifest::Manifest > manifest_
CachedManifestEnsemble(CacheManager *cache_mgr, ClientCatalogManager *catalog_mgr)
std::map< PathString, shash::Any > loaded_catalogs_
std::string repo_name() const
std::map< PathString, shash::Any > mounted_catalogs_
LoadError LoadCatalogCas(const shash::Any &hash, const std::string &name, const std::string &alt_catalog_path, std::string *catalog_path)
void FetchCertificate(const shash::Any &hash)
ClientCatalogManager(MountPoint *mountpoint)
ClientCatalogManager * catalog_mgr_
bool InitFixed(const shash::Any &root_hash, bool alternative_path)
signature::SignatureManager * signature_mgr_
catalog::Catalog * CreateCatalog(const PathString &mountpoint, const shash::Any &catalog_hash, catalog::Catalog *parent_catalog)
void ActivateCatalog(catalog::Catalog *catalog)
manifest::Manifest * manifest() const
void UnloadCatalog(const catalog::Catalog *catalog)