#include <XactionRep.h>
Public Types | |
typedef libecap::shared_ptr< libecap::adapter::Xaction > | AdapterXaction |
typedef CbcPointer< AsyncJob > | Pointer |
typedef CbcPointer< BodyConsumer > | Pointer |
typedef CbcPointer< BodyProducer > | Pointer |
Public Member Functions | |
XactionRep (Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServicePointer &service) | |
~XactionRep () override | |
void | master (const AdapterXaction &aMaster) |
const libecap::Area | option (const libecap::Name &name) const override |
void | visitEachOption (libecap::NamedValueVisitor &visitor) const override |
libecap::Message & | virgin () override |
const libecap::Message & | cause () override |
libecap::Message & | adapted () override |
void | useVirgin () override |
void | useAdapted (const libecap::shared_ptr< libecap::Message > &msg) override |
void | blockVirgin () override |
void | adaptationDelayed (const libecap::Delay &) override |
void | adaptationAborted () override |
void | resume () override |
void | vbDiscard () override |
void | vbMake () override |
void | vbStopMaking () override |
void | vbMakeMore () override |
libecap::Area | vbContent (libecap::size_type offset, libecap::size_type size) override |
void | vbContentShift (libecap::size_type size) override |
void | noteAbContentDone (bool atEnd) override |
void | noteAbContentAvailable () override |
void | noteMoreBodySpaceAvailable (RefCount< BodyPipe > bp) override |
void | noteBodyConsumerAborted (RefCount< BodyPipe > bp) override |
void | noteMoreBodyDataAvailable (RefCount< BodyPipe > bp) override |
void | noteBodyProductionEnded (RefCount< BodyPipe > bp) override |
void | noteBodyProducerAborted (RefCount< BodyPipe > bp) override |
void | noteInitiatorAborted () override |
void | start () override |
called by AsyncStart; do not call directly More... | |
bool | doneAll () const override |
whether positive goal has been reached More... | |
void | swanSong () override |
const char * | status () const override |
internal cleanup; do not call directly More... | |
void | initiator (const CbcPointer< Initiator > &i) |
sets initiator 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 | callException (const std::exception &e) |
called when the job throws during an async call 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 | Start (const Pointer &job) |
static void | RegisterWithCacheManager () |
Public Attributes | |
const InstanceId< AsyncJob > | id |
job identifier More... | |
Protected Member Functions | |
Service & | service () |
Adaptation::Message & | answer () |
void | sinkVb (const char *reason) |
void | preserveVb (const char *reason) |
void | forgetVb (const char *reason) |
void | moveAbContent () |
void | updateHistory (Http::Message *adapted) |
void | terminateMaster () |
void | scheduleStop (const char *reason) |
void | updateSources (Http::Message *adapted) |
const libecap::Area | clientIpValue () const |
const libecap::Area | usernameValue () const |
const libecap::Area | masterxSharedValue (const libecap::Name &name) const |
const libecap::Area | metaValue (const libecap::Name &name) const |
Return the adaptation meta header value for the given header "name". More... | |
void | visitEachMetaHeader (libecap::NamedValueVisitor &visitor) const |
Return the adaptation meta headers and their values. More... | |
void | doResume () |
void | sendAnswer (const Answer &answer) |
void | tellQueryAborted (bool final) |
void | clearInitiator () |
void | deleteThis (const char *aReason) |
void | mustStop (const char *aReason) |
bool | done () const |
the job is destroyed in callEnd() when done() More... | |
void | stopConsumingFrom (RefCount< BodyPipe > &) |
void | stopProducingFor (RefCount< BodyPipe > &, bool atEof) |
Static Protected Member Functions | |
static void | ReportAllJobs (StoreEntry *) |
writes a cache manager report about all jobs existing in this worker More... | |
Protected Attributes | |
CbcPointer< Initiator > | theInitiator |
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... | |
Private Types | |
enum | OperationState { opUndecided , opOn , opComplete , opNever } |
typedef libecap::shared_ptr< libecap::Message > | MessagePtr |
Private Member Functions | |
CBDATA_CHILD (XactionRep) | |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Private Attributes | |
AdapterXaction | theMaster |
Adaptation::ServicePointer | theService |
xaction's adaptation service More... | |
MessageRep | theVirginRep |
MessageRep * | theCauseRep |
MessagePtr | theAnswerRep |
OperationState | makingVb |
OperationState | proxyingAb |
int | adaptHistoryId |
adaptation history slot reservation More... | |
bool | vbProductionFinished |
bool | abProductionFinished |
bool | abProductionAtEnd |
AccessLogEntry::Pointer | al |
Master transaction AccessLogEntry. More... | |
Detailed Description
Definition at line 32 of file XactionRep.h.
Member Typedef Documentation
◆ AdapterXaction
typedef libecap::shared_ptr<libecap::adapter::Xaction> Adaptation::Ecap::XactionRep::AdapterXaction |
Definition at line 41 of file XactionRep.h.
◆ MessagePtr
|
private |
Definition at line 116 of file XactionRep.h.
◆ Pointer [1/3]
|
inherited |
Definition at line 34 of file AsyncJob.h.
◆ Pointer [2/3]
|
inherited |
Definition at line 25 of file BodyPipe.h.
◆ Pointer [3/3]
|
inherited |
Definition at line 45 of file BodyPipe.h.
Member Enumeration Documentation
◆ OperationState
|
private |
Enumerator | |
---|---|
opUndecided | |
opOn | |
opComplete | |
opNever |
Definition at line 119 of file XactionRep.h.
Constructor & Destructor Documentation
◆ XactionRep()
Adaptation::Ecap::XactionRep::XactionRep | ( | Http::Message * | virginHeader, |
HttpRequest * | virginCause, | ||
AccessLogEntry::Pointer & | alp, | ||
const Adaptation::ServicePointer & | service | ||
) |
Definition at line 47 of file XactionRep.cc.
References theCauseRep.
◆ ~XactionRep()
|
override |
Definition at line 64 of file XactionRep.cc.
References assert.
Member Function Documentation
◆ adaptationAborted()
|
override |
Definition at line 619 of file XactionRep.cc.
◆ adaptationDelayed()
|
override |
Definition at line 611 of file XactionRep.cc.
References debugs.
◆ adapted()
|
override |
Definition at line 317 of file XactionRep.cc.
References Must.
◆ answer()
|
protected |
Definition at line 324 of file XactionRep.cc.
References Must, and Adaptation::Ecap::MessageRep::raw().
◆ blockVirgin()
|
override |
Definition at line 443 of file XactionRep.cc.
References Adaptation::Answer::Block(), debugs, and Must.
◆ callEnd()
|
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().
◆ callException()
|
virtualinherited |
Reimplemented in ConnStateData, ClientHttpRequest, 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().
◆ callStart()
|
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.
◆ canBeCalled()
|
inherited |
Definition at line 117 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, and AsyncJob::inCall.
◆ cause()
|
override |
Definition at line 310 of file XactionRep.cc.
References Must.
◆ CBDATA_CHILD()
|
private |
◆ clearInitiator()
|
protectedinherited |
Definition at line 74 of file Initiate.cc.
◆ clientIpValue()
|
protected |
Definition at line 122 of file XactionRep.cc.
References HttpRequest::client_addr, HttpRequest::indirect_client_addr, Ip::Address::isAnyAddr(), Ip::Address::isNoAddr(), MAX_IPSTRLEN, Must, Adaptation::Config::send_client_ip, Adaptation::Ecap::TheConfig, Ip::Address::toStr(), and Adaptation::Config::use_indirect_client.
◆ deleteThis()
|
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().
◆ done()
|
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().
◆ doneAll()
|
overridevirtual |
Reimplemented from AsyncJob.
Definition at line 342 of file XactionRep.cc.
References AsyncJob::doneAll().
◆ doResume()
|
protected |
the guts of libecap::host::Xaction::resume() API implementation which just goes async in Adaptation::Ecap::XactionRep::resume().
Definition at line 297 of file XactionRep.cc.
References Must.
Referenced by resume().
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ forgetVb()
|
protected |
Definition at line 380 of file XactionRep.cc.
References debugs, and BodyPipe::stillConsuming().
◆ handleStopRequest()
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
◆ initiator()
|
inherited |
Definition at line 54 of file Initiate.cc.
References Must, and CbcPointer< Cbc >::valid().
Referenced by Adaptation::Initiator::initiateAdaptation().
◆ master()
void Adaptation::Ecap::XactionRep::master | ( | const AdapterXaction & | aMaster | ) |
Definition at line 72 of file XactionRep.cc.
References Must.
Referenced by Adaptation::Ecap::ServiceRep::makeXactLauncher().
◆ masterxSharedValue()
|
protected |
Definition at line 165 of file XactionRep.cc.
References HttpRequest::adaptHistory(), Adaptation::History::getXxRecord(), Must, String::rawBuf(), and String::size().
◆ metaValue()
|
protected |
Definition at line 182 of file XactionRep.cc.
References Adaptation::Config::metaHeaders, Must, and SBuf::toStdString().
◆ moveAbContent()
|
protected |
Definition at line 676 of file XactionRep.cc.
◆ mustStop()
|
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(), HttpStateData::handleMoreRequestBodyAvailable(), AsyncJob::handleStopRequest(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ noteAbContentAvailable()
|
override |
Definition at line 593 of file XactionRep.cc.
References Must.
◆ noteAbContentDone()
|
override |
Definition at line 583 of file XactionRep.cc.
◆ noteBodyConsumerAborted()
◆ noteBodyProducerAborted()
◆ noteBodyProductionEnded()
◆ noteInitiatorAborted()
|
overridevirtual |
Implements Adaptation::Initiate.
Definition at line 669 of file XactionRep.cc.
◆ noteMoreBodyDataAvailable()
◆ noteMoreBodySpaceAvailable()
◆ option()
|
override |
Definition at line 87 of file XactionRep.cc.
References Adaptation::Config::masterx_shared_name.
◆ preserveVb()
|
protected |
Definition at line 364 of file XactionRep.cc.
References BodyPipe::consumedSize(), debugs, and Must.
◆ RegisterWithCacheManager()
|
staticinherited |
Definition at line 215 of file AsyncJob.cc.
References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().
Referenced by mainInitialize().
◆ ReportAllJobs()
|
staticprotectedinherited |
Definition at line 198 of file AsyncJob.cc.
References AllJobs().
Referenced by AsyncJob::RegisterWithCacheManager().
◆ resume()
|
override |
Definition at line 285 of file XactionRep.cc.
References asyncCall(), doResume(), and ScheduleCallHere.
◆ scheduleStop()
|
protected |
◆ sendAnswer()
|
protectedinherited |
Definition at line 79 of file Initiate.cc.
References Adaptation::Initiator::noteAdaptationAnswer(), and ScheduleCallHere.
◆ service()
|
protected |
Definition at line 80 of file XactionRep.cc.
References Must.
◆ sinkVb()
|
protected |
Definition at line 350 of file XactionRep.cc.
References debugs, and BodyPipe::enableAutoConsumption().
◆ start()
|
overridevirtual |
Reimplemented from AsyncJob.
Definition at line 223 of file XactionRep.cc.
References HttpRequest::adaptLogHistory(), NotePairs::add(), current_time, NotePairs::hasPair(), Adaptation::Config::metaHeaders, Adaptation::History::metaHeaders, Must, and Adaptation::History::recordXactStart().
◆ 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 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(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ status()
|
overridevirtual |
for debugging, starts with space
Reimplemented from AsyncJob.
Definition at line 692 of file XactionRep.cc.
References MemBuf::append(), Packable::appendf(), Adaptation::Message::body_pipe, MemBuf::content(), Must, Adaptation::Ecap::MessageRep::raw(), MemBuf::reset(), BodyPipe::stillConsuming(), BodyPipe::stillProducing(), and MemBuf::terminate().
◆ stopConsumingFrom()
Definition at line 118 of file BodyPipe.cc.
References assert, BodyPipe::clearConsumer(), and debugs.
Referenced by ClientHttpRequest::~ClientHttpRequest(), Client::cleanAdaptation(), Client::doneSendingRequestBody(), Client::endAdaptedBodyConsumption(), ClientHttpRequest::endRequestSatisfaction(), Client::handleAdaptedBodyProducerAborted(), Client::handleRequestBodyProducerAborted(), BodySink::noteBodyProducerAborted(), ClientHttpRequest::noteBodyProducerAborted(), BodySink::noteBodyProductionEnded(), Client::serverComplete(), and Client::swanSong().
◆ stopProducingFor()
Definition at line 107 of file BodyPipe.cc.
References assert, BodyPipe::clearProducer(), and debugs.
Referenced by ConnStateData::~ConnStateData(), Client::cleanAdaptation(), ConnStateData::finishDechunkingRequest(), Client::noteBodyConsumerAborted(), and Client::serverComplete2().
◆ swanSong()
|
overridevirtual |
Reimplemented from AsyncJob.
Definition at line 255 of file XactionRep.cc.
References HttpRequest::adaptLogHistory(), Must, Adaptation::History::recordXactFinish(), BodyPipe::stillConsuming(), BodyPipe::stillProducing(), and Adaptation::Initiate::swanSong().
◆ tellQueryAborted()
|
protectedinherited |
Definition at line 87 of file Initiate.cc.
References Adaptation::Answer::Error().
◆ terminateMaster()
|
protected |
Definition at line 332 of file XactionRep.cc.
◆ toCbdata()
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
◆ updateHistory()
|
protected |
Called just before sendAnswer() to record adapter meta-information which may affect answer processing and may be needed for logging.
Definition at line 459 of file XactionRep.cc.
References HttpRequest::adaptHistory(), HttpRequest::adaptLogHistory(), hoReply, Adaptation::Config::masterx_shared_name, Must, Adaptation::History::recordMeta(), Adaptation::History::updateNextServices(), and Adaptation::History::updateXxRecord().
◆ updateSources()
|
protected |
Definition at line 735 of file XactionRep.cc.
References HttpRequest::masterXaction, Must, Http::Message::sources, Http::Message::srcEcap, and Http::Message::srcEcaps.
◆ useAdapted()
|
override |
Definition at line 413 of file XactionRep.cc.
References Http::Message::body_pipe, debugs, Adaptation::Answer::Forward(), Http::Message::header, Must, and Adaptation::Ecap::MessageRep::tieBody().
◆ usernameValue()
|
protected |
Definition at line 147 of file XactionRep.cc.
References HttpRequest::auth_user_request, HttpRequest::extacl_user, Must, String::rawBuf(), String::size(), and Auth::UserRequest::username().
◆ useVirgin()
|
override |
Definition at line 395 of file XactionRep.cc.
References Http::Message::body_pipe, debugs, Adaptation::Answer::Forward(), Http::Message::header, and Must.
◆ vbContent()
|
override |
Definition at line 545 of file XactionRep.cc.
References BodyPipe::buf(), MemBuf::content(), MemBuf::contentSize(), min(), Must, and size.
◆ vbContentShift()
|
override |
Definition at line 569 of file XactionRep.cc.
References BodyPipe::buf(), BodyPipe::consume(), MemBuf::contentSize(), min(), Must, and size.
◆ vbDiscard()
|
override |
Definition at line 507 of file XactionRep.cc.
References Must.
◆ vbMake()
|
override |
Definition at line 516 of file XactionRep.cc.
References Must, and BodyPipe::setConsumerIfNotLate().
◆ vbMakeMore()
|
override |
Definition at line 535 of file XactionRep.cc.
References BodyPipe::mayNeedMoreData(), Must, BodyPipe::productionEnded(), and BodyPipe::stillConsuming().
◆ vbStopMaking()
|
override |
Definition at line 526 of file XactionRep.cc.
References Must.
◆ virgin()
|
override |
Definition at line 304 of file XactionRep.cc.
◆ visitEachMetaHeader()
|
protected |
Definition at line 205 of file XactionRep.cc.
References Adaptation::Config::metaHeaders, Must, and SBuf::toStdString().
◆ visitEachOption()
|
override |
Definition at line 103 of file XactionRep.cc.
References Adaptation::Config::masterx_shared_name.
Member Data Documentation
◆ abProductionAtEnd
|
private |
Definition at line 125 of file XactionRep.h.
◆ abProductionFinished
|
private |
Definition at line 124 of file XactionRep.h.
◆ adaptHistoryId
|
private |
Definition at line 122 of file XactionRep.h.
◆ al
|
private |
Definition at line 126 of file XactionRep.h.
◆ id
|
inherited |
Definition at line 75 of file AsyncJob.h.
◆ inCall
|
protectedinherited |
Definition at line 86 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ makingVb
|
private |
Definition at line 120 of file XactionRep.h.
◆ proxyingAb
|
private |
Definition at line 121 of file XactionRep.h.
◆ started_
|
protectedinherited |
Definition at line 88 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().
◆ stopReason
|
protectedinherited |
Definition at line 84 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
◆ swanSang_
|
protectedinherited |
Definition at line 89 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().
◆ theAnswerRep
|
private |
Definition at line 117 of file XactionRep.h.
◆ theCauseRep
|
private |
Definition at line 114 of file XactionRep.h.
Referenced by XactionRep().
◆ theInitiator
|
protectedinherited |
Definition at line 51 of file Initiate.h.
◆ theMaster
|
private |
Definition at line 110 of file XactionRep.h.
◆ theService
|
private |
Definition at line 111 of file XactionRep.h.
◆ theVirginRep
|
private |
Definition at line 113 of file XactionRep.h.
◆ typeName
|
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().
◆ vbProductionFinished
|
private |
Definition at line 123 of file XactionRep.h.
The documentation for this class was generated from the following files:
- src/adaptation/ecap/XactionRep.h
- src/adaptation/ecap/XactionRep.cc