CernVM-FS  2.13.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 <inttypes.h>
9 
10 #include <map>
11 #include <string>
12 
13 #include "backoff.h"
14 #include "catalog_mgr.h"
15 #include "crypto/hash.h"
16 #include "gtest/gtest_prod.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 } // namespace perf
29 namespace signature {
30 class SignatureManager;
31 }
32 
33 namespace catalog {
34 
50  FRIEND_TEST(T_CatalogManagerClient, MountLatest);
51  FRIEND_TEST(T_CatalogManagerClient, LoadByHash);
52  FRIEND_TEST(T_CatalogManagerClient, LoadByHashNetworkFailure);
53  FRIEND_TEST(T_CatalogManagerClient, LoadRootCatalog);
54 
55  // Maintains certificate hit/miss counters
56  friend class CachedManifestEnsemble;
57 
58  public:
59  explicit ClientCatalogManager(MountPoint *mountpoint);
60  virtual ~ClientCatalogManager();
61 
62  bool InitFixed(const shash::Any &root_hash, bool alternative_path);
63 
65  std::string GetCatalogDescription(const PathString &mountpoint,
66  const shash::Any &hash);
67 
68  bool IsRevisionBlacklisted();
69 
70  bool offline_mode() const { return offline_mode_; }
71  uint64_t all_inodes() const { return all_inodes_; }
72  uint64_t loaded_inodes() const { return loaded_inodes_; }
73  std::string repo_name() const { return repo_name_; }
75  int root_fd() const { return root_fd_; }
76 
77  protected:
79  virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context);
80  virtual void StageNestedCatalogByHash(const shash::Any &hash,
81  const PathString &mountpoint);
82  void UnloadCatalog(const catalog::Catalog *catalog);
83  catalog::Catalog *CreateCatalog(const PathString &mountpoint,
84  const shash::Any &catalog_hash,
85  catalog::Catalog *parent_catalog);
86  void ActivateCatalog(catalog::Catalog *catalog);
87 
88  private:
90  const std::string &name,
91  const std::string &alt_catalog_path,
92  std::string *catalog_path);
93 
97  std::map<PathString, shash::Any> loaded_catalogs_;
98  std::map<PathString, shash::Any> mounted_catalogs_;
99 
101 
102  std::string repo_name_;
105  std::string workspace_;
107  uint64_t all_inodes_;
108  uint64_t loaded_inodes_;
114 
119  int root_fd_;
120 };
121 
122 
127  public:
129  ClientCatalogManager *catalog_mgr)
130  : cache_mgr_(cache_mgr), catalog_mgr_(catalog_mgr) { }
131  void FetchCertificate(const shash::Any &hash);
132 
133  private:
136 };
137 
138 } // namespace catalog
139 
140 #endif // CVMFS_CATALOG_MGR_CLIENT_H_
T * weak_ref() const
Definition: pointer.h:46
UniquePtr< manifest::Manifest > manifest_
virtual void StageNestedCatalogByHash(const shash::Any &hash, const PathString &mountpoint)
CachedManifestEnsemble(CacheManager *cache_mgr, ClientCatalogManager *catalog_mgr)
std::map< PathString, shash::Any > loaded_catalogs_
std::string repo_name() const
LoadReturn FetchCatalogByHash(const shash::Any &hash, const std::string &name, const std::string &alt_catalog_path, std::string *catalog_path)
std::map< PathString, shash::Any > mounted_catalogs_
void FetchCertificate(const shash::Any &hash)
virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context)
ClientCatalogManager(MountPoint *mountpoint)
ClientCatalogManager * catalog_mgr_
bool InitFixed(const shash::Any &root_hash, bool alternative_path)
std::string GetCatalogDescription(const PathString &mountpoint, const shash::Any &hash)
signature::SignatureManager * signature_mgr_
catalog::Catalog * CreateCatalog(const PathString &mountpoint, const shash::Any &catalog_hash, catalog::Catalog *parent_catalog)
FRIEND_TEST(T_CatalogManagerClient, MountLatest)
virtual LoadReturn GetNewRootCatalogContext(CatalogContext *result)
void ActivateCatalog(catalog::Catalog *catalog)
manifest::Manifest * manifest() const
void UnloadCatalog(const catalog::Catalog *catalog)