#include <Inquirer.h>

Inheritance diagram for Mgr::Inquirer:
Collaboration diagram for Mgr::Inquirer:

Public Types

typedef CbcPointer< AsyncJobPointer
 

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...
 

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 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< AsyncJobid
 job identifier More...
 

Static Protected Attributes

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

Private Member Functions

 CBDATA_CLASS (Inquirer)
 
void noteWroteHeader (const CommIoCbParams &params)
 called when we wrote the response header More...
 
void noteCommClosed (const CommCloseCbParams &params)
 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)
 

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

◆ Pointer

Definition at line 34 of file AsyncJob.h.

◆ RequestsMap

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

Definition at line 79 of file Inquirer.h.

Constructor & Destructor Documentation

◆ Inquirer()

Mgr::Inquirer::Inquirer ( Action::Pointer  anAction,
const Request aCause,
const Ipc::StrandCoords coords 
)

Member Function Documentation

◆ aggregate()

bool Mgr::Inquirer::aggregate ( Ipc::Response::Pointer  aResponse)
protectedvirtual

Implements Ipc::Inquirer.

Definition at line 119 of file Inquirer.cc.

References aggrAction, Mgr::Response::getAction(), and Mgr::Response::hasAction().

◆ applyQueryParams()

Ipc::StrandCoords Mgr::Inquirer::applyQueryParams ( const Ipc::StrandCoords aStrands,
const QueryParams aParams 
)
private

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

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

Reimplemented from AsyncJob.

Definition at line 128 of file Inquirer.cc.

References AsyncJob::callException(), DBG_CRITICAL, debugs, Ipc::Inquirer::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()

Mgr::Inquirer::CBDATA_CLASS ( Inquirer  )
private

◆ cleanup()

void Mgr::Inquirer::cleanup ( )
protectedvirtual

Reimplemented from Ipc::Inquirer.

Definition at line 51 of file Inquirer.cc.

References Comm::Connection::close(), conn, Comm::IsConnOpen(), and removeCloseHandler().

◆ deleteThis()

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

◆ done()

◆ doneAll()

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

Reimplemented from Ipc::Inquirer.

Definition at line 138 of file Inquirer.cc.

References Ipc::Inquirer::doneAll(), and writer.

◆ handleException()

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

Reimplemented in Snmp::Inquirer.

Definition at line 121 of file Inquirer.cc.

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

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

◆ HandleRemoteAck()

◆ 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(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), 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().

◆ noteCommClosed()

void Mgr::Inquirer::noteCommClosed ( const CommCloseCbParams params)
private

◆ noteWroteHeader()

void Mgr::Inquirer::noteWroteHeader ( const CommIoCbParams params)
private

◆ removeCloseHandler()

void Mgr::Inquirer::removeCloseHandler ( )
private

Definition at line 60 of file Inquirer.cc.

References closer, comm_remove_close_handler(), conn, Comm::Connection::fd, and NULL.

Referenced by cleanup(), and sendResponse().

◆ sendResponse()

void Mgr::Inquirer::sendResponse ( )
protectedvirtual

Implements Ipc::Inquirer.

Definition at line 128 of file Inquirer.cc.

References aggrAction, conn, NULL, removeCloseHandler(), AsyncJob::Start(), and Ipc::Inquirer::strands.

◆ start()

◆ Start()

◆ status()

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

for debugging, starts with space

Reimplemented from AsyncJob.

Definition at line 202 of file Inquirer.cc.

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

Referenced by Ipc::Inquirer::handleRemoteAck(), and Ipc::Inquirer::inquire().

◆ swanSong()

void Ipc::Inquirer::swanSong ( )
protectedvirtualinherited

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ aggrAction

Action::Pointer Mgr::Inquirer::aggrAction
private

Definition at line 51 of file Inquirer.h.

Referenced by aggregate(), Inquirer(), sendResponse(), and start().

◆ closer

AsyncCall::Pointer Mgr::Inquirer::closer
private

Definition at line 56 of file Inquirer.h.

Referenced by Inquirer(), and removeCloseHandler().

◆ conn

Comm::ConnectionPointer Mgr::Inquirer::conn
private

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ LastRequestId

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

Definition at line 82 of file Inquirer.h.

Referenced by Ipc::Inquirer::inquire().

◆ pos

Ipc::StrandCoords::const_iterator Ipc::Inquirer::pos
protectedinherited

◆ request

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ strands

Ipc::StrandCoords Ipc::Inquirer::strands
protectedinherited

◆ TheRequestsMap

Ipc::Inquirer::RequestsMap Ipc::Inquirer::TheRequestsMap
staticprotectedinherited

Definition at line 80 of file Inquirer.h.

Referenced by Ipc::Inquirer::DequeueRequest(), and Ipc::Inquirer::inquire().

◆ timeout

const double Ipc::Inquirer::timeout
protectedinherited

Definition at line 76 of file Inquirer.h.

Referenced by Ipc::Inquirer::inquire().

◆ typeName

◆ writer

AsyncCall::Pointer Mgr::Inquirer::writer
private

Definition at line 55 of file Inquirer.h.

Referenced by doneAll(), noteWroteHeader(), and start().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors