10 #include <arc/DateTime.h>
11 #include <arc/Logger.h>
13 #include "FileCacheHash.h"
23 std::string cache_path;
24 std::string cache_link_path;
66 std::map <std::string, struct CacheParameters> _cache_map;
69 std::vector<struct CacheParameters> _caches;
72 std::vector<struct CacheParameters> _remote_caches;
74 std::vector<struct CacheParameters> _draining_caches;
77 std::set<std::string> _urls_unlocked;
87 static const std::string CACHE_DATA_DIR;
89 static const std::string CACHE_JOB_DIR;
91 static const int CACHE_DIR_LENGTH;
93 static const int CACHE_DIR_LEVELS;
95 static const std::string CACHE_META_SUFFIX;
97 static const int CACHE_DEFAULT_AUTH_VALIDITY;
100 static const int CACHE_LOCK_TIMEOUT;
102 static const int CACHE_META_LOCK_TIMEOUT;
105 bool _init(
const std::vector<std::string>& caches,
106 const std::vector<std::string>& remote_caches,
107 const std::vector<std::string>& draining_caches,
108 const std::string&
id,
114 bool _checkMetaFile(
const std::string& filename,
const std::string& url,
bool& is_locked);
117 bool _createMetaFile(
const std::string& meta_file,
const std::string& content,
bool& is_locked);
119 std::string _getMetaFileName(
const std::string& url);
121 std::string _getHash(
const std::string& url)
const;
126 float _getCacheInfo(const std::string& path) const;
128 bool _cleanFilesAndReturnFalse(const std::string& hard_link_file, bool& locked);
149 const std::string& id,
163 FileCache(const std::vector<std::string>& caches,
164 const std::string& id,
183 FileCache(const std::vector<std::string>& caches,
184 const std::vector<std::string>& remote_caches,
185 const std::vector<std::string>& draining_caches,
186 const std::string& id,
217 bool Start(
const std::string& url,
220 bool use_remote =
true,
221 bool delete_first =
false);
237 bool Stop(
const std::string& url);
258 std::string
File(
const std::string& url);
298 bool Link(
const std::string& link_path,
299 const std::string& url,
323 bool AddDN(
const std::string& url,
const std::string& DN,
const Time& expiry_time);
333 bool CheckDN(
const std::string& url,
const std::string& DN);
379 return (!_caches.empty());
392 const std::string&
id,
395 FileCache(
const std::vector<std::string>& caches,
396 const std::string&
id,
399 FileCache(
const std::vector<std::string>& caches,
400 const std::vector<std::string>& remote_caches,
401 const std::vector<std::string>& draining_caches,
402 const std::string&
id,
406 int cache_min=100) {}
409 bool Start(
const std::string& url,
bool& available,
bool& is_locked,
bool use_remote=
true,
bool delete_first=
false) {
return false; }
410 bool Stop(
const std::string& url) {
return false; }
412 std::string
File(
const std::string& url) {
return url; }
413 bool Link(
const std::string& link_path,
const std::string& url,
bool copy,
bool executable,
bool holding_lock,
bool& try_again) {
return false; }
414 bool Release()
const {
return false;}
415 bool AddDN(
const std::string& url,
const std::string& DN,
const Time& expiry_time) {
return false;}
416 bool CheckDN(
const std::string& url,
const std::string& DN) {
return false; }
417 bool CheckCreated(
const std::string& url){
return false; }
418 Time
GetCreated(
const std::string& url) {
return Time(); }
419 bool CheckValid(
const std::string& url) {
return false; }
420 Time
GetValid(
const std::string& url) {
return Time(); }
421 bool SetValid(
const std::string& url,
const Time& val) {
return false; }