#include <Inquirer.h>

Inheritance diagram for Ipc::Inquirer:
Collaboration diagram for Ipc::Inquirer:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Inquirer (Request::Pointer aRequest, const Ipc::StrandCoords &coords, double aTimeout)
 
virtual ~Inquirer ()
 
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 (const Response &response)
 finds and calls the right Inquirer upon strand's response More...
 
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Protected Types

typedef std::map< unsigned int, AsyncCall::PointerRequestsMap
 maps request->id to Inquirer::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 const char * status () const
 internal cleanup; do not call directly More...
 
virtual void inquire ()
 inquire the next strand More...
 
virtual void cleanup ()
 perform cleanup actions on completion of job More...
 
virtual void handleException (const std::exception &e)
 do specific exception handling More...
 
virtual void sendResponse ()=0
 send response to client More...
 
virtual bool aggregate (Response::Pointer aResponse)=0
 perform aggregating of responses and returns true if need to continue More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 

Protected Attributes

Request::Pointer request
 cache manager request received from client More...
 
Ipc::StrandCoords strands
 all strands we want to query, in order More...
 
Ipc::StrandCoords::const_iterator pos
 strand we should query now More...
 
const double timeout
 number of seconds to wait for strand response 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 strand requests More...
 
static unsigned int LastRequestId = 0
 last requestId used More...
 

Private Types

typedef UnaryMemFunT< Inquirer, Response::Pointer, Response::PointerHandleAckDialer
 

Private Member Functions

 CBDATA_CLASS (Inquirer)
 
void handleRemoteAck (Response::Pointer response)
 called when a strand is done writing its output More...
 
void requestTimedOut ()
 called when the strand failed to respond (or finish responding) in time More...
 
void removeTimeoutEvent ()
 called when we are no longer waiting for the strand to respond More...
 

Static Private Member Functions

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

Detailed Description

Coordinator's job that sends a cache manage request to each strand, aggregating individual strand responses and dumping the result if needed

Definition at line 27 of file Inquirer.h.

Member Typedef Documentation

◆ HandleAckDialer

◆ Pointer

Definition at line 34 of file AsyncJob.h.

◆ RequestsMap

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

Definition at line 79 of file Inquirer.h.

Constructor & Destructor Documentation

◆ Inquirer()

Ipc::Inquirer::Inquirer ( Request::Pointer  aRequest,
const Ipc::StrandCoords coords,
double  aTimeout 
)

Definition at line 33 of file Inquirer.cc.

References debugs, HERE(), LesserStrandByKidId(), and strands.

◆ ~Inquirer()

Ipc::Inquirer::~Inquirer ( )
virtual

Definition at line 44 of file Inquirer.cc.

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

Member Function Documentation

◆ aggregate()

virtual bool Ipc::Inquirer::aggregate ( Response::Pointer  aResponse)
protectedpure virtual

Implemented in Mgr::Inquirer, and Snmp::Inquirer.

Referenced by handleRemoteAck().

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

void Ipc::Inquirer::callException ( const std::exception &  e)
virtual

Reimplemented from AsyncJob.

Definition at line 128 of file Inquirer.cc.

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

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

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

Referenced by AsyncJob::swanSong().

◆ CBDATA_CLASS()

Ipc::Inquirer::CBDATA_CLASS ( Inquirer  )
private

◆ cleanup()

void Ipc::Inquirer::cleanup ( )
protectedvirtual

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

Definition at line 51 of file Inquirer.cc.

Referenced by swanSong(), and ~Inquirer().

◆ deleteThis()

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

◆ DequeueRequest()

AsyncCall::Pointer Ipc::Inquirer::DequeueRequest ( unsigned int  requestId)
staticprivate

Definition at line 141 of file Inquirer.cc.

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

Referenced by HandleRemoteAck(), requestTimedOut(), and swanSong().

◆ done()

◆ doneAll()

bool Ipc::Inquirer::doneAll ( ) const
protectedvirtual

Reimplemented from AsyncJob.

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

Definition at line 115 of file Inquirer.cc.

References pos, and strands.

Referenced by Snmp::Inquirer::doneAll(), and Mgr::Inquirer::doneAll().

◆ handleException()

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

Reimplemented in Snmp::Inquirer.

Definition at line 121 of file Inquirer.cc.

References debugs, HERE(), and AsyncJob::mustStop().

Referenced by callException(), and Snmp::Inquirer::handleException().

◆ HandleRemoteAck()

◆ handleRemoteAck()

void Ipc::Inquirer::handleRemoteAck ( Response::Pointer  response)
private

◆ inquire()

◆ mustStop()

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

Definition at line 69 of file AsyncJob.cc.

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), handleException(), HttpStateData::handleMoreRequestBodyAvailable(), handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), Rock::Rebuild::start(), Security::PeerConnector::start(), HttpStateData::start(), Ipc::UdsSender::timedout(), and HttpStateData::wroteLast().

◆ removeTimeoutEvent()

void Ipc::Inquirer::removeTimeoutEvent ( )
private

Definition at line 170 of file Inquirer.cc.

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

Referenced by handleRemoteAck(), and swanSong().

◆ RequestTimedOut()

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

Definition at line 178 of file Inquirer.cc.

References CallJobHere, debugs, HERE(), Must, NULL, and requestTimedOut().

Referenced by inquire(), and removeTimeoutEvent().

◆ requestTimedOut()

void Ipc::Inquirer::requestTimedOut ( )
private

Definition at line 189 of file Inquirer.cc.

References debugs, DequeueRequest(), AsyncJob::done(), HERE(), inquire(), Must, pos, and request.

Referenced by RequestTimedOut().

◆ sendResponse()

virtual void Ipc::Inquirer::sendResponse ( )
protectedpure virtual

Implemented in Mgr::Inquirer, and Snmp::Inquirer.

Referenced by swanSong().

◆ Start()

◆ start()

void Ipc::Inquirer::start ( )
protectedvirtual

Reimplemented from AsyncJob.

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

Definition at line 56 of file Inquirer.cc.

References request.

Referenced by Snmp::Inquirer::start(), and Mgr::Inquirer::start().

◆ status()

const char * Ipc::Inquirer::status ( ) const
protectedvirtual

for debugging, starts with space

Reimplemented from AsyncJob.

Definition at line 202 of file Inquirer.cc.

References Packable::appendf(), buf, MemBuf::content(), request, MemBuf::reset(), and MemBuf::terminate().

Referenced by handleRemoteAck(), and inquire().

◆ swanSong()

void Ipc::Inquirer::swanSong ( )
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 102 of file Inquirer.cc.

References cleanup(), debugs, DequeueRequest(), HERE(), removeTimeoutEvent(), request, and sendResponse().

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ LastRequestId

unsigned int Ipc::Inquirer::LastRequestId = 0
staticprotected

Definition at line 82 of file Inquirer.h.

Referenced by inquire().

◆ pos

Ipc::StrandCoords::const_iterator Ipc::Inquirer::pos
protected

Definition at line 74 of file Inquirer.h.

Referenced by doneAll(), handleRemoteAck(), inquire(), and requestTimedOut().

◆ request

Request::Pointer Ipc::Inquirer::request
protected

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ strands

Ipc::StrandCoords Ipc::Inquirer::strands
protected

◆ TheRequestsMap

Ipc::Inquirer::RequestsMap Ipc::Inquirer::TheRequestsMap
staticprotected

Definition at line 80 of file Inquirer.h.

Referenced by DequeueRequest(), and inquire().

◆ timeout

const double Ipc::Inquirer::timeout
protected

Definition at line 76 of file Inquirer.h.

Referenced by inquire().

◆ typeName


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors