17 SimpleCatalogManager::SimpleCatalogManager(
19 const std::string &stratum0,
20 const std::string &dir_temp,
23 const bool manage_catalog_files,
24 const std::string &dir_cache,
25 const bool copy_to_tmp_dir)
27 , dir_cache_(dir_cache)
28 , copy_to_tmp_dir_(copy_to_tmp_dir)
29 , base_hash_(base_hash)
32 , download_manager_(download_manager)
33 , manage_catalog_files_(manage_catalog_files) {
34 if (!dir_cache.empty()) {
39 "Failure during creation of local cache directory for server. "
40 "Local cache directory: %s",
dir_cache_.c_str());
59 const std::string &cache_path) {
69 unlink(tmp_path.c_str());
72 (void) fclose(fcatalog);
111 std::string tmp_path;
122 std::string tmp_path;
132 &effective_hash, &filesink);
137 unlink(tmp_path.c_str());
145 const std::string cache_path =
dir_cache_ +
"/"
147 rename(tmp_path.c_str(), cache_path.c_str());
165 Catalog *new_catalog =
new Catalog(mountpoint, catalog_hash, parent_catalog);
bool MakeCacheDirectories(const std::string &path, const mode_t mode)
const bool manage_catalog_files_
bool UseLocalCache() const
download::DownloadManager * download_manager_
FILE * CreateTempFile(const std::string &path_prefix, const int mode, const char *open_flags, std::string *final_path)
virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context)
assert((mem||(size==0))&&"Out Of Memory")
bool CopyPath2File(const std::string &src, FILE *fdest)
virtual Catalog * CreateCatalog(const PathString &mountpoint, const shash::Any &catalog_hash, Catalog *parent_catalog)
bool FileExists(const std::string &path)
void SetMountpoint(const PathString &mountpoint)
const char * Code2Ascii(const Failures error)
const char kSuffixCatalog
void TakeDatabaseFileOwnership()
void SetRootCtlgLocation(RootCatalogLocation root_ctlg_location)
std::string MakePathWithoutSuffix() const
ShortString< kDefaultMaxPath, 0 > PathString
Failures Fetch(JobInfo *info)
void SetHash(shash::Any hash)
std::string MakePath() const
void SetSqlitePath(const std::string &sqlite_path)
std::string CopyCatalogToTempFile(const std::string &cache_path)
virtual LoadReturn GetNewRootCatalogContext(CatalogContext *result)