CernVM-FS  2.13.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 std::string &stratum0,
36  const std::string &dir_temp,
37  download::DownloadManager *download_manager,
39  const bool manage_catalog_files = false,
40  const std::string &dir_cache = "",
41  const bool copy_to_tmp_dir = false);
42 
43  protected:
45  virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context);
46  virtual Catalog *CreateCatalog(const PathString &mountpoint,
47  const shash::Any &catalog_hash,
48  Catalog *parent_catalog);
49 
50  const shash::Any &base_hash() const { return base_hash_; }
51  void set_base_hash(const shash::Any &hash) { base_hash_ = hash; }
52  const std::string &dir_temp() const { return dir_temp_; }
53 
60  inline std::string MakeRelativePath(const std::string &relative_path) const {
61  return (relative_path == "") ? "" : "/" + relative_path;
62  }
63 
64  bool UseLocalCache() const { return !dir_cache_.empty(); }
65 
66  std::string dir_cache_; // absolute path to local cache
67  // directory
68  bool copy_to_tmp_dir_; // only relevant if using local
69  // cache directory:
70  // for writeable catalogs a copy
71  // must be created in dir_temp_
72 
73  private:
74  std::string CopyCatalogToTempFile(const std::string &cache_path);
75 
77  std::string stratum0_;
78  std::string dir_temp_;
81 }; // class SimpleCatalogManager
82 
83 } // namespace catalog
84 
85 #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