CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamHandler.h
Go to the documentation of this file.
1 // $Id: StreamHandler.h,v 1.16 2012/04/04 12:16:58 mommsen Exp $
3 
4 #ifndef EventFilter_StorageManager_StreamHandler_h
5 #define EventFilter_StorageManager_StreamHandler_h
6 
7 #include <stdint.h>
8 
9 #include <boost/shared_ptr.hpp>
10 
15 
16 
17 namespace stor {
18 
19  class FileHandler;
20  class I2OChain;
21 
22 
32  {
33  public:
34 
36 
37  virtual ~StreamHandler() {};
38 
39 
43  void closeAllFiles();
44 
48  void closeTimedOutFiles(utils::TimePoint_t currentTime =
50 
57  bool closeFilesForLumiSection(const uint32_t& lumiSection, std::string&);
58 
62  void writeEvent(const I2OChain& event);
63 
64 
65  protected:
66 
67  typedef boost::shared_ptr<FileHandler> FileHandlerPtr;
68 
72  virtual std::string streamLabel() const = 0;
73 
77  virtual double fractionToDisk() const = 0;
78 
82  virtual FileHandlerPtr newFileHandler(const I2OChain& event) = 0;
83 
88 
92  virtual int getStreamMaxFileSize() const = 0;
93 
97  unsigned long long getMaxFileSize() const;
98 
99 
104 
105  private:
106 
111  bool fileTooLarge(const FileHandlerPtr, const unsigned long& dataSize) const;
112 
116  std::string getBaseFilePath(const uint32_t& runNumber, uint32_t fileCount) const;
117 
121  std::string getFileSystem(const uint32_t& runNumber, uint32_t fileCount) const;
122 
126  std::string getCoreFileName(const uint32_t& runNumber, const uint32_t& lumiSection) const;
127 
131  unsigned int getFileCounter(const std::string& coreFileName);
132 
133 
134  protected:
135 
141 
142  typedef std::vector<FileHandlerPtr> FileHandlers;
144 
145  typedef std::map<std::string, unsigned int> CoreFileNamesMap;
147 
148 
149  private:
150 
151  //Prevent copying of the StreamHandler
154 
155  };
156 
157 } // namespace stor
158 
159 #endif // EventFilter_StorageManager_StreamHandler_h
160 
161 
TimePoint_t getCurrentTime()
Definition: Utils.h:158
CoreFileNamesMap usedCoreFileNames_
std::string getCoreFileName(const uint32_t &runNumber, const uint32_t &lumiSection) const
StreamHandler & operator=(StreamHandler const &)
virtual int getStreamMaxFileSize() const =0
std::vector< FileHandlerPtr > FileHandlers
const StatisticsReporterPtr statReporter_
bool fileTooLarge(const FileHandlerPtr, const unsigned long &dataSize) const
boost::shared_ptr< SharedResources > SharedResourcesPtr
StreamHandler(const SharedResourcesPtr, const DbFileHandlerPtr)
const DbFileHandlerPtr dbFileHandler_
boost::shared_ptr< FileRecord > FileRecordPtr
boost::shared_ptr< StatisticsReporter > StatisticsReporterPtr
unsigned long long getMaxFileSize() const
virtual std::string streamLabel() const =0
unsigned int getFileCounter(const std::string &coreFileName)
std::map< std::string, unsigned int > CoreFileNamesMap
virtual FileHandlerPtr newFileHandler(const I2OChain &event)=0
boost::shared_ptr< DbFileHandler > DbFileHandlerPtr
Definition: DbFileHandler.h:71
std::string getBaseFilePath(const uint32_t &runNumber, uint32_t fileCount) const
boost::shared_ptr< StreamRecord > StreamRecordPtr
boost::posix_time::ptime TimePoint_t
Definition: Utils.h:35
void closeTimedOutFiles(utils::TimePoint_t currentTime=utils::getCurrentTime())
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void writeEvent(const I2OChain &event)
virtual FileHandlerPtr getFileHandler(const I2OChain &event)
FilesMonitorCollection::FileRecordPtr getNewFileRecord(const I2OChain &event)
const StreamsMonitorCollection::StreamRecordPtr streamRecord_
FileHandlers fileHandlers_
const DiskWritingParams & diskWritingParams_
boost::shared_ptr< FileHandler > FileHandlerPtr
Definition: StreamHandler.h:67
const SharedResourcesPtr sharedResources_
bool closeFilesForLumiSection(const uint32_t &lumiSection, std::string &)
virtual double fractionToDisk() const =0
virtual ~StreamHandler()
Definition: StreamHandler.h:37
std::string getFileSystem(const uint32_t &runNumber, uint32_t fileCount) const