10 #include <boost/shared_ptr.hpp>
15 : m_cacheHint(CACHE_HINT_AUTO_DETECT),
16 m_readHint(READ_HINT_AUTO),
19 m_temppath (
".:$TMPDIR"),
76 <<
"Considering path '" << s
77 <<
"', min free space " << minFreeSpace
78 <<
"GB for temp dir" << std::endl;
82 std::vector<std::string> dirs;
83 dirs.reserve(
std::count(s.begin(), s.end(),
':') + 1);
87 size_t end = s.find(
':', begin);
88 if (end == std::string::npos)
90 dirs.push_back(s.substr(begin, end));
95 dirs.push_back(s.substr(begin, end - begin));
106 <<
"Using '" <<
m_tempdir <<
"' for temp dir"
136 std::string &protocol,
139 size_t p = url.find(
':');
140 if (p != std::string::npos)
142 protocol = url.substr(0,p);
143 rest = url.substr(p+1);
157 std::string protocol;
160 boost::shared_ptr<StorageAccount::Stamp> stats;
167 if (
Storage *storage =
maker->open (protocol, rest, mode))
169 if (dynamic_cast<LocalCacheFile *>(storage))
170 protocol =
"local-cache";
184 <<
"Failed to open the file '" << url <<
"' because:\n"
194 std::string protocol;
197 boost::shared_ptr<StorageAccount::Stamp> stats;
204 maker->stagein (protocol, rest);
205 if (stats) stats->tick();
210 <<
"Failed to stage in file '" << url <<
"' because:\n"
219 std::string protocol;
223 boost::shared_ptr<StorageAccount::Stamp> stats;
230 ret =
maker->check (protocol, rest, size);
231 if (stats) stats->tick();
236 <<
"Existence or size check for the file '" << url <<
"' failed because:\n"
246 const std::string &proto,
247 const std::string &
path,
268 std::string protocol;
CacheHint cacheHint(void) const
void stagein(const std::string &url)
bool enableAccounting(bool enabled)
static PluginManager & configure(const Config &)
std::string tempPath(void) const
void setTimeout(unsigned int timeout)
virtual std::string explainSelf() const
void setReadHint(ReadHint value)
Storage * open(const std::string &url, int mode=IOFlags::OpenRead)
bool check(const std::string &url, IOOffset *size=0)
std::string findCachePath(const std::vector< std::string > &paths, double minFreeSpace)
StorageMaker * getMaker(const std::string &proto)
static bool isAvailable()
double tempMinFree(void) const
Storage * wrapNonLocalFile(Storage *s, const std::string &proto, const std::string &path, int mode)
bool isLocalPath(const std::string &path)
static StorageFactory * get(void)
PluginManager::Config config()
std::string tempDir(void) const
unsigned int timeout(void) const
static Counter & counter(const std::string &storageClass, const std::string &operation)
ReadHint readHint(void) const
bool accounting(void) const
void setTempDir(const std::string &s, double minFreeSpace)
static StorageFactory s_instance
void setCacheHint(CacheHint value)
void activateTimeout(const std::string &url)
tuple size
Write out results.
T get(const Candidate &c)