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 Private Member Functions
DCacheStorageMaker Class Reference
Inheritance diagram for DCacheStorageMaker:
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 setTimeout (unsigned int timeout) override
 
virtual void stagein (const std::string &proto, const std::string &path) override
 
- Public Member Functions inherited from StorageMaker
virtual void setDebugLevel (unsigned int debugLevel)
 
 StorageMaker (void)
 
virtual ~StorageMaker (void)
 

Static Private Member Functions

static std::string normalise (const std::string &proto, const std::string &path)
 

Detailed Description

Definition at line 9 of file DCacheStorageMaker.cc.

Member Function Documentation

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

Reimplemented from StorageMaker.

Definition at line 64 of file DCacheStorageMaker.cc.

References normalise(), findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

67  {
68  std::string testpath (normalise (proto, path));
69  if (dc_access (testpath.c_str (), R_OK) != 0)
70  return false;
71 
72  if (size)
73  {
74  struct stat64 buf;
75  if (dc_stat64 (testpath.c_str (), &buf) != 0)
76  return false;
77 
78  *size = buf.st_size;
79  }
80 
81  return true;
82  }
tuple path
else: Piece not in the list, fine.
static std::string normalise(const std::string &proto, const std::string &path)
tuple size
Write out results.
static std::string DCacheStorageMaker::normalise ( const std::string &  proto,
const std::string &  path 
)
inlinestaticprivate

Return appropriate path for use with dcap library. If the path is in the URL form ([gsi]dcap://host:port/path), return the full URL as it is. If the path is /pnfs form (dcap:/pnfs/path), return only the path part, unless the protocol is 'gsidcap', in which case return the whole thing.

Definition at line 15 of file DCacheStorageMaker.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by check(), open(), and stagein().

16  {
17  size_t p = path.find("/pnfs");
18  if (p < 3)
19  return (proto == "gsidcap") ? proto + ':' + path.substr(p) : path.substr(p);
20 
21  // remove multiple "/"
22  p = path.find_first_not_of('/');
23 
24  // it's url, return the full thing
25  return proto + "://" + path.substr(p);
26  }
tuple path
else: Piece not in the list, fine.
virtual Storage* DCacheStorageMaker::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 32 of file DCacheStorageMaker.cc.

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

35  {
37  StorageFactory::ReadHint readHint = f->readHint();
38  StorageFactory::CacheHint cacheHint = f->cacheHint();
39 
41  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
42  mode &= ~IOFlags::OpenUnbuffered;
43  else
45 
46  Storage *file = new DCacheFile(normalise(proto, path), mode);
47  return f->wrapNonLocalFile(file, proto, std::string(), mode);
48  }
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
static std::string normalise(const std::string &proto, const std::string &path)
virtual void DCacheStorageMaker::setTimeout ( unsigned int  timeout)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 84 of file DCacheStorageMaker.cc.

84  {
85  if (timeout != 0) dc_setOpenTimeout(timeout);
86  }
virtual void DCacheStorageMaker::stagein ( const std::string &  proto,
const std::string &  path 
)
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 50 of file DCacheStorageMaker.cc.

References cms::Exception::addContext(), normalise(), and AlCaHLTBitMon_QueryRunRegistry::string.

52  {
53  std::string npath = normalise(proto, path);
54  if (dc_stage(npath.c_str(), 0, 0) != 0) {
55  cms::Exception ex("FileStageInError");
56  ex << "Cannot stage in file '" << npath
57  << "', error was: " << dc_strerror(dc_errno)
58  << " (dc_errno=" << dc_errno << ")";
59  ex.addContext("Calling DCacheStorageMaker::stagein()");
60  throw ex;
61  }
62  }
tuple path
else: Piece not in the list, fine.
static std::string normalise(const std::string &proto, const std::string &path)