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 Member Functions | Private Attributes
stor::ConsumerUtils< Configuration_t, EventQueueCollection_t > Class Template Reference

#include <ConsumerUtils.h>

Public Member Functions

 ConsumerUtils (boost::shared_ptr< Configuration_t >, RegistrationCollectionPtr, RegistrationQueuePtr, InitMsgCollectionPtr, boost::shared_ptr< EventQueueCollection_t >, DQMEventQueueCollectionPtr, AlarmHandlerPtr)
 
void processConsumerEventRequest (xgi::Input *, xgi::Output *) const
 
void processConsumerHeaderRequest (xgi::Input *, xgi::Output *) const
 
void processConsumerRegistrationRequest (xgi::Input *, xgi::Output *) const
 
void processDQMConsumerEventRequest (xgi::Input *, xgi::Output *) const
 
void processDQMConsumerRegistrationRequest (xgi::Input *, xgi::Output *) const
 

Private Member Functions

bool addRegistrationInfo (const RegPtr) const
 
bool createDQMEventConsumerQueue (DQMEventConsRegPtr) const
 
DQMEventConsRegPtr createDQMEventConsumerRegistrationInfo (xgi::Input *, xgi::Output *) const
 
bool createEventConsumerQueue (EventConsRegPtr) const
 
EventConsRegPtr createEventConsumerRegistrationInfo (xgi::Input *, xgi::Output *) const
 
ConsumerID getConsumerId (xgi::Input *) const
 
DQMEventConsRegPtr parseDQMEventConsumerRegistration (xgi::Input *) const
 
EventConsRegPtr parseEventConsumerRegistration (xgi::Input *) const
 
void writeConsumerEvent (xgi::Output *, const stor::I2OChain &) const
 
void writeConsumerEvent (xgi::Output *, const smproxy::EventMsg &) const
 
template<>
void writeConsumerEvent (xgi::Output *out, const smproxy::EventMsg &evt) const
 
template<>
void writeConsumerEvent (xgi::Output *out, const I2OChain &evt) const
 
void writeConsumerHeader (xgi::Output *, const InitMsgSharedPtr) const
 
void writeConsumerRegistration (xgi::Output *, const ConsumerID) const
 
void writeDone (xgi::Output *) const
 
void writeDQMConsumerEvent (xgi::Output *, const DQMEventMsgView &) const
 
void writeEmptyBuffer (xgi::Output *) const
 
void writeErrorString (xgi::Output *, const std::string) const
 
void writeHTTPHeaders (xgi::Output *) const
 
void writeNotReady (xgi::Output *) const
 

Private Attributes

AlarmHandlerPtr alarmHandler_
 
boost::shared_ptr
< Configuration_t > 
configuration_
 
DQMEventQueueCollectionPtr dqmEventQueueCollection_
 
boost::shared_ptr
< EventQueueCollection_t > 
eventQueueCollection_
 
InitMsgCollectionPtr initMsgCollection_
 
RegistrationCollectionPtr registrationCollection_
 
RegistrationQueuePtr registrationQueue_
 

Detailed Description

template<typename Configuration_t, typename EventQueueCollection_t>
class stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >

Handles consumer requests and responses

Author:
mommsen
Revision:
1.10
Date:
2011/08/22 14:20:16

Definition at line 45 of file ConsumerUtils.h.

Constructor & Destructor Documentation

template<typename Configuration_t , typename EventQueueCollection_t >
stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::ConsumerUtils ( boost::shared_ptr< Configuration_t >  ,
RegistrationCollectionPtr  ,
RegistrationQueuePtr  ,
InitMsgCollectionPtr  ,
boost::shared_ptr< EventQueueCollection_t >  ,
DQMEventQueueCollectionPtr  ,
AlarmHandlerPtr   
)

Member Function Documentation

template<typename Configuration_t , typename EventQueueCollection_t >
bool stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::addRegistrationInfo ( const RegPtr  ) const
private

Add registration information to RegistrationCollection and to registration queue. Return true on success.

template<typename Configuration_t , typename EventQueueCollection_t >
bool stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::createDQMEventConsumerQueue ( DQMEventConsRegPtr  ) const
private

Create a DQM event consumer queue. Returns true on success.

template<typename Configuration_t , typename EventQueueCollection_t >
DQMEventConsRegPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::createDQMEventConsumerRegistrationInfo ( xgi::Input ,
xgi::Output  
) const
private

Create the DQM event consumer registration info for this request

template<typename Configuration_t , typename EventQueueCollection_t >
bool stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::createEventConsumerQueue ( EventConsRegPtr  ) const
private

Create an event consumer queue. Returns true on success.

template<typename Configuration_t , typename EventQueueCollection_t >
EventConsRegPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::createEventConsumerRegistrationInfo ( xgi::Input ,
xgi::Output  
) const
private

Create the event consumer registration info for this request

template<typename Configuration_t , typename EventQueueCollection_t >
ConsumerID stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::getConsumerId ( xgi::Input ) const
private

Extract consumer ID from header request:

template<typename Configuration_t , typename EventQueueCollection_t >
DQMEventConsRegPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::parseDQMEventConsumerRegistration ( xgi::Input ) const
private

Parse DQM consumer registration request

template<typename Configuration_t , typename EventQueueCollection_t >
EventConsRegPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::parseEventConsumerRegistration ( xgi::Input ) const
private

Parse consumer registration request

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::processConsumerEventRequest ( xgi::Input ,
xgi::Output  
) const

Process event request from an event consumer

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::processConsumerHeaderRequest ( xgi::Input ,
xgi::Output  
) const

Process header (init msg) request from an event consumer

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::processConsumerRegistrationRequest ( xgi::Input ,
xgi::Output  
) const

Process registration request from an event consumer

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::processDQMConsumerEventRequest ( xgi::Input ,
xgi::Output  
) const

Process DQM event (histogram) request from a DQM event consumer

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::processDQMConsumerRegistrationRequest ( xgi::Input ,
xgi::Output  
) const

Process registration request from a DQM event (histogram) consumer

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerEvent ( xgi::Output ,
const stor::I2OChain  
) const
private

Send event to consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerEvent ( xgi::Output ,
const smproxy::EventMsg  
) const
private
template<>
void stor::ConsumerUtils< smproxy::Configuration, smproxy::EventQueueCollection >::writeConsumerEvent ( xgi::Output out,
const smproxy::EventMsg evt 
) const
private

Definition at line 384 of file SMProxyServer.cc.

References smproxy::EventMsg::dataLocation(), and smproxy::EventMsg::totalDataSize().

385  {
387  out->write( (char*)evt.dataLocation(), evt.totalDataSize() );
388  }
void writeHTTPHeaders(xgi::Output *) const
tuple out
Definition: dbtoconf.py:99
unsigned char * dataLocation() const
Definition: EventMsg.cc:66
unsigned long totalDataSize() const
Definition: EventMsg.cc:60
template<>
void stor::ConsumerUtils< Configuration, EventQueueCollection >::writeConsumerEvent ( xgi::Output out,
const I2OChain evt 
) const
private

Definition at line 746 of file StorageManager.cc.

References gather_cfg::cout, stor::I2OChain::dataLocation(), stor::I2OChain::dataSize(), stor::I2OChain::fragmentCount(), h, i, EventHeader::protocolVersion_, alignCSCRings::r, and rand().

747  {
749 
750  #ifdef STOR_DEBUG_CORRUPTED_EVENT_HEADER
751  double r = rand()/static_cast<double>(RAND_MAX);
752  if (r < 0.1)
753  {
754  std::cout << "Simulating corrupted event header" << std::endl;
756  h->protocolVersion_ = 1;
757  }
758  #endif // STOR_DEBUG_CORRUPTED_EVENT_HEADER
759 
760  const unsigned int nfrags = evt.fragmentCount();
761  for ( unsigned int i = 0; i < nfrags; ++i )
762  {
763  const unsigned long len = evt.dataSize( i );
764  unsigned char* location = evt.dataLocation( i );
765  out->write( (char*)location, len );
766  }
767  }
unsigned int fragmentCount() const
Definition: I2OChain.cc:284
int i
Definition: DBlmapReader.cc:9
void writeHTTPHeaders(xgi::Output *) const
uint8 protocolVersion_
Definition: EventMessage.h:60
tuple out
Definition: dbtoconf.py:99
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Signal rand(Signal arg)
Definition: vlib.cc:442
unsigned long dataSize(int fragmentIndex) const
Definition: I2OChain.cc:438
tuple cout
Definition: gather_cfg.py:121
unsigned char * dataLocation(int fragmentIndex) const
Definition: I2OChain.cc:444
template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerHeader ( xgi::Output ,
const InitMsgSharedPtr   
) const
private

Send header to consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerRegistration ( xgi::Output ,
const ConsumerID   
) const
private

Send ID to consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeDone ( xgi::Output ) const
private

Send a "done" message to consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeDQMConsumerEvent ( xgi::Output ,
const DQMEventMsgView  
) const
private

Send DQM event to DQM consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeEmptyBuffer ( xgi::Output ) const
private

Send empty buffer to consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeErrorString ( xgi::Output ,
const std::string   
) const
private

Send an error message to consumer:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeHTTPHeaders ( xgi::Output ) const
private

Write HTTP headers:

template<typename Configuration_t , typename EventQueueCollection_t >
void stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeNotReady ( xgi::Output ) const
private

Tell consumer we're not ready:

Member Data Documentation

template<typename Configuration_t , typename EventQueueCollection_t >
AlarmHandlerPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::alarmHandler_
private

Definition at line 183 of file ConsumerUtils.h.

template<typename Configuration_t , typename EventQueueCollection_t >
boost::shared_ptr<Configuration_t> stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::configuration_
private

Definition at line 177 of file ConsumerUtils.h.

template<typename Configuration_t , typename EventQueueCollection_t >
DQMEventQueueCollectionPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::dqmEventQueueCollection_
private

Definition at line 182 of file ConsumerUtils.h.

template<typename Configuration_t , typename EventQueueCollection_t >
boost::shared_ptr<EventQueueCollection_t> stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::eventQueueCollection_
private

Definition at line 181 of file ConsumerUtils.h.

template<typename Configuration_t , typename EventQueueCollection_t >
InitMsgCollectionPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::initMsgCollection_
private

Definition at line 180 of file ConsumerUtils.h.

template<typename Configuration_t , typename EventQueueCollection_t >
RegistrationCollectionPtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::registrationCollection_
private

Definition at line 178 of file ConsumerUtils.h.

template<typename Configuration_t , typename EventQueueCollection_t >
RegistrationQueuePtr stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::registrationQueue_
private

Definition at line 179 of file ConsumerUtils.h.