#include <Forwarder.h>

Inheritance diagram for Ipc::Forwarder:
Collaboration diagram for Ipc::Forwarder:

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 Forwarder (Request::Pointer aRequest, double aTimeout)
virtual ~Forwarder ()
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
void callStart (AsyncCall &call)
virtual void callEnd ()
 called right after the called job method More...
virtual void * toCbdata ()=0

Static Public Member Functions

static void HandleRemoteAck (unsigned int requestId)
 finds and calls the right Forwarder upon Coordinator's response More...
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...

Public Attributes

CodeContextPointer codeContext

Protected Types

typedef std::map< unsigned int, AsyncCall::PointerRequestsMap
 maps request->id to Forwarder::handleRemoteAck callback More...

Protected Member Functions

virtual void start ()
 called by AsyncStart; do not call directly More...
virtual void swanSong ()
virtual bool doneAll () const
 whether positive goal has been reached More...
virtual void handleError ()
virtual void handleTimeout ()
virtual void handleException (const std::exception &e)
 terminate with an error More...
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...
virtual const char * status () const
 internal cleanup; do not call directly More...

Protected Attributes

Request::Pointer request
const double timeout
 response wait timeout in seconds More...
const char * stopReason
 reason for forcing done() to be true More...
const char * typeName
 kid (leaf) class name, for debugging More...
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
const InstanceId< AsyncJobid
 job identifier More...

Static Protected Attributes

static RequestsMap TheRequestsMap
 pending Coordinator requests More...
static unsigned int LastRequestId = 0
 last requestId used More...

Private Member Functions

 CBDATA_CLASS (Forwarder)
void requestTimedOut ()
 called when Coordinator fails to start processing the request [in time] More...
void removeTimeoutEvent ()
 called when we are no longer waiting for Coordinator to respond More...
void handleRemoteAck ()
 called when Coordinator starts processing the request More...

Static Private Member Functions

static void RequestTimedOut (void *param)
 Ipc::Forwarder::requestTimedOut wrapper. More...
static AsyncCall::Pointer DequeueRequest (unsigned int requestId)
 returns and forgets the right Forwarder callback for the request More...

Detailed Description

Forwards a worker request to coordinator. Waits for an ACK from Coordinator Send the data unit with an error response if forwarding fails.

Definition at line 29 of file Forwarder.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

◆ RequestsMap

typedef std::map<unsigned int, AsyncCall::Pointer> Ipc::Forwarder::RequestsMap

Definition at line 69 of file Forwarder.h.

Constructor & Destructor Documentation

◆ Forwarder()

Ipc::Forwarder::Forwarder ( Request::Pointer  aRequest,
double  aTimeout 

Definition at line 26 of file Forwarder.cc.

◆ ~Forwarder()

Ipc::Forwarder::~Forwarder ( )

Reimplemented in Mgr::Forwarder.

Definition at line 33 of file Forwarder.cc.

References Must, request(), and SWALLOW_EXCEPTIONS.

Member Function Documentation

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

void Ipc::Forwarder::callException ( const std::exception &  e)

Reimplemented from AsyncJob.

Definition at line 140 of file Forwarder.cc.

References AsyncJob::callException(), DBG_CRITICAL, debugs, and HERE().

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.


Ipc::Forwarder::CBDATA_CLASS ( Forwarder  )

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ DequeueRequest()

AsyncCall::Pointer Ipc::Forwarder::DequeueRequest ( unsigned int  requestId)

Definition at line 152 of file Forwarder.cc.

References debugs, HERE(), Must, NULL, and request().

◆ done()

bool AsyncJob::done ( ) const

◆ doneAll()

bool Ipc::Forwarder::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 79 of file Forwarder.cc.

References debugs, HERE(), and request().

◆ handleError()

void Ipc::Forwarder::handleError ( )

Reimplemented in Mgr::Forwarder.

Definition at line 120 of file Forwarder.cc.

◆ handleException()

void Ipc::Forwarder::handleException ( const std::exception &  e)

Reimplemented in Snmp::Forwarder, and Mgr::Forwarder.

Definition at line 133 of file Forwarder.cc.

References debugs, and HERE().

Referenced by Mgr::Forwarder::handleException(), and Snmp::Forwarder::handleException().

◆ handleRemoteAck()

void Ipc::Forwarder::handleRemoteAck ( )

Definition at line 87 of file Forwarder.cc.

References debugs, HERE(), and request().

Referenced by start().

◆ HandleRemoteAck()

void Ipc::Forwarder::HandleRemoteAck ( unsigned int  requestId)

◆ handleTimeout()

void Ipc::Forwarder::handleTimeout ( )

Reimplemented in Snmp::Forwarder, and Mgr::Forwarder.

Definition at line 126 of file Forwarder.cc.

Referenced by Mgr::Forwarder::handleTimeout(), and Snmp::Forwarder::handleTimeout().

◆ mustStop()

◆ removeTimeoutEvent()

void Ipc::Forwarder::removeTimeoutEvent ( )

Definition at line 168 of file Forwarder.cc.

References eventDelete(), eventFind(), and RequestTimedOut().

◆ requestTimedOut()

void Ipc::Forwarder::requestTimedOut ( )

Definition at line 113 of file Forwarder.cc.

References debugs, and HERE().

◆ RequestTimedOut()

void Ipc::Forwarder::RequestTimedOut ( void *  param)

Definition at line 99 of file Forwarder.cc.

References CallBack(), codeContext, debugs, HERE(), Must, and NULL.

Referenced by removeTimeoutEvent(), and start().

◆ start()

void Ipc::Forwarder::start ( )

◆ Start()

◆ status()

const char * AsyncJob::status ( ) const

◆ swanSong()

void Ipc::Forwarder::swanSong ( )

Reimplemented from AsyncJob.

Reimplemented in Snmp::Forwarder, and Mgr::Forwarder.

Definition at line 68 of file Forwarder.cc.

References debugs, HERE(), and request().

Referenced by Mgr::Forwarder::swanSong(), and Snmp::Forwarder::swanSong().

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ codeContext

CodeContextPointer Ipc::Forwarder::codeContext

Definition at line 43 of file Forwarder.h.

Referenced by RequestTimedOut().

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall

◆ LastRequestId

unsigned int Ipc::Forwarder::LastRequestId = 0

Definition at line 72 of file Forwarder.h.

◆ request

Request::Pointer Ipc::Forwarder::request

Definition at line 65 of file Forwarder.h.

◆ stopReason

const char* AsyncJob::stopReason

◆ TheRequestsMap

Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap

Definition at line 70 of file Forwarder.h.

◆ timeout

const double Ipc::Forwarder::timeout

Definition at line 66 of file Forwarder.h.

◆ typeName

The documentation for this class was generated from the following files:






Web Site Translations