CernVM-FS  2.12.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 "gtest/gtest_prod.h"
18 #include "manifest_fetch.h"
19 #include "shortstring.h"
20 
21 class CacheManager;
22 namespace cvmfs {
23 class Fetcher;
24 }
25 class MountPoint;
26 namespace perf {
27 class Counter;
28 class Statistics;
29 }
30 namespace signature {
31 class SignatureManager;
32 }
33 
34 namespace catalog {
35 
51  FRIEND_TEST(T_CatalogManagerClient, MountLatest);
52  FRIEND_TEST(T_CatalogManagerClient, LoadByHash);
53  FRIEND_TEST(T_CatalogManagerClient, LoadByHashNetworkFailure);
54  FRIEND_TEST(T_CatalogManagerClient, LoadRootCatalog);
55 
56  // Maintains certificate hit/miss counters
57  friend class CachedManifestEnsemble;
58 
59  public:
60  explicit ClientCatalogManager(MountPoint *mountpoint);
61  virtual ~ClientCatalogManager();
62 
63  bool InitFixed(const shash::Any &root_hash, bool alternative_path);
64 
66  std::string GetCatalogDescription(const PathString &mountpoint,
67  const shash::Any &hash);
68 
69  bool IsRevisionBlacklisted();
70 
71  bool offline_mode() const { return offline_mode_; }
72  uint64_t all_inodes() const { return all_inodes_; }
73  uint64_t loaded_inodes() const { return loaded_inodes_; }
74  std::string repo_name() const { return repo_name_; }
76  int root_fd() const { return root_fd_; }
77 
78  protected:
80  virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context);
81  virtual void StageNestedCatalogByHash(const shash::Any &hash,
82  const PathString &mountpoint);
83  void UnloadCatalog(const catalog::Catalog *catalog);
84  catalog::Catalog* CreateCatalog(const PathString &mountpoint,
85  const shash::Any &catalog_hash,
86  catalog::Catalog *parent_catalog);
87  void ActivateCatalog(catalog::Catalog *catalog);
88 
89  private:
91  const std::string &name,
92  const std::string &alt_catalog_path,
93  std::string *catalog_path);
94 
98  std::map<PathString, shash::Any> loaded_catalogs_;
99  std::map<PathString, shash::Any> mounted_catalogs_;
100 
102 
103  std::string repo_name_;
106  std::string workspace_;
108  uint64_t all_inodes_;
109  uint64_t loaded_inodes_;
115 
120  int root_fd_;
121 };
122 
123 
128  public:
130  CacheManager *cache_mgr,
131  ClientCatalogManager *catalog_mgr)
132  : cache_mgr_(cache_mgr)
133  , catalog_mgr_(catalog_mgr)
134  { }
135  void FetchCertificate(const shash::Any &hash);
136 
137  private:
140 };
141 
142 } // namespace catalog
143 
144 #endif // CVMFS_CATALOG_MGR_CLIENT_H_
T * weak_ref() const
Definition: pointer.h:42
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)