CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | 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
 
- Public Member Functions inherited from StorageMaker
 StorageMaker (void)
 
virtual ~StorageMaker (void)
 

Private Attributes

unsigned int timeout_ = 0
 

Detailed Description

Definition at line 9 of file XrdStorageMaker.cc.

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 59 of file XrdStorageMaker.cc.

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

62  {
63  std::string fullpath(proto + ":" + path);
64  XrdClientAdmin admin(fullpath.c_str());
65  if (! admin.Connect())
66  return false; // FIXME: Throw?
67 
68  long id;
69  long flags;
70  long modtime;
71  long long xrdsize;
72 
73  XrdOucString str(fullpath.c_str());
74  XrdClientUrlSet url(str);
75 
76  if (! admin.Stat(url.GetFile().c_str(), id, xrdsize, flags, modtime))
77  return false; // FIXME: Throw?
78 
79  *size = xrdsize;
80  return true;
81  }
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
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 17 of file XrdStorageMaker.cc.

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

20  {
21  // The important part here is not the cache size (which will get
22  // auto-adjusted), but the fact the cache is set to something non-zero.
23  // If we don't do this before creating the XrdFile object, caching will be
24  // completely disabled, resulting in poor performance.
25  EnvPutInt(NAME_READCACHESIZE, 20*1024*1024);
26 
27  // XrdClient has various timeouts which vary from 3 minutes to 8 hours.
28  // This enforces an even default (10 minutes) more appropriate for the
29  // cmsRun case.
30  if (timeout_ <= 0) {setTimeout(600);}
31 
33  StorageFactory::ReadHint readHint = f->readHint();
34  StorageFactory::CacheHint cacheHint = f->cacheHint();
35 
37  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
38  mode &= ~IOFlags::OpenUnbuffered;
39  else
41 
42  std::string fullpath(proto + ":" + path);
43  Storage *file = new XrdFile (fullpath, mode);
44  return f->wrapNonLocalFile(file, proto, std::string(), mode);
45  }
CacheHint cacheHint(void) const
virtual void setTimeout(unsigned int timeout) override
Storage * wrapNonLocalFile(Storage *s, const std::string &proto, const std::string &path, int mode)
unsigned int timeout_
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 83 of file XrdStorageMaker.cc.

84  {
85  EnvPutInt("DebugLevel", level);
86  }
tuple level
Definition: testEve_cfg.py:34
virtual void XrdStorageMaker::setTimeout ( unsigned int  timeout)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 88 of file XrdStorageMaker.cc.

References timeout_.

Referenced by open().

89  {
90  timeout_ = timeout;
91  if (timeout == 0) {return;}
92  EnvPutInt("ConnectTimeout", timeout/3+1); // Default 120. This should allow multiple connections to timeout before the open fails.
93  EnvPutInt("RequestTimeout", timeout/3+1); // Default 300. This should allow almost three requests to be performed before the transaction times out.
94  EnvPutInt("TransactionTimeout", timeout); // Default 28800
95 
96  // Safety mechanism - if client is redirected more than 255 times in 600
97  // seconds, then we abort the interaction.
98  EnvPutInt("RedirCntTimeout", 600); // Default 36000
99 
100  // Enforce some CMS defaults.
101  EnvPutInt("MaxRedirectcount", 32); // Default 16
102  EnvPutInt("ReconnectWait", 5); // Default 5
103  }
unsigned int timeout_
virtual void XrdStorageMaker::stagein ( const std::string &  proto,
const std::string &  path 
)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 47 of file XrdStorageMaker.cc.

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

48  {
49  std::string fullpath(proto + ":" + path);
50  XrdClientAdmin admin(fullpath.c_str());
51  if (admin.Connect())
52  {
53  XrdOucString str(fullpath.c_str());
54  XrdClientUrlSet url(str);
55  admin.Prepare(url.GetFile().c_str(), kXR_stage | kXR_noerrs, 0);
56  }
57  }
tuple path
else: Piece not in the list, fine.

Member Data Documentation

unsigned int XrdStorageMaker::timeout_ = 0
private

Definition at line 12 of file XrdStorageMaker.cc.

Referenced by open(), and setTimeout().