10 #include <boost/shared_ptr.hpp>
15 : m_cacheHint(CACHE_HINT_AUTO_DETECT),
16 m_readHint(READ_HINT_AUTO),
19 m_temppath (
".:$TMPDIR"),
83 <<
"Considering path '" << s
84 <<
"', min free space " << minFreeSpace
85 <<
"GB for temp dir" << std::endl;
89 std::vector<std::string>
dirs;
90 dirs.reserve(
std::count(s.begin(), s.end(),
':') + 1);
94 size_t end = s.find(
':', begin);
95 if (end == std::string::npos)
97 dirs.push_back(s.substr(begin, end));
102 dirs.push_back(s.substr(begin, end - begin));
113 <<
"Using '" <<
m_tempdir <<
"' for temp dir"
133 auto itFound =
m_makers.find(proto);
135 return itFound->second.get();
144 return insertResult.first->second.get();
152 size_t p = url.find(
':');
153 if (p != std::string::npos)
155 protocol = url.substr(0,p);
156 rest = url.substr(p+1);
173 boost::shared_ptr<StorageAccount::Stamp> stats;
181 if (
Storage *storage = maker->open (protocol, rest, mode))
183 if (dynamic_cast<LocalCacheFile *>(storage))
184 protocol =
"local-cache";
197 err.
addContext(
"Calling StorageFactory::open()");
200 err <<
"Failed to open the file '" << url <<
"'";
213 boost::shared_ptr<StorageAccount::Stamp> stats;
220 maker->stagein (protocol, rest);
221 if (stats) stats->tick();
226 <<
"Failed to stage in file '" << url <<
"' because:\n"
239 boost::shared_ptr<StorageAccount::Stamp> stats;
246 ret = maker->check (protocol, rest, size);
247 if (stats) stats->tick();
252 <<
"Existence or size check for the file '" << url <<
"' failed because:\n"
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)
tuple path
else: Piece not in the list, fine.
PluginManager::Config config()
std::string tempDir(void) const
unsigned int timeout(void) const
void addAdditionalInfo(std::string const &info)
void setDebugLevel(unsigned int level)
Container::value_type value_type
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)
volatile std::atomic< bool > shutdown_flag false
tuple size
Write out results.
T get(const Candidate &c)
unsigned int debugLevel(void) const