|
Squid Web Cache v8/master
|
iterates services in ServiceGroup, starting adaptation launchers More...
#include <Iterator.h>
Public Types | |
| typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
| Iterator (Http::Message *virginHeader, HttpRequest *virginCause, const AccessLogEntryPointer &, const Adaptation::ServiceGroupPointer &aGroup) | |
| ~Iterator () override | |
| void | noteInitiatorAborted () override |
| void | noteAdaptationAnswer (const Answer &answer) override |
| void | initiator (const CbcPointer< Initiator > &i) |
| sets initiator | |
| bool | canBeCalled (AsyncCall &call) const |
| whether we can be called | |
| void | callStart (AsyncCall &call) |
| virtual void | callEnd () |
| called right after the called job method | |
| virtual void | callException (const std::exception &e) |
| called when the job throws during an async call | |
| void | handleStopRequest () |
| process external request to terminate now (i.e. during this async call) | |
| virtual void * | toCbdata ()=0 |
| virtual void | noteAdaptationAclCheckDone (Adaptation::ServiceGroupPointer group) |
Static Public Member Functions | |
| static void | Start (const Pointer &job) |
| static void | RegisterWithCacheManager () |
Public Attributes | |
| const InstanceId< AsyncJob > | id |
| job identifier | |
Protected Member Functions | |
| void | start () override |
| called by AsyncStart; do not call directly | |
| bool | doneAll () const override |
| whether positive goal has been reached | |
| void | swanSong () override |
| void | step () |
| launches adaptation for the service selected by the plan | |
| bool | updatePlan (bool adopt) |
| replace the current group and plan with service-proposed ones if needed | |
| ServiceFilter | filter () const |
| creates service filter for the current step | |
| void | handleAdaptedHeader (Http::Message *msg) |
| void | handleAdaptationBlock (const Answer &answer) |
| void | handleAdaptationError (bool final) |
| void | sendAnswer (const Answer &answer) |
| void | tellQueryAborted (bool final) |
| void | clearInitiator () |
| const char * | status () const override |
| internal cleanup; do not call directly | |
| void | deleteThis (const char *aReason) |
| void | mustStop (const char *aReason) |
| bool | done () const |
| the job is destroyed in callEnd() when done() | |
| CbcPointer< Initiate > | initiateAdaptation (Initiate *x) |
| < starts freshly created initiate and returns a safe pointer to it | |
| void | clearAdaptation (CbcPointer< Initiate > &x) |
| clears the pointer (does not call announceInitiatorAbort) | |
| void | announceInitiatorAbort (CbcPointer< Initiate > &x) |
| inform the transaction about abnormal termination and clear the pointer | |
| bool | initiated (const CbcPointer< AsyncJob > &job) const |
| Must(initiated(initiate)) instead of Must(initiate.set()), for clarity. | |
Static Protected Member Functions | |
| static void | ReportAllJobs (StoreEntry *) |
| writes a cache manager report about all jobs existing in this worker | |
Protected Attributes | |
| ServiceGroupPointer | theGroup |
| the service group we are iterating | |
| ServicePlan | thePlan |
| which services to use and in what order | |
| Http::Message * | theMsg |
| the message being adapted (virgin for each step) | |
| HttpRequest * | theCause |
| the cause of the original virgin message | |
| AccessLogEntryPointer | al |
| info for the future access.log entry | |
| CbcPointer< Adaptation::Initiate > | theLauncher |
| current transaction launcher | |
| int | iterations |
| number of steps initiated | |
| bool | adapted |
| whether the virgin message has been replaced | |
| CbcPointer< Initiator > | theInitiator |
| const char * | stopReason |
| reason for forcing done() to be true | |
| const char * | typeName |
| kid (leaf) class name, for debugging | |
| AsyncCall::Pointer | inCall |
| the asynchronous call being handled, if any | |
| bool | started_ = false |
| Start() has finished successfully. | |
| bool | swanSang_ = false |
| swanSong() was called | |
Private Member Functions | |
| CBDATA_CHILD (Iterator) | |
| virtual void | finalizedInCbdataChild ()=0 |
| hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() | |
Definition at line 31 of file Iterator.h.
|
inherited |
Definition at line 34 of file AsyncJob.h.
| Adaptation::Iterator::Iterator | ( | Http::Message * | virginHeader, |
| HttpRequest * | virginCause, | ||
| const AccessLogEntryPointer & | alp, | ||
| const Adaptation::ServiceGroupPointer & | aGroup | ||
| ) |
Definition at line 22 of file Iterator.cc.
References HTTPMSGLOCK(), theCause, and theMsg.
|
override |
Definition at line 43 of file Iterator.cc.
References assert, and HTTPMSGUNLOCK().
|
protectedinherited |
Definition at line 38 of file Initiator.cc.
References CallJobHere.
Referenced by ClientHttpRequest::~ClientHttpRequest(), and Client::cleanAdaptation().
|
virtualinherited |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 152 of file AsyncJob.cc.
References assert, AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::done(), AsyncJob::inCall, AsyncJob::started_, AsyncJob::status(), AsyncJob::swanSang_, AsyncJob::swanSong(), and AsyncJob::typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and AsyncJob::deleteThis().
|
virtualinherited |
Reimplemented in ConnStateData, ClientHttpRequest, Rock::Rebuild, Adaptation::Icap::ModXact, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Ipc::Forwarder, Ipc::Inquirer, and Ftp::Server.
Definition at line 143 of file AsyncJob.cc.
References cbdataReferenceValid(), debugs, Must, AsyncJob::mustStop(), and CbdataParent::toCbdata().
Referenced by ConnStateData::callException(), Adaptation::Icap::Xaction::callException(), Ipc::Forwarder::callException(), Ipc::Inquirer::callException(), and Ftp::Server::callException().
|
inherited |
called just before the called method
Definition at line 130 of file AsyncJob.cc.
References cbdataReferenceValid(), AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::inCall, Must, AsyncJob::status(), CbdataParent::toCbdata(), and AsyncJob::typeName.
|
inherited |
Definition at line 117 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, and AsyncJob::inCall.
|
private |
|
protectedinherited |
Definition at line 32 of file Initiator.cc.
References CbcPointer< Cbc >::clear().
Referenced by ClientHttpRequest::handleAdaptedHeader(), ClientHttpRequest::noteAdaptationAnswer(), and Client::noteAdaptationAnswer().
|
protectedinherited |
Definition at line 74 of file Initiate.cc.
|
protectedinherited |
Definition at line 65 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::deleteThis(), AsyncJob::inCall, JobMemFun(), Must, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed(), and AsyncJob::deleteThis().
|
protectedinherited |
Definition at line 106 of file AsyncJob.cc.
References AsyncJob::doneAll(), and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), HappyConnOpener::checkForNewConnection(), Downloader::downloadFinished(), and HappyConnOpener::maybeOpenPrimeConnection().
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 210 of file Iterator.cc.
References AsyncJob::doneAll().
|
protected |
Definition at line 266 of file Iterator.cc.
References Adaptation::methodNone, Adaptation::methodReqmod, Adaptation::methodRespmod, and Must.
|
privatepure virtualinherited |
|
protected |
Definition at line 166 of file Iterator.cc.
References debugs.
|
protected |
Definition at line 175 of file Iterator.cc.
References debugs, Adaptation::Answer::Forward(), and Must.
|
protected |
Definition at line 133 of file Iterator.cc.
References debugs, HTTPMSGLOCK(), HTTPMSGUNLOCK(), and Must.
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
|
protectedinherited |
Definition at line 23 of file Initiator.cc.
References Adaptation::Initiate::initiator().
Referenced by ClientHttpRequest::startAdaptation(), and Client::startAdaptation().
|
inlineprotectedinherited |
Definition at line 52 of file Initiator.h.
References CbcPointer< Cbc >::set().
Referenced by ClientHttpRequest::startAdaptation(), and Client::startAdaptation().
|
inherited |
Definition at line 54 of file Initiate.cc.
References Must, and CbcPointer< Cbc >::valid().
Referenced by Adaptation::Initiator::initiateAdaptation().
|
protectedinherited |
Definition at line 85 of file AsyncJob.cc.
References debugs, AsyncJob::inCall, Must, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by HttpStateData::abortAll(), AsyncJob::callException(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), AsyncJob::handleStopRequest(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
|
virtualinherited |
AccessCheck calls this back with a possibly nil service group to signal whether adaptation is needed and where it should start.
Reimplemented in Client, and ClientHttpRequest.
Definition at line 17 of file Initiator.cc.
References Must.
|
overridevirtual |
called with the initial adaptation decision (adapt, block, error); virgin and/or adapted body transmission may continue after this
Implements Adaptation::Initiator.
Definition at line 115 of file Iterator.cc.
References Adaptation::Answer::akBlock, Adaptation::Answer::akError, Adaptation::Answer::akForward, Adaptation::Answer::final, RefCount< C >::getRaw(), Adaptation::Answer::kind, and Adaptation::Answer::message.
|
overridevirtual |
Implements Adaptation::Initiate.
Definition at line 159 of file Iterator.cc.
|
staticinherited |
Definition at line 215 of file AsyncJob.cc.
References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().
Referenced by mainInitialize().
|
staticprotectedinherited |
Definition at line 198 of file AsyncJob.cc.
References AllJobs().
Referenced by AsyncJob::RegisterWithCacheManager().
|
protectedinherited |
Definition at line 79 of file Initiate.cc.
References Adaptation::Initiator::noteAdaptationAnswer(), and ScheduleCallHere.
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 50 of file Iterator.cc.
References HttpRequest::adaptHistory(), Must, Adaptation::Config::needHistory, Adaptation::History::recordAdaptationService(), AsyncJob::start(), and StringToSBuf().
|
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 37 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(), and Rock::SwapDir::updateHeaders().
|
overrideprotectedvirtualinherited |
for debugging, starts with space
Reimplemented from AsyncJob.
Definition at line 92 of file Initiate.cc.
References AsyncJob::status().
|
protected |
Definition at line 71 of file Iterator.cc.
References HttpRequest::adaptHistory(), assert, Adaptation::Service::cfg(), HttpRequest::clearError(), DBG_CRITICAL, debugs, Adaptation::Answer::Forward(), Adaptation::ServiceConfig::key, Adaptation::Service::makeXactLauncher(), Must, Adaptation::Config::needHistory, Adaptation::History::recordAdaptationService(), Adaptation::Config::service_iteration_limit, StringToSBuf(), and TexcHere.
|
overrideprotectedvirtual |
Reimplemented from Adaptation::Initiate.
Definition at line 215 of file Iterator.cc.
References Adaptation::Initiate::swanSong().
|
protectedinherited |
Definition at line 87 of file Initiate.cc.
References Adaptation::Answer::Error().
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
|
protected |
Definition at line 226 of file Iterator.cc.
References HttpRequest::adaptHistory(), debugs, Adaptation::DynamicGroupCfg::empty(), Adaptation::History::extractNextServices(), Must, Adaptation::History::setFutureServices(), and Adaptation::DynamicServiceChain::Split().
|
protected |
Definition at line 73 of file Iterator.h.
|
protected |
Definition at line 70 of file Iterator.h.
|
inherited |
Definition at line 75 of file AsyncJob.h.
|
protectedinherited |
Definition at line 86 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
|
protected |
Definition at line 72 of file Iterator.h.
|
protectedinherited |
Definition at line 88 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().
|
protectedinherited |
Definition at line 84 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
|
protectedinherited |
Definition at line 89 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().
|
protected |
Definition at line 69 of file Iterator.h.
Referenced by Iterator().
|
protected |
Definition at line 66 of file Iterator.h.
|
protectedinherited |
Definition at line 51 of file Initiate.h.
|
protected |
Definition at line 71 of file Iterator.h.
|
protected |
Definition at line 68 of file Iterator.h.
Referenced by Iterator().
|
protected |
Definition at line 67 of file Iterator.h.
|
protectedinherited |
Definition at line 85 of file AsyncJob.h.
Referenced by AsyncJob::AsyncJob(), Adaptation::Icap::Xaction::Xaction(), AsyncJob::~AsyncJob(), AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::deleteThis(), and AsyncJob::mustStop().