13 #include "XrdCl/XrdClDefaultEnv.hh" 14 #include "XrdNet/XrdNetUtils.hh" 21 class PrepareHandler :
public XrdCl::ResponseHandler {
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 {
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;
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();
110 IOOffset *size =
nullptr)
const override {
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()");
174 std::lock_guard<std::mutex> guard(
m_envMutex);
180 XrdCl::Env *
env = XrdCl::DefaultEnv::GetEnv();
189 env->PutInt(
"ConnectionWindow",
timeout / 6 + 1);
190 env->PutInt(
"ConnectionRetry", 2);
192 env->PutInt(
"RunForkHandler", 0);
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 setDebugLevel(unsigned int level) const
void stagein(const std::string &proto, const std::string &path, const AuxSettings &aux) const override
std::atomic< unsigned int > m_lastTimeout
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)
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setTimeout(unsigned int timeout) const
std::atomic< unsigned int > m_lastDebugLevel
static const StorageFactory * get(void)