10 #include <boost/shared_ptr.hpp>
15 : m_cacheHint(CACHE_HINT_AUTO_DETECT),
16 m_readHint(READ_HINT_AUTO),
19 m_temppath (
".:$TMPDIR"),
85 <<
"Considering path '" << s
86 <<
"', min free space " << minFreeSpace
87 <<
"GB for temp dir" << std::endl;
91 std::vector<std::string> dirs;
92 dirs.reserve(
std::count(s.begin(), s.end(),
':') + 1);
96 size_t end = s.find(
':', begin);
97 if (end == std::string::npos)
99 dirs.push_back(s.substr(begin, end));
104 dirs.push_back(s.substr(begin, end - begin));
115 <<
"Using '" <<
m_tempdir <<
"' for temp dir"
145 std::string &protocol,
148 size_t p = url.find(
':');
149 if (p != std::string::npos)
151 protocol = url.substr(0,p);
152 rest = url.substr(p+1);
166 std::string protocol;
169 boost::shared_ptr<StorageAccount::Stamp> stats;
177 if (
Storage *storage =
maker->open (protocol, rest, mode))
179 if (dynamic_cast<LocalCacheFile *>(storage))
180 protocol =
"local-cache";
193 err.
addContext(
"Calling StorageFactory::open()");
196 err <<
"Failed to open the file '" << url <<
"'";
206 std::string protocol;
209 boost::shared_ptr<StorageAccount::Stamp> stats;
216 maker->stagein (protocol, rest);
217 if (stats) stats->tick();
222 <<
"Failed to stage in file '" << url <<
"' because:\n"
231 std::string protocol;
235 boost::shared_ptr<StorageAccount::Stamp> stats;
242 ret =
maker->check (protocol, rest, size);
243 if (stats) stats->tick();
248 <<
"Existence or size check for the file '" << url <<
"' failed because:\n"
258 const std::string &proto,
259 const std::string &
path,
280 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)
static PFTauRenderPlugin instance
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 message() const
unsigned int m_debugLevel
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
void addAdditionalInfo(std::string const &info)
void setDebugLevel(unsigned int level)
static Counter & counter(const std::string &storageClass, const std::string &operation)
ReadHint readHint(void) const
void addContext(std::string const &context)
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)
unsigned int debugLevel(void) const