13 #include "XrdCl/XrdClDefaultEnv.hh" 14 #include "XrdNet/XrdNetUtils.hh" 23 XrdCl::AnyObject *response )
override 35 static const unsigned int XRD_DEFAULT_TIMEOUT = 3*60;
45 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
48 env->PutString(
"NetworkStack",
"IPAuto");
50 XrdNetUtils::SetAuto(XrdNetUtils::prefAuto);
51 setTimeout(XRD_DEFAULT_TIMEOUT);
76 auto file = std::make_unique<XrdFile>(fullpath,
mode);
87 XrdCl::URL
url(fullpath);
88 XrdCl::FileSystem fs(url);
89 std::vector<std::string> fileList; fileList.push_back(url.GetPath());
90 auto status = fs.Prepare(fileList, XrdCl::PrepareFlags::Stage, 0, &m_null_handler);
93 edm::LogWarning(
"StageInError") <<
"XrdCl::FileSystem::Prepare failed with error '" 94 <<
status.ToStr() <<
"' (errNo = " <<
status.errNo <<
")";
107 XrdCl::URL
url(fullpath);
108 XrdCl::FileSystem fs(url);
110 XrdCl::StatInfo *
stat;
111 if (!(fs.Stat(url.GetPath(),
stat)).IsOK() || (stat ==
nullptr))
122 auto oldLevel = m_lastDebugLevel.load();
123 if(level == oldLevel) {
126 std::lock_guard<std::mutex> guard(m_envMutex);
127 if(oldLevel != m_lastDebugLevel) {
137 XrdCl::DefaultEnv::SetLogLevel(
"Warning");
140 XrdCl::DefaultEnv::SetLogLevel(
"Info");
143 XrdCl::DefaultEnv::SetLogLevel(
"Debug");
146 XrdCl::DefaultEnv::SetLogLevel(
"Dump");
149 XrdCl::DefaultEnv::SetLogLevel(
"Dump");
153 ex <<
"Invalid log level specified " <<
level;
154 ex.
addContext(
"Calling XrdStorageMaker::setDebugLevel()");
157 m_lastDebugLevel =
level;
162 timeout = timeout ? timeout : XRD_DEFAULT_TIMEOUT;
164 auto oldTimeout = m_lastTimeout.load();
165 if (oldTimeout == timeout) {
169 std::lock_guard<std::mutex> guard(m_envMutex);
170 if (oldTimeout != m_lastTimeout) {
175 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
178 env->PutInt(
"StreamTimeout", timeout);
179 env->PutInt(
"RequestTimeout", timeout);
180 env->PutInt(
"ConnectionWindow", timeout);
181 env->PutInt(
"StreamErrorWindow", timeout);
185 env->PutInt(
"ConnectionWindow", timeout/6+1);
186 env->PutInt(
"ConnectionRetry", 2);
static boost::mutex mutex
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
bool check(const std::string &proto, const std::string &path, const AuxSettings &aux, IOOffset *size=0) const override
MakerResponseHandler m_null_handler
std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &aux) const override
void stagein(const std::string &proto, const std::string &path, const AuxSettings &aux) const override
static const StorageFactory * get(void)
void setTimeout(unsigned int timeout) const
std::atomic< unsigned int > m_lastTimeout
#define DEFINE_FWK_SERVICE(type)
ReadHint readHint(void) const
void addContext(std::string const &context)
void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setDebugLevel(unsigned int level) const