13 #include "XrdCl/XrdClDefaultEnv.hh"
14 #include "XrdNet/XrdNetUtils.hh"
21 class PrepareHandler :
public XrdCl::ResponseHandler {
23 PrepareHandler(
const XrdCl::URL &
url) : m_fs(url) { m_fileList.push_back(url.GetPath()); }
25 void callAsyncPrepare() {
26 auto status = m_fs.Prepare(m_fileList, XrdCl::PrepareFlags::Stage, 0,
this);
28 LogDebug(
"StageInError") <<
"XrdCl::FileSystem::Prepare submit failed with error '" <<
status.ToStr()
29 <<
"' (errNo = " <<
status.errNo <<
")";
34 void HandleResponse(XrdCl::XRootDStatus *
status, XrdCl::AnyObject *
response)
override {
36 if (!status->IsOK()) {
37 LogDebug(
"StageInError") <<
"XrdCl::FileSystem::Prepare failed with error '" << status->ToStr()
38 <<
"' (errNo = " << status->errNo <<
")";
46 XrdCl::FileSystem m_fs;
47 std::vector<std::string> m_fileList;
52 namespace edm::storage {
64 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
66 env->PutString(
"NetworkStack",
"IPAuto");
68 XrdNetUtils::SetAuto(XrdNetUtils::prefAuto);
103 auto prep_handler =
new PrepareHandler(url);
104 prep_handler->callAsyncPrepare();
116 XrdCl::FileSystem
fs(url);
118 XrdCl::StatInfo *
stat;
119 if (!(fs.Stat(url.GetPath(),
stat)).IsOK() || (stat ==
nullptr)) {
124 *
size = stat->GetSize();
130 if (level == oldLevel) {
133 std::lock_guard<std::mutex> guard(
m_envMutex);
143 XrdCl::DefaultEnv::SetLogLevel(
"Warning");
146 XrdCl::DefaultEnv::SetLogLevel(
"Info");
149 XrdCl::DefaultEnv::SetLogLevel(
"Debug");
152 XrdCl::DefaultEnv::SetLogLevel(
"Dump");
155 XrdCl::DefaultEnv::SetLogLevel(
"Dump");
159 ex <<
"Invalid log level specified " <<
level;
160 ex.
addContext(
"Calling XrdStorageMaker::setDebugLevel()");
170 if (oldTimeout == timeout) {
174 std::lock_guard<std::mutex> guard(
m_envMutex);
180 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
182 env->PutInt(
"StreamTimeout", timeout);
183 env->PutInt(
"RequestTimeout", timeout);
184 env->PutInt(
"ConnectionWindow", timeout);
185 env->PutInt(
"StreamErrorWindow", timeout);
189 env->PutInt(
"ConnectionWindow", timeout / 6 + 1);
190 env->PutInt(
"ConnectionRetry", 2);
192 env->PutInt(
"RunForkHandler", 0);
204 using namespace edm::storage;
bool check(const std::string &proto, const std::string &path, const AuxSettings &aux, IOOffset *size=nullptr) const override
#define DEFINE_FWK_SERVICE_MAKER(concrete, maker)
void stagein(const std::string &proto, const std::string &path, const AuxSettings &aux) const override
std::atomic< unsigned int > m_lastTimeout
ReadHint readHint(void) const
CacheHint cacheHint(void) const
void setDebugLevel(unsigned int level) const
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
static const unsigned int XRD_DEFAULT_TIMEOUT
std::unique_ptr< Storage > open(const std::string &proto, const std::string &path, int mode, const AuxSettings &aux) const override
void addContext(std::string const &context)
void setTimeout(unsigned int timeout) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::atomic< unsigned int > m_lastDebugLevel
static const StorageFactory * get(void)
tuple size
Write out results.