#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)
 
 ~Forwarder () override
 
void callException (const std::exception &e) override
 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...
 
void handleStopRequest ()
 process external request to terminate now (i.e. during this async call) More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void HandleRemoteAck (RequestId)
 finds and calls the right Forwarder upon Coordinator's response More...
 
static void Start (const Pointer &job)
 
static void RegisterWithCacheManager ()
 

Public Attributes

CodeContextPointer codeContext
 
const InstanceId< AsyncJobid
 job identifier More...
 

Protected Types

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

Protected Member Functions

void start () override
 called by AsyncStart; do not call directly More...
 
void swanSong () override
 
bool doneAll () const override
 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...
 

Static Protected Member Functions

static void ReportAllJobs (StoreEntry *)
 writes a cache manager report about all jobs existing in this worker 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...
 
bool started_ = false
 Start() has finished successfully. More...
 
bool swanSang_ = false
 swanSong() was called More...
 

Static Protected Attributes

static RequestsMap TheRequestsMap
 pending Coordinator requests More...
 
static RequestId::Index LastRequestId = 0
 last requestId used More...
 

Private Member Functions

 CBDATA_INTERMEDIATE ()
 
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...
 
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More...
 

Static Private Member Functions

static void RequestTimedOut (void *param)
 Ipc::Forwarder::requestTimedOut wrapper. More...
 
static AsyncCall::Pointer DequeueRequest (RequestId::Index)
 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

Definition at line 69 of file Forwarder.h.

Constructor & Destructor Documentation

◆ Forwarder()

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

Definition at line 25 of file Forwarder.cc.

◆ ~Forwarder()

Ipc::Forwarder::~Forwarder ( )
override

Definition at line 32 of file Forwarder.cc.

References Must, and SWALLOW_EXCEPTIONS.

Member Function Documentation

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

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

Reimplemented from AsyncJob.

Definition at line 139 of file Forwarder.cc.

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

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 117 of file AsyncJob.cc.

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

◆ CBDATA_INTERMEDIATE()

Ipc::Forwarder::CBDATA_INTERMEDIATE ( )
private

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ DequeueRequest()

AsyncCall::Pointer Ipc::Forwarder::DequeueRequest ( RequestId::Index  requestId)
staticprivate

Definition at line 151 of file Forwarder.cc.

References debugs, Must, and MYNAME.

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Ipc::Forwarder::doneAll ( ) const
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 78 of file Forwarder.cc.

References debugs, and MYNAME.

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ handleError()

void Ipc::Forwarder::handleError ( )
protectedvirtual

Reimplemented in Mgr::Forwarder.

Definition at line 119 of file Forwarder.cc.

◆ handleException()

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

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

Definition at line 132 of file Forwarder.cc.

References debugs.

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

◆ handleRemoteAck()

void Ipc::Forwarder::handleRemoteAck ( )
private

Definition at line 86 of file Forwarder.cc.

References debugs, and MYNAME.

Referenced by start().

◆ HandleRemoteAck()

void Ipc::Forwarder::HandleRemoteAck ( RequestId  requestId)
static

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )
inlineinherited

Definition at line 73 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ handleTimeout()

void Ipc::Forwarder::handleTimeout ( )
protectedvirtual

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

Definition at line 125 of file Forwarder.cc.

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

◆ mustStop()

◆ RegisterWithCacheManager()

void AsyncJob::RegisterWithCacheManager ( )
staticinherited

Definition at line 215 of file AsyncJob.cc.

References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().

Referenced by mainInitialize().

◆ removeTimeoutEvent()

void Ipc::Forwarder::removeTimeoutEvent ( )
private

Definition at line 167 of file Forwarder.cc.

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

◆ ReportAllJobs()

void AsyncJob::ReportAllJobs ( StoreEntry e)
staticprotectedinherited

Definition at line 198 of file AsyncJob.cc.

References AllJobs().

Referenced by AsyncJob::RegisterWithCacheManager().

◆ requestTimedOut()

void Ipc::Forwarder::requestTimedOut ( )
private

Definition at line 112 of file Forwarder.cc.

References debugs, and MYNAME.

◆ RequestTimedOut()

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

Definition at line 98 of file Forwarder.cc.

References CallBack(), codeContext, debugs, Must, and MYNAME.

Referenced by removeTimeoutEvent(), and start().

◆ start()

void Ipc::Forwarder::start ( )
overrideprotectedvirtual

◆ Start()

◆ status()

◆ swanSong()

void Ipc::Forwarder::swanSong ( )
overrideprotectedvirtual

Reimplemented from AsyncJob.

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

Definition at line 67 of file Forwarder.cc.

References debugs, Ipc::DequeueRequest(), and MYNAME.

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
inherited

Definition at line 75 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ LastRequestId

Ipc::RequestId::Index Ipc::Forwarder::LastRequestId = 0
staticprotected

Definition at line 72 of file Forwarder.h.

◆ request

Request::Pointer Ipc::Forwarder::request
protected

Definition at line 65 of file Forwarder.h.

◆ started_

bool AsyncJob::started_ = false
protectedinherited

Definition at line 88 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ swanSang_

bool AsyncJob::swanSang_ = false
protectedinherited

Definition at line 89 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().

◆ TheRequestsMap

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

Definition at line 70 of file Forwarder.h.

◆ timeout

const double Ipc::Forwarder::timeout
protected

Definition at line 66 of file Forwarder.h.

◆ typeName


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors