13 using namespace edm::storage;
18 : m_cacheHint(CACHE_HINT_AUTO_DETECT),
19 m_readHint(READ_HINT_AUTO),
22 m_temppath(
".:$TMPDIR"),
61 <<
"Considering path '" << s
62 <<
"', min free space " << minFreeSpace
63 <<
"GB for temp dir" << std::endl;
67 std::vector<std::string>
dirs;
68 dirs.reserve(
std::count(s.begin(), s.end(),
':') + 1);
71 size_t end = s.find(
':', begin);
72 if (end == std::string::npos) {
73 dirs.push_back(s.substr(begin, end));
76 dirs.push_back(s.substr(begin, end - begin));
87 <<
"Using '" <<
m_tempdir <<
"' for temp dir"
101 return itFound->second.get();
110 return insertResult.first->second.get();
114 size_t p = url.find(
':');
115 if (p != std::string::npos) {
116 protocol = url.substr(0, p);
117 rest = url.substr(p + 1);
129 std::unique_ptr<Storage>
ret;
130 std::unique_ptr<StorageAccount::Stamp>
stats;
137 if (
auto storage = maker->open(
139 if (dynamic_cast<LocalCacheFile *>(storage.get()))
140 protocol =
"local-cache";
143 ret = std::make_unique<StorageAccountProxy>(protocol,
std::move(storage));
151 err.
addContext(
"Calling StorageFactory::open()");
154 err <<
"Failed to open the file '" << url <<
"'";
165 std::unique_ptr<StorageAccount::Stamp>
stats;
166 if (
StorageMaker *maker = getMaker(url, protocol, rest)) {
168 auto token = StorageAccount::tokenForStorageClassName(protocol);
177 edm::LogWarning(
"StorageFactory::stagein()") <<
"Failed to stage in file '" << url <<
"' because:\n"
188 std::unique_ptr<StorageAccount::Stamp>
stats;
189 if (
StorageMaker *maker = getMaker(url, protocol, rest)) {
191 auto token = StorageAccount::tokenForStorageClassName(protocol);
201 <<
"Existence or size check for the file '" << url <<
"' failed because:\n"
209 std::unique_ptr<Storage> StorageFactory::wrapNonLocalFile(std::unique_ptr<Storage>
s,
214 if ((hint == StorageFactory::CACHE_HINT_LAZY_DOWNLOAD) || (mode &
IOFlags::OpenWrap)) {
217 }
else if (m_tempdir.empty()) {
219 }
else if ((not path.empty()) and m_lfs.isLocalPath(path)) {
223 s = std::make_unique<StorageAccountProxy>(proto,
std::move(s));
225 s = std::make_unique<LocalCacheFile>(
std::move(s), m_tempdir);
std::string tempDir(void) const
tuple ret
prodAgent to be discontinued
static StorageClassToken tokenForStorageClassName(std::string const &iName)
double tempMinFree(void) const
static PluginManager & configure(const Config &)
void setReadHint(ReadHint value)
static PFTauRenderPlugin instance
virtual std::string explainSelf() const
AuxSettings & setTimeout(unsigned int iTime)
static Counter & counter(StorageClassToken token, Operation operation)
unsigned int m_debugLevel
std::pair< std::string, std::string > findCachePath(const std::vector< std::string > &paths, double minFreeSpace) const
void setTimeout(unsigned int timeout)
std::string message() const
ReadHint readHint(void) const
unsigned int debugLevel(void) const
CacheHint cacheHint(void) const
static bool isAvailable()
void setTempDir(const std::string &s, double minFreeSpace)
unsigned int timeout(void) const
Container::value_type value_type
bool enableAccounting(bool enabled)
PluginManager::Config config()
static StorageFactory s_instance
StorageMaker * getMaker(const std::string &proto) const
void addAdditionalInfo(std::string const &info)
std::string m_unusableDirWarnings
void setCacheHint(CacheHint value)
static StorageFactory * getToModify(void)
bool accounting(void) const
void addContext(std::string const &context)
std::unique_ptr< Storage > open(const std::string &url, int mode=IOFlags::OpenRead) const
static std::atomic< unsigned int > counter
void setDebugLevel(unsigned int level)
AuxSettings & setDebugLevel(unsigned int iLevel)
Log< level::Warning, false > LogWarning
static const StorageFactory * get(void)
tuple size
Write out results.
std::string tempPath(void) const