CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Private Attributes
XrdStorageMaker Class Reference
Inheritance diagram for XrdStorageMaker:
StorageMaker

Public Member Functions

virtual bool check (const std::string &proto, const std::string &path, IOOffset *size=0) override
 
virtual Storageopen (const std::string &proto, const std::string &path, int mode) override
 
virtual void setDebugLevel (unsigned int level) override
 
virtual void setTimeout (unsigned int timeout) override
 
virtual void stagein (const std::string &proto, const std::string &path) override
 
 XrdStorageMaker ()
 
- Public Member Functions inherited from StorageMaker
 StorageMaker (void)
 
virtual ~StorageMaker (void)
 

Static Public Attributes

static const unsigned int XRD_DEFAULT_TIMEOUT = 3*60
 

Private Attributes

MakerResponseHandler m_null_handler
 

Detailed Description

Definition at line 25 of file XrdStorageMaker.cc.

Constructor & Destructor Documentation

XrdStorageMaker::XrdStorageMaker ( )
inline

Definition at line 30 of file XrdStorageMaker.cc.

References web.browse_db::env, setTimeout(), and XRD_DEFAULT_TIMEOUT.

31  {
32  // When CMSSW loads, both XrdCl and XrdClient end up being loaded
33  // (ROOT loads XrdClient). XrdClient forces IPv4-only. Accordingly,
34  // we must explicitly set the default network stack in XrdCl to
35  // whatever is available on the node (IPv4 or IPv6).
36  XrdCl::Env *env = XrdCl::DefaultEnv::GetEnv();
37  if (env)
38  {
39  env->PutString("NetworkStack", "IPAuto");
40  }
41  XrdNetUtils::SetAuto(XrdNetUtils::prefAuto);
43  }
virtual void setTimeout(unsigned int timeout) override
static const unsigned int XRD_DEFAULT_TIMEOUT

Member Function Documentation

virtual bool XrdStorageMaker::check ( const std::string &  proto,
const std::string &  path,
IOOffset size = 0 
)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 76 of file XrdStorageMaker.cc.

References findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, and relmon_authenticated_wget::url.

79  {
80  std::string fullpath(proto + ":" + path);
81  XrdCl::URL url(fullpath);
82  XrdCl::FileSystem fs(url);
83 
84  XrdCl::StatInfo *stat;
85  if (!(fs.Stat(url.GetPath(), stat)).IsOK() || (stat == nullptr))
86  {
87  return false;
88  }
89 
90  if (size) *size = stat->GetSize();
91  return true;
92  }
tuple path
else: Piece not in the list, fine.
tuple size
Write out results.
virtual Storage* XrdStorageMaker::open ( const std::string &  proto,
const std::string &  path,
int  mode 
)
inlineoverridevirtual

Open a storage object for the given URL (protocol + path), using the mode bits. No temporary files are downloaded.

Implements StorageMaker.

Definition at line 47 of file XrdStorageMaker.cc.

References StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, mergeVDriftHistosByStation::file, StorageFactory::get(), IOFlags::OpenUnbuffered, StorageFactory::READ_HINT_UNBUFFERED, StorageFactory::readHint(), AlCaHLTBitMon_QueryRunRegistry::string, and StorageFactory::wrapNonLocalFile().

50  {
51 
53  StorageFactory::ReadHint readHint = f->readHint();
54  StorageFactory::CacheHint cacheHint = f->cacheHint();
55 
57  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
58  mode &= ~IOFlags::OpenUnbuffered;
59  else
61 
62  std::string fullpath(proto + ":" + path);
63  Storage *file = new XrdFile (fullpath, mode);
64  return f->wrapNonLocalFile(file, proto, std::string(), mode);
65  }
CacheHint cacheHint(void) const
Storage * wrapNonLocalFile(Storage *s, const std::string &proto, const std::string &path, int mode)
static StorageFactory * get(void)
tuple path
else: Piece not in the list, fine.
double f[11][100]
ReadHint readHint(void) const
virtual void XrdStorageMaker::setDebugLevel ( unsigned int  level)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 94 of file XrdStorageMaker.cc.

References cms::Exception::addContext(), edm::errors::Configuration, and testEve_cfg::level.

95  {
96  // 'Error' is way too low of debug level - we have interest
97  // in warning in the default
98  switch (level)
99  {
100  case 0:
101  XrdCl::DefaultEnv::SetLogLevel("Warning");
102  break;
103  case 1:
104  XrdCl::DefaultEnv::SetLogLevel("Info");
105  break;
106  case 2:
107  XrdCl::DefaultEnv::SetLogLevel("Debug");
108  break;
109  case 3:
110  XrdCl::DefaultEnv::SetLogLevel("Dump");
111  break;
112  case 4:
113  XrdCl::DefaultEnv::SetLogLevel("Dump");
114  break;
115  default:
117  ex << "Invalid log level specified " << level;
118  ex.addContext("Calling XrdStorageMaker::setDebugLevel()");
119  throw ex;
120  }
121  }
tuple level
Definition: testEve_cfg.py:34
virtual void XrdStorageMaker::setTimeout ( unsigned int  timeout)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 123 of file XrdStorageMaker.cc.

References web.browse_db::env, and XRD_DEFAULT_TIMEOUT.

Referenced by XrdStorageMaker().

124  {
125  timeout = timeout ? timeout : XRD_DEFAULT_TIMEOUT;
126  XrdCl::Env *env = XrdCl::DefaultEnv::GetEnv();
127  if (env)
128  {
129  env->PutInt("StreamTimeout", timeout);
130  env->PutInt("RequestTimeout", timeout);
131  env->PutInt("ConnectionWindow", timeout);
132  env->PutInt("StreamErrorWindow", timeout);
133  // Crank down some of the connection defaults. We have more
134  // aggressive error recovery than the default client so we
135  // can error out sooner.
136  env->PutInt("ConnectionWindow", timeout/6+1);
137  env->PutInt("ConnectionRetry", 2);
138  }
139  }
static const unsigned int XRD_DEFAULT_TIMEOUT
virtual void XrdStorageMaker::stagein ( const std::string &  proto,
const std::string &  path 
)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 67 of file XrdStorageMaker.cc.

References m_null_handler, AlCaHLTBitMon_QueryRunRegistry::string, and relmon_authenticated_wget::url.

68  {
69  std::string fullpath(proto + ":" + path);
70  XrdCl::URL url(fullpath);
71  XrdCl::FileSystem fs(url);
72  std::vector<std::string> fileList; fileList.push_back(url.GetPath());
73  fs.Prepare(fileList, XrdCl::PrepareFlags::Stage, 0, &m_null_handler);
74  }
MakerResponseHandler m_null_handler
tuple path
else: Piece not in the list, fine.

Member Data Documentation

MakerResponseHandler XrdStorageMaker::m_null_handler
private

Definition at line 142 of file XrdStorageMaker.cc.

Referenced by stagein().

const unsigned int XrdStorageMaker::XRD_DEFAULT_TIMEOUT = 3*60
static

Definition at line 28 of file XrdStorageMaker.cc.

Referenced by setTimeout(), and XrdStorageMaker().