CernVM-FS  2.9.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 "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 
69  protected:
70  LoadError LoadCatalog(const PathString &mountpoint,
71  const shash::Any &hash,
72  std::string *catalog_path,
73  shash::Any *catalog_hash);
74  void UnloadCatalog(const catalog::Catalog *catalog);
75  catalog::Catalog* CreateCatalog(const PathString &mountpoint,
76  const shash::Any &catalog_hash,
77  catalog::Catalog *parent_catalog);
78  void ActivateCatalog(catalog::Catalog *catalog);
79 
80  private:
82  const std::string &name,
83  const std::string &alt_catalog_path,
84  std::string *catalog_path);
85 
89  std::map<PathString, shash::Any> loaded_catalogs_;
90  std::map<PathString, shash::Any> mounted_catalogs_;
91 
93 
94  std::string repo_name_;
97  std::string workspace_;
99  uint64_t all_inodes_;
100  uint64_t loaded_inodes_;
105 };
106 
107 
112  public:
114  CacheManager *cache_mgr,
115  ClientCatalogManager *catalog_mgr)
116  : cache_mgr_(cache_mgr)
117  , catalog_mgr_(catalog_mgr)
118  { }
119  void FetchCertificate(const shash::Any &hash);
120 
121  private:
124 };
125 
126 } // namespace catalog
127 
128 #endif // CVMFS_CATALOG_MGR_CLIENT_H_
T * weak_ref() const
Definition: pointer.h:43
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)