CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

stor::ConsumerUtils< Configuration_t, EventQueueCollection_t > Class Template Reference

#include <ConsumerUtils.h>

List of all members.

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
template<>
void writeConsumerEvent (xgi::Output *out, const smproxy::EventMsg &evt) const
template<>
void writeConsumerEvent (xgi::Output *out, const I2OChain &evt) const
void writeConsumerEvent (xgi::Output *, const smproxy::EventMsg &) 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 smproxy::EventMsg  
) const [private]
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<>
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().

  {
    writeHTTPHeaders( out );
    out->write( (char*)evt.dataLocation(), evt.totalDataSize() );
  }
template<>
void stor::ConsumerUtils< Configuration, EventQueueCollection >::writeConsumerEvent ( xgi::Output *  out,
const I2OChain evt 
) const [private]

Definition at line 747 of file StorageManager.cc.

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

  {
    writeHTTPHeaders( out );
    
    #ifdef STOR_DEBUG_CORRUPTED_EVENT_HEADER
    double r = rand()/static_cast<double>(RAND_MAX);
    if (r < 0.1)
    {
      std::cout << "Simulating corrupted event header" << std::endl;
      EventHeader* h = (EventHeader*)evt.dataLocation(0);
      h->protocolVersion_ = 1;
    }
    #endif // STOR_DEBUG_CORRUPTED_EVENT_HEADER
    
    const unsigned int nfrags = evt.fragmentCount();
    for ( unsigned int i = 0; i < nfrags; ++i )
    {
      const unsigned long len = evt.dataSize( i );
      unsigned char* location = evt.dataLocation( i );
      out->write( (char*)location, len );
    } 
  }
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.