#include <Inquirer.h>


Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
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... | |
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 (const Response &response) |
finds and calls the right Inquirer upon strand's response More... | |
static void | Start (const Pointer &job) |
Public Attributes | |
CodeContextPointer | codeContext |
const InstanceId< AsyncJob > | id |
job identifier More... | |
Protected Types | |
typedef std::map< RequestId::Index, AsyncCall::Pointer > | RequestsMap |
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... | |
bool | started_ = false |
Start() has finished successfully. More... | |
bool | swanSang_ = false |
swanSong() was called More... | |
Static Protected Attributes | |
static RequestsMap | TheRequestsMap |
pending strand requests More... | |
static RequestId::Index | LastRequestId = 0 |
last requestId used More... | |
Private Types | |
typedef UnaryMemFunT< Inquirer, Response::Pointer, Response::Pointer > | HandleAckDialer |
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 (RequestId::Index) |
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 28 of file Inquirer.h.
Member Typedef Documentation
◆ HandleAckDialer
|
private |
Definition at line 63 of file Inquirer.h.
◆ Pointer
|
inherited |
Definition at line 34 of file AsyncJob.h.
◆ RequestsMap
|
protected |
Definition at line 82 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, LesserStrandByKidId(), MYNAME, and strands.
◆ ~Inquirer()
|
virtual |
Definition at line 45 of file Inquirer.cc.
Member Function Documentation
◆ aggregate()
|
protectedpure virtual |
Implemented in Snmp::Inquirer, and Mgr::Inquirer.
◆ callEnd()
|
virtualinherited |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 137 of file AsyncJob.cc.
References assert, AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::done(), AsyncJob::inCall, NULL, AsyncJob::started_, AsyncJob::status(), AsyncJob::swanSang_, AsyncJob::swanSong(), and AsyncJob::typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and AsyncJob::deleteThis().
◆ callException()
|
virtual |
Reimplemented from AsyncJob.
Definition at line 129 of file Inquirer.cc.
References AsyncJob::callException(), DBG_CRITICAL, debugs, and MYNAME.
◆ callStart()
|
inherited |
called just before the called method
Definition at line 115 of file AsyncJob.cc.
References cbdataReferenceValid(), AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::inCall, Must, AsyncJob::status(), CbdataParent::toCbdata(), and AsyncJob::typeName.
◆ canBeCalled()
|
inherited |
Definition at line 102 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, AsyncJob::inCall, and NULL.
◆ CBDATA_CLASS()
|
private |
◆ cleanup()
|
protectedvirtual |
Reimplemented in Snmp::Inquirer, and Mgr::Inquirer.
Definition at line 52 of file Inquirer.cc.
◆ deleteThis()
|
protectedinherited |
Definition at line 50 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::inCall, JobMemFun(), Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed().
◆ DequeueRequest()
|
staticprivate |
◆ done()
|
protectedinherited |
Definition at line 91 of file AsyncJob.cc.
References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), HappyConnOpener::checkForNewConnection(), Downloader::downloadFinished(), and HappyConnOpener::maybeOpenPrimeConnection().
◆ doneAll()
|
protectedvirtual |
Reimplemented from AsyncJob.
Reimplemented in Snmp::Inquirer, and Mgr::Inquirer.
Definition at line 116 of file Inquirer.cc.
Referenced by Mgr::Inquirer::doneAll(), and Snmp::Inquirer::doneAll().
◆ handleException()
|
protectedvirtual |
Reimplemented in Snmp::Inquirer.
Definition at line 122 of file Inquirer.cc.
References debugs.
Referenced by Snmp::Inquirer::handleException().
◆ HandleRemoteAck()
|
static |
Definition at line 157 of file Inquirer.cc.
References UnaryMemFunT< Job, Data, Argument1 >::arg1, Ipc::Response::clone(), AsyncCall::getDialer(), Must, NULL, Ipc::Response::requestId, and ScheduleCallHere.
Referenced by Ipc::Coordinator::handleCacheMgrResponse(), and Ipc::Coordinator::handleSnmpResponse().
◆ handleRemoteAck()
|
private |
◆ handleStopRequest()
|
inlineinherited |
Definition at line 71 of file AsyncJob.h.
References AsyncJob::mustStop().
◆ inquire()
|
protectedvirtual |
Definition at line 63 of file Inquirer.cc.
References asyncCall(), debugs, eventAdd(), handleRemoteAck(), Ipc::Port::MakeAddr(), Must, NULL, request(), RequestTimedOut(), Ipc::SendMessage(), and Ipc::strandAddrLabel.
◆ mustStop()
|
protectedinherited |
Definition at line 70 of file AsyncJob.cc.
References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by HttpStateData::abortAll(), AsyncJob::callException(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), HttpStateData::handleMoreRequestBodyAvailable(), AsyncJob::handleStopRequest(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ removeTimeoutEvent()
|
private |
Definition at line 171 of file Inquirer.cc.
References eventDelete(), eventFind(), and RequestTimedOut().
◆ requestTimedOut()
|
private |
◆ RequestTimedOut()
|
staticprivate |
Definition at line 179 of file Inquirer.cc.
References CallBack(), codeContext, debugs, Must, MYNAME, and NULL.
Referenced by inquire(), and removeTimeoutEvent().
◆ sendResponse()
|
protectedpure virtual |
Implemented in Snmp::Inquirer, and Mgr::Inquirer.
◆ start()
|
protectedvirtual |
Reimplemented from AsyncJob.
Reimplemented in Snmp::Inquirer, and Mgr::Inquirer.
Definition at line 57 of file Inquirer.cc.
References request().
Referenced by Mgr::Inquirer::start(), and Snmp::Inquirer::start().
◆ Start()
|
staticinherited |
Promises to start the configured job (eventually). The job is deemed to be running asynchronously beyond this point, so the caller should only access the job object via AsyncCalls rather than directly.
swanSong() is only called for jobs for which this method has returned successfully (i.e. without throwing).
Definition at line 24 of file AsyncJob.cc.
References CallJobHere, AsyncJob::start(), and AsyncJob::started_.
Referenced by Ftp::Server::AcceptCtrlConnection(), clientListenerConnectionOpened(), Ipc::Coordinator::handleCacheMgrRequest(), Ipc::Coordinator::handleSnmpRequest(), httpAccept(), httpsAccept(), httpStart(), idnsInitVC(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Log::TcpLogger::Open(), peerProbeConnect(), Mgr::FunAction::respond(), Mgr::InfoAction::respond(), Ipc::SendMessage(), Mgr::Inquirer::sendResponse(), snmpConstructReponse(), SquidMain(), CacheManager::start(), Adaptation::AccessCheck::Start(), Rock::Rebuild::Start(), JobWaitBase::start_(), BodyPipe::startAutoConsumptionIfNeeded(), Ftp::StartGateway(), Ftp::StartRelay(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ status()
|
protectedvirtual |
for debugging, starts with space
Reimplemented from AsyncJob.
Definition at line 205 of file Inquirer.cc.
References Packable::appendf(), MemBuf::content(), request(), MemBuf::reset(), and MemBuf::terminate().
◆ swanSong()
|
protectedvirtual |
◆ toCbdata()
|
pure virtualinherited |
Implemented in HttpStateData, ClientHttpRequest, and BodySink.
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ codeContext
CodeContextPointer Ipc::Inquirer::codeContext |
Definition at line 42 of file Inquirer.h.
Referenced by RequestTimedOut().
◆ id
|
inherited |
Definition at line 73 of file AsyncJob.h.
◆ inCall
|
protectedinherited |
Definition at line 81 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ LastRequestId
|
staticprotected |
Definition at line 85 of file Inquirer.h.
◆ pos
|
protected |
Definition at line 77 of file Inquirer.h.
◆ request
|
protected |
Definition at line 74 of file Inquirer.h.
Referenced by Snmp::Inquirer::Inquirer().
◆ started_
|
protectedinherited |
Definition at line 83 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().
◆ stopReason
|
protectedinherited |
Definition at line 79 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
◆ strands
|
protected |
Definition at line 76 of file Inquirer.h.
Referenced by Inquirer().
◆ swanSang_
|
protectedinherited |
Definition at line 84 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().
◆ TheRequestsMap
|
staticprotected |
Definition at line 83 of file Inquirer.h.
◆ timeout
|
protected |
Definition at line 79 of file Inquirer.h.
◆ typeName
|
protectedinherited |
Definition at line 80 of file AsyncJob.h.
Referenced by AsyncJob::AsyncJob(), Adaptation::Icap::Xaction::Xaction(), AsyncJob::~AsyncJob(), AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
The documentation for this class was generated from the following files:
- src/ipc/Inquirer.h
- src/ipc/Inquirer.cc