#include <Inquirer.h>


Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
Inquirer (Action::Pointer anAction, const Request &aCause, const Ipc::StrandCoords &coords) | |
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... | |
Public Attributes | |
CodeContextPointer | codeContext |
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 bool | doneAll () const |
whether positive goal has been reached More... | |
virtual void | cleanup () |
closes our copy of the client HTTP connection socket More... | |
virtual void | sendResponse () |
send response to client More... | |
virtual bool | aggregate (Ipc::Response::Pointer aResponse) |
perform aggregating of responses and returns true if need to continue More... | |
virtual void | swanSong () |
virtual const char * | status () const |
internal cleanup; do not call directly More... | |
virtual void | inquire () |
inquire the next strand More... | |
virtual void | handleException (const std::exception &e) |
do specific exception handling 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< AsyncJob > | id |
job identifier 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 | noteWroteHeader (const CommIoCbParams ¶ms) |
called when we wrote the response header More... | |
void | noteCommClosed (const CommCloseCbParams ¶ms) |
called when the HTTP client or some external force closed our socket More... | |
void | removeCloseHandler () |
Ipc::StrandCoords | applyQueryParams (const Ipc::StrandCoords &aStrands, const QueryParams &aParams) |
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... | |
Private Attributes | |
Action::Pointer | aggrAction |
Comm::ConnectionPointer | conn |
HTTP client socket descriptor. More... | |
AsyncCall::Pointer | writer |
comm_write callback More... | |
AsyncCall::Pointer | closer |
comm_close handler 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 26 of file Inquirer.h.
Member Typedef Documentation
◆ HandleAckDialer
|
privateinherited |
Definition at line 63 of file Inquirer.h.
◆ Pointer
|
inherited |
Definition at line 34 of file AsyncJob.h.
◆ RequestsMap
|
protectedinherited |
Definition at line 82 of file Inquirer.h.
Constructor & Destructor Documentation
◆ Inquirer()
Mgr::Inquirer::Inquirer | ( | Action::Pointer | anAction, |
const Request & | aCause, | ||
const Ipc::StrandCoords & | coords | ||
) |
Definition at line 34 of file Inquirer.cc.
References aggrAction, asyncCall(), closer, comm_add_close_handler(), conn, Mgr::Request::conn, debugs, Comm::Connection::fd, Ipc::fdnHttpSocket, HERE(), Ipc::ImportFdIntoComm(), and noteCommClosed().
Member Function Documentation
◆ aggregate()
|
protectedvirtual |
Implements Ipc::Inquirer.
Definition at line 119 of file Inquirer.cc.
References Mgr::Response::getAction(), and Mgr::Response::hasAction().
◆ applyQueryParams()
|
private |
Definition at line 144 of file Inquirer.cc.
References debugs, Mgr::QueryParams::get(), RefCount< C >::getRaw(), HERE(), int, NULL, Mgr::QueryParam::ptInt, sc, Mgr::QueryParam::type, and Mgr::IntParam::value().
◆ callEnd()
|
virtualinherited |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 136 of file AsyncJob.cc.
References AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::done(), HERE(), AsyncJob::inCall, NULL, AsyncJob::status(), AsyncJob::swanSong(), and AsyncJob::typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and AsyncJob::deleteThis().
◆ callException()
|
virtualinherited |
Reimplemented from AsyncJob.
Definition at line 129 of file Inquirer.cc.
References AsyncJob::callException(), DBG_CRITICAL, debugs, and HERE().
◆ callStart()
|
inherited |
called just before the called method
Definition at line 114 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 101 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.
◆ CBDATA_CLASS()
|
private |
◆ cleanup()
|
protectedvirtual |
Reimplemented from Ipc::Inquirer.
Definition at line 51 of file Inquirer.cc.
References conn, and Comm::IsConnOpen().
◆ deleteThis()
|
protectedinherited |
Definition at line 49 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::inCall, JobMemFun(), Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed().
◆ DequeueRequest()
|
staticprivateinherited |
◆ done()
|
protectedinherited |
Definition at line 90 of file AsyncJob.cc.
References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), HappyConnOpener::checkForNewConnection(), and Downloader::downloadFinished().
◆ doneAll()
|
protectedvirtual |
Reimplemented from Ipc::Inquirer.
Definition at line 138 of file Inquirer.cc.
References Ipc::Inquirer::doneAll().
◆ handleException()
|
protectedvirtualinherited |
Reimplemented in Snmp::Inquirer.
Definition at line 122 of file Inquirer.cc.
References debugs, and HERE().
Referenced by Snmp::Inquirer::handleException().
◆ HandleRemoteAck()
|
staticinherited |
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()
|
privateinherited |
Definition at line 88 of file Inquirer.cc.
References debugs, HERE(), Must, and request().
Referenced by Ipc::Inquirer::inquire().
◆ inquire()
|
protectedvirtualinherited |
Definition at line 63 of file Inquirer.cc.
References asyncCall(), callback, debugs, eventAdd(), Ipc::Inquirer::handleRemoteAck(), HERE(), Ipc::Port::MakeAddr(), Must, NULL, request(), Ipc::Inquirer::RequestTimedOut(), Ipc::SendMessage(), and Ipc::strandAddrLabel.
◆ mustStop()
|
protectedinherited |
Definition at line 69 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(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ noteCommClosed()
|
private |
Definition at line 110 of file Inquirer.cc.
References CommCommonCbParams::conn, conn, debugs, RefCount< C >::getRaw(), HERE(), Comm::IsConnOpen(), Must, and NULL.
Referenced by Inquirer().
◆ noteWroteHeader()
|
private |
Definition at line 97 of file Inquirer.cc.
References CommCommonCbParams::conn, conn, debugs, CommCommonCbParams::flag, RefCount< C >::getRaw(), HERE(), Must, NULL, Comm::OK, and CommIoCbParams::size.
Referenced by start().
◆ removeCloseHandler()
|
private |
Definition at line 60 of file Inquirer.cc.
References comm_remove_close_handler(), conn, and NULL.
◆ removeTimeoutEvent()
|
privateinherited |
Definition at line 171 of file Inquirer.cc.
References eventDelete(), eventFind(), and Ipc::Inquirer::RequestTimedOut().
◆ requestTimedOut()
|
privateinherited |
◆ RequestTimedOut()
|
staticprivateinherited |
Definition at line 179 of file Inquirer.cc.
References CallBack(), Ipc::Inquirer::codeContext, debugs, HERE(), Must, and NULL.
Referenced by Ipc::Inquirer::inquire(), and Ipc::Inquirer::removeTimeoutEvent().
◆ sendResponse()
|
protectedvirtual |
Implements Ipc::Inquirer.
Definition at line 128 of file Inquirer.cc.
References conn, NULL, and AsyncJob::Start().
◆ start()
|
protectedvirtual |
Reimplemented from Ipc::Inquirer.
Definition at line 69 of file Inquirer.cc.
References asyncCall(), ErrorState::BuildHttpReply(), conn, Http::CONNECTION, debugs, ERR_INVALID_URL, HttpRequest::FromUrlXXX(), Http::Message::header, HERE(), XactionInitiator::initIpc, Comm::IsConnOpen(), Must, noteWroteHeader(), NULL, HttpReply::pack(), HttpHeader::putStr(), Http::scNotFound, Http::scOkay, HttpReply::setHeaders(), squid_curtime, Ipc::Inquirer::start(), and Comm::Write().
◆ Start()
|
staticinherited |
Definition at line 23 of file AsyncJob.cc.
References CallJobHere, and AsyncJob::start().
Referenced by Ftp::Server::AcceptCtrlConnection(), Ftp::Server::checkDataConnPre(), clientListenerConnectionOpened(), Ftp::Client::connectDataChannel(), FwdState::connectStart(), Adaptation::Icap::Xaction::dnsLookupDone(), Log::TcpLogger::doConnect(), FwdState::establishTunnelThruProxy(), TunnelStateData::establishTunnelThruProxy(), Ipc::Coordinator::handleCacheMgrRequest(), PeerPoolMgr::handleOpenedConnection(), Ipc::Coordinator::handleSnmpRequest(), httpAccept(), httpsAccept(), httpStart(), idnsInitVC(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Adaptation::Icap::Xaction::noteCommConnected(), Log::TcpLogger::Open(), HappyConnOpener::openFreshConnection(), PeerPoolMgr::openNewConnection(), peerProbeConnect(), Mgr::FunAction::respond(), Mgr::InfoAction::respond(), FwdState::secureConnectionToPeer(), TunnelStateData::secureConnectionToPeer(), Ipc::SendMessage(), sendResponse(), snmpConstructReponse(), SquidMain(), CacheManager::start(), Ident::Start(), Adaptation::AccessCheck::Start(), Rock::Rebuild::Start(), Security::PeerConnector::startCertDownloading(), TunnelStateData::startConnecting(), Ftp::StartGateway(), Ftp::StartRelay(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ status()
|
protectedvirtualinherited |
for debugging, starts with space
Reimplemented from AsyncJob.
Definition at line 205 of file Inquirer.cc.
◆ swanSong()
|
protectedvirtualinherited |
◆ toCbdata()
|
pure virtualinherited |
Implemented in HttpStateData, ClientHttpRequest, and BodySink.
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ aggrAction
|
private |
Definition at line 51 of file Inquirer.h.
Referenced by Inquirer().
◆ closer
|
private |
Definition at line 56 of file Inquirer.h.
Referenced by Inquirer().
◆ codeContext
|
inherited |
Definition at line 42 of file Inquirer.h.
Referenced by Ipc::Inquirer::RequestTimedOut().
◆ conn
|
private |
Definition at line 53 of file Inquirer.h.
Referenced by Inquirer().
◆ id
|
protectedinherited |
Definition at line 72 of file AsyncJob.h.
◆ inCall
|
protectedinherited |
Definition at line 71 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ LastRequestId
|
staticprotectedinherited |
Definition at line 85 of file Inquirer.h.
◆ pos
|
protectedinherited |
Definition at line 77 of file Inquirer.h.
◆ request
|
protectedinherited |
Definition at line 74 of file Inquirer.h.
Referenced by Snmp::Inquirer::Inquirer().
◆ stopReason
|
protectedinherited |
Definition at line 69 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
◆ strands
|
protectedinherited |
Definition at line 76 of file Inquirer.h.
Referenced by Ipc::Inquirer::Inquirer().
◆ TheRequestsMap
|
staticprotectedinherited |
Definition at line 83 of file Inquirer.h.
◆ timeout
|
protectedinherited |
Definition at line 79 of file Inquirer.h.
◆ typeName
|
protectedinherited |
Definition at line 70 of file AsyncJob.h.
Referenced by AsyncJob::AsyncJob(), Adaptation::Icap::Xaction::Xaction(), AsyncJob::~AsyncJob(), AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ writer
|
private |
Definition at line 55 of file Inquirer.h.
The documentation for this class was generated from the following files:
- src/mgr/Inquirer.h
- src/mgr/Inquirer.cc