12 #include "XrdCl/XrdClDefaultEnv.hh" 13 #include "XrdNet/XrdNetUtils.hh" 22 XrdCl::AnyObject *response )
34 static const unsigned int XRD_DEFAULT_TIMEOUT = 3*60;
44 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
47 env->PutString(
"NetworkStack",
"IPAuto");
49 XrdNetUtils::SetAuto(XrdNetUtils::prefAuto);
50 setTimeout(XRD_DEFAULT_TIMEOUT);
75 auto file = std::make_unique<XrdFile>(fullpath,
mode);
86 XrdCl::URL
url(fullpath);
87 XrdCl::FileSystem fs(url);
88 std::vector<std::string> fileList; fileList.push_back(url.GetPath());
89 auto status = fs.Prepare(fileList, XrdCl::PrepareFlags::Stage, 0, &m_null_handler);
92 edm::LogWarning(
"StageInError") <<
"XrdCl::FileSystem::Prepare failed with error '" 93 <<
status.ToStr() <<
"' (errNo = " <<
status.errNo <<
")";
106 XrdCl::URL
url(fullpath);
107 XrdCl::FileSystem fs(url);
109 XrdCl::StatInfo *
stat;
110 if (!(fs.Stat(url.GetPath(),
stat)).IsOK() || (stat ==
nullptr))
121 auto oldLevel = m_lastDebugLevel.load();
122 if(level == oldLevel) {
125 std::lock_guard<std::mutex> guard(m_envMutex);
126 if(oldLevel != m_lastDebugLevel) {
136 XrdCl::DefaultEnv::SetLogLevel(
"Warning");
139 XrdCl::DefaultEnv::SetLogLevel(
"Info");
142 XrdCl::DefaultEnv::SetLogLevel(
"Debug");
145 XrdCl::DefaultEnv::SetLogLevel(
"Dump");
148 XrdCl::DefaultEnv::SetLogLevel(
"Dump");
152 ex <<
"Invalid log level specified " <<
level;
153 ex.
addContext(
"Calling XrdStorageMaker::setDebugLevel()");
156 m_lastDebugLevel =
level;
161 timeout = timeout ? timeout : XRD_DEFAULT_TIMEOUT;
163 auto oldTimeout = m_lastTimeout.load();
164 if (oldTimeout == timeout) {
168 std::lock_guard<std::mutex> guard(m_envMutex);
169 if (oldTimeout != m_lastTimeout) {
174 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
177 env->PutInt(
"StreamTimeout", timeout);
178 env->PutInt(
"RequestTimeout", timeout);
179 env->PutInt(
"ConnectionWindow", timeout);
180 env->PutInt(
"StreamErrorWindow", timeout);
184 env->PutInt(
"ConnectionWindow", timeout/6+1);
185 env->PutInt(
"ConnectionRetry", 2);
CacheHint cacheHint(void) const
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
std::atomic< unsigned int > m_lastDebugLevel
virtual std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &aux) const override
static boost::mutex mutex
MakerResponseHandler m_null_handler
static const StorageFactory * get(void)
void setTimeout(unsigned int timeout) const
std::atomic< unsigned int > m_lastTimeout
virtual void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response)
#define DEFINE_FWK_SERVICE(type)
virtual bool check(const std::string &proto, const std::string &path, const AuxSettings &aux, IOOffset *size=0) const override
ReadHint readHint(void) const
void addContext(std::string const &context)
#define DEFINE_EDM_PLUGIN(factory, type, name)
virtual void stagein(const std::string &proto, const std::string &path, const AuxSettings &aux) const override
void setDebugLevel(unsigned int level) const