Public Member Functions | |
virtual bool | check (const std::string &proto, const std::string &path, IOOffset *size=0) |
virtual Storage * | open (const std::string &proto, const std::string &surl, int mode) |
Private Member Functions | |
std::string | getTURL (const std::string &surl) |
Definition at line 12 of file StormLCGStorageMaker.cc.
virtual bool StormLcgGtStorageMaker::check | ( | const std::string & | proto, |
const std::string & | path, | ||
IOOffset * | size = 0 |
||
) | [inline, virtual] |
Reimplemented from StorageMaker.
Definition at line 77 of file StormLCGStorageMaker.cc.
References getTURL(), and findQualityFiles::size.
std::string StormLcgGtStorageMaker::getTURL | ( | const std::string & | surl | ) | [inline, private] |
Definition at line 15 of file StormLCGStorageMaker.cc.
References Exception, LogDebug, convertSQLitetoXML_cfg::output, L1TEmulatorMonitor_cff::p, and pipe::pipe().
Referenced by check(), and open().
{ // PrepareToGet timeout std::string timeout("300"); if(char *p = getenv("CMS_STORM_LCG_GT_TIMEOUT")) timeout = p; /* Build the command line: -b => no BDII contacted -T srmv2 => necessary with -b -t timeout */ std::string comm("lcg-gt -b -T srmv2 -t " + timeout + " srm:" + surl + " file 2>&1"); LogDebug("StormLCGStorageMaker") << "command: " << comm << std::endl; FILE *pipe = popen(comm.c_str(), "r"); if(! pipe) throw cms::Exception("StormLCGStorageMaker") << "failed to execute lcg-gt command: " << comm; // Get output int ch; std::string output; while ((ch = getc(pipe)) != EOF) output.push_back(ch); pclose(pipe); LogDebug("StormLCGStorageMaker") << "output: " << output << std::endl; // Extract TURL if possible. size_t start = output.find("file:", 0); if (start == std::string::npos) throw cms::Exception("StormLCGStorageMaker") << "no turl found in command '" << comm << "' output:\n" << output; start += 5; std::string turl(output, start, output.find_first_of("\n", start) - start); LogDebug("StormLCGStorageMaker") << "file to open: " << turl << std::endl; return turl; }
virtual Storage* StormLcgGtStorageMaker::open | ( | const std::string & | proto, |
const std::string & | surl, | ||
int | mode | ||
) | [inline, virtual] |
Implements StorageMaker.
Definition at line 58 of file StormLCGStorageMaker.cc.
References StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, reco_application_tbsim_DetSim-Digi_cfg::File, dbtoweb::file, reco::get(), getTURL(), IOFlags::OpenUnbuffered, path(), StorageFactory::READ_HINT_UNBUFFERED, StorageFactory::readHint(), and StorageFactory::wrapNonLocalFile().
{ StorageFactory *f = StorageFactory::get(); StorageFactory::ReadHint readHint = f->readHint(); StorageFactory::CacheHint cacheHint = f->cacheHint(); if (readHint != StorageFactory::READ_HINT_UNBUFFERED || cacheHint == StorageFactory::CACHE_HINT_STORAGE) mode &= ~IOFlags::OpenUnbuffered; else mode |= IOFlags::OpenUnbuffered; std::string path = getTURL(surl); File *file = new File (path, mode); return f->wrapNonLocalFile (file, proto, path, mode); }