#include <StreamHandler.h>
Public Member Functions | |
void | closeAllFiles () |
bool | closeFilesForLumiSection (const uint32_t &lumiSection, std::string &) |
void | closeTimedOutFiles (utils::TimePoint_t currentTime=utils::getCurrentTime()) |
StreamHandler (const SharedResourcesPtr, const DbFileHandlerPtr) | |
void | writeEvent (const I2OChain &event) |
virtual | ~StreamHandler () |
Protected Types | |
typedef std::map< std::string, unsigned int > | CoreFileNamesMap |
typedef boost::shared_ptr < FileHandler > | FileHandlerPtr |
typedef std::vector < FileHandlerPtr > | FileHandlers |
Protected Member Functions | |
virtual double | fractionToDisk () const =0 |
virtual FileHandlerPtr | getFileHandler (const I2OChain &event) |
unsigned long long | getMaxFileSize () const |
FilesMonitorCollection::FileRecordPtr | getNewFileRecord (const I2OChain &event) |
virtual int | getStreamMaxFileSize () const =0 |
virtual FileHandlerPtr | newFileHandler (const I2OChain &event)=0 |
virtual std::string | streamLabel () const =0 |
Protected Attributes | |
const DbFileHandlerPtr | dbFileHandler_ |
const DiskWritingParams & | diskWritingParams_ |
FileHandlers | fileHandlers_ |
const SharedResourcesPtr | sharedResources_ |
const StatisticsReporterPtr | statReporter_ |
const StreamsMonitorCollection::StreamRecordPtr | streamRecord_ |
CoreFileNamesMap | usedCoreFileNames_ |
Private Member Functions | |
bool | fileTooLarge (const FileHandlerPtr, const unsigned long &dataSize) const |
std::string | getBaseFilePath (const uint32_t &runNumber, uint32_t fileCount) const |
std::string | getCoreFileName (const uint32_t &runNumber, const uint32_t &lumiSection) const |
unsigned int | getFileCounter (const std::string &coreFileName) |
std::string | getFileSystem (const uint32_t &runNumber, uint32_t fileCount) const |
StreamHandler & | operator= (StreamHandler const &) |
StreamHandler (StreamHandler const &) | |
Abstract class to handle one stream written to disk.
Definition at line 31 of file StreamHandler.h.
|
protected |
Definition at line 145 of file StreamHandler.h.
|
protected |
Definition at line 67 of file StreamHandler.h.
|
protected |
Definition at line 142 of file StreamHandler.h.
stor::StreamHandler::StreamHandler | ( | const SharedResourcesPtr | sharedResources, |
const DbFileHandlerPtr | dbFileHandler | ||
) |
Definition at line 16 of file StreamHandler.cc.
|
inlinevirtual |
Definition at line 37 of file StreamHandler.h.
|
private |
void stor::StreamHandler::closeAllFiles | ( | ) |
Gracefully close all open files
Definition at line 28 of file StreamHandler.cc.
References alignCSCRings::e, stor::AlarmHandler::ERROR, cppFunctionSkipper::exception, edm::hlt::Exception, fileHandlers_, stor::FilesMonitorCollection::FileRecord::runEnded, sharedResources_, streamLabel(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by stor::DiskWriter::destroyStreams(), and stor::FaultyEventStreamHandler::getFileHandler().
bool stor::StreamHandler::closeFilesForLumiSection | ( | const uint32_t & | lumiSection, |
std::string & | str | ||
) |
Close all files which belong to the given lumi section and print number of files for this lumi section into the passed string. Returns true if at least one file was closed.
Definition at line 79 of file StreamHandler.cc.
References stor::FileHandler::isFromLumiSection().
void stor::StreamHandler::closeTimedOutFiles | ( | utils::TimePoint_t | currentTime = utils::getCurrentTime() | ) |
Close all files which are have not seen any recent events
Definition at line 67 of file StreamHandler.cc.
References fileHandlers_, and stor::FileHandler::tooOld().
Referenced by stor::DiskWriter::closeTimedOutFiles().
|
private |
Return true if the file would become too large when adding dataSize in Bytes
|
protectedpure virtual |
Return the fraction-to-disk parameter
Implemented in stor::EventStreamHandler, stor::FRDStreamHandler, and stor::FaultyEventStreamHandler.
Referenced by stor::FaultyEventStreamHandler::FaultyEventStreamHandler().
|
private |
Get path w/o working directory
Definition at line 160 of file StreamHandler.cc.
Referenced by getNewFileRecord().
|
private |
Get the core file name
Definition at line 193 of file StreamHandler.cc.
References StorageManager_cfg::streamLabel.
Referenced by getNewFileRecord().
|
private |
Get the instance count of this core file name
Definition at line 210 of file StreamHandler.cc.
References pos, and usedCoreFileNames_.
Referenced by getNewFileRecord().
|
protectedvirtual |
Get the file handler responsible for the event
Reimplemented in stor::FaultyEventStreamHandler.
Definition at line 105 of file StreamHandler.cc.
References fileHandlers_, newFileHandler(), and stor::I2OChain::totalDataSize().
Referenced by writeEvent().
|
private |
Get file system string
Definition at line 170 of file StreamHandler.cc.
|
protected |
Return the maximum file size in bytes
Definition at line 226 of file StreamHandler.cc.
References diskWritingParams_, getStreamMaxFileSize(), and stor::DiskWritingParams::maxFileSizeMB_.
Referenced by stor::FRDStreamHandler::newFileHandler(), and stor::EventStreamHandler::newFileHandler().
|
protected |
Return a new file record for the event
Definition at line 131 of file StreamHandler.cc.
References alignCSCRings::e, getBaseFilePath(), getCoreFileName(), getFileCounter(), stor::FilesMonitorCollection::FileRecord::notClosed, sharedResources_, statReporter_, and streamLabel().
Referenced by stor::FRDStreamHandler::newFileHandler(), stor::EventStreamHandler::newFileHandler(), and stor::FaultyEventStreamHandler::newFileHandler().
|
protectedpure virtual |
Return the maximum file size for the stream in MB
Implemented in stor::FaultyEventStreamHandler, stor::EventStreamHandler, and stor::FRDStreamHandler.
Referenced by getMaxFileSize().
|
protectedpure virtual |
Return a new file handler for the provided event
Implemented in stor::FaultyEventStreamHandler, stor::EventStreamHandler, and stor::FRDStreamHandler.
Referenced by getFileHandler().
|
private |
|
protectedpure virtual |
Return the stream label
Implemented in stor::EventStreamHandler, stor::FaultyEventStreamHandler, and stor::FRDStreamHandler.
Referenced by closeAllFiles(), and getNewFileRecord().
void stor::StreamHandler::writeEvent | ( | const I2OChain & | event | ) |
Write the event to the stream file
Definition at line 95 of file StreamHandler.cc.
References getFileHandler(), statReporter_, streamRecord_, and stor::I2OChain::totalDataSize().
|
protected |
Definition at line 140 of file StreamHandler.h.
Referenced by stor::FRDStreamHandler::newFileHandler(), stor::EventStreamHandler::newFileHandler(), and stor::FaultyEventStreamHandler::newFileHandler().
|
protected |
Definition at line 139 of file StreamHandler.h.
Referenced by getMaxFileSize().
|
protected |
Definition at line 143 of file StreamHandler.h.
Referenced by closeAllFiles(), closeTimedOutFiles(), getFileHandler(), stor::FRDStreamHandler::newFileHandler(), stor::EventStreamHandler::newFileHandler(), and stor::FaultyEventStreamHandler::newFileHandler().
|
protected |
Definition at line 136 of file StreamHandler.h.
Referenced by closeAllFiles(), and getNewFileRecord().
|
protected |
Definition at line 137 of file StreamHandler.h.
Referenced by getNewFileRecord(), and writeEvent().
|
protected |
Definition at line 138 of file StreamHandler.h.
Referenced by stor::FaultyEventStreamHandler::fractionToDisk(), stor::FRDStreamHandler::newFileHandler(), stor::EventStreamHandler::newFileHandler(), stor::FaultyEventStreamHandler::newFileHandler(), stor::FaultyEventStreamHandler::streamLabel(), and writeEvent().
|
protected |
Definition at line 146 of file StreamHandler.h.
Referenced by getFileCounter().