CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
catalog_mgr_ro.h
Go to the documentation of this file.
1 
11 #ifndef CVMFS_CATALOG_MGR_RO_H_
12 #define CVMFS_CATALOG_MGR_RO_H_
13 
14 #include <string>
15 
16 #include "catalog_mgr.h"
17 
18 namespace download {
19 class DownloadManager;
20 }
21 
22 namespace manifest {
23 class Manifest;
24 }
25 
26 namespace perf {
27 class Statistics;
28 }
29 
30 namespace catalog {
31 
33  public:
35  const shash::Any &base_hash,
36  const std::string &stratum0,
37  const std::string &dir_temp,
38  download::DownloadManager *download_manager,
40  const bool manage_catalog_files = false,
41  const std::string &dir_cache = "",
42  const bool copy_to_tmp_dir = false);
43 
44  protected:
46  virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context);
47  virtual Catalog* CreateCatalog(const PathString &mountpoint,
48  const shash::Any &catalog_hash,
49  Catalog *parent_catalog);
50 
51  const shash::Any& base_hash() const { return base_hash_; }
52  void set_base_hash(const shash::Any &hash) { base_hash_ = hash; }
53  const std::string& dir_temp() const { return dir_temp_; }
54 
61  inline std::string MakeRelativePath(const std::string &relative_path) const {
62  return (relative_path == "") ? "" : "/" + relative_path;
63  }
64 
65  bool UseLocalCache() const { return !dir_cache_.empty(); }
66 
67  std::string dir_cache_; // absolute path to local cache
68  // directory
69  bool copy_to_tmp_dir_; // only relevant if using local
70  // cache directory:
71  // for writeable catalogs a copy
72  // must be created in dir_temp_
73 
74  private:
75  std::string CopyCatalogToTempFile(const std::string &cache_path);
76 
78  std::string stratum0_;
79  std::string dir_temp_;
82 }; // class SimpleCatalogManager
83 
84 } // namespace catalog
85 
86 #endif // CVMFS_CATALOG_MGR_RO_H_
const manifest::Manifest * manifest() const
Definition: repository.h:125
void set_base_hash(const shash::Any &hash)
download::DownloadManager * download_manager_
virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context)
virtual Catalog * CreateCatalog(const PathString &mountpoint, const shash::Any &catalog_hash, Catalog *parent_catalog)
const std::string & dir_temp() const
std::string MakeRelativePath(const std::string &relative_path) const
std::string CopyCatalogToTempFile(const std::string &cache_path)
SimpleCatalogManager(const shash::Any &base_hash, const std::string &stratum0, const std::string &dir_temp, download::DownloadManager *download_manager, perf::Statistics *statistics, const bool manage_catalog_files=false, const std::string &dir_cache="", const bool copy_to_tmp_dir=false)
virtual LoadReturn GetNewRootCatalogContext(CatalogContext *result)
const shash::Any & base_hash() const