iterates services in ServiceGroup, starting adaptation launchers More...

#include <Iterator.h>

Inheritance diagram for Adaptation::Iterator:
Collaboration diagram for Adaptation::Iterator:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Iterator (Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServiceGroupPointer &aGroup)
 
virtual ~Iterator ()
 
void noteInitiatorAborted ()
 
virtual void noteAdaptationAnswer (const Answer &answer)
 
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...
 
virtual void * toCbdata ()=0
 
virtual void noteAdaptationAclCheckDone (Adaptation::ServiceGroupPointer group)
 

Static Public Member Functions

static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) 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 swanSong ()
 
void step ()
 launches adaptation for the service selected by the plan More...
 
bool updatePlan (bool adopt)
 replace the current group and plan with service-proposed ones if needed More...
 
ServiceFilter filter () const
 creates service filter for the current step More...
 
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 ()
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
CbcPointer< InitiateinitiateAdaptation (Initiate *x)
 < starts freshly created initiate and returns a safe pointer to it More...
 
void clearAdaptation (CbcPointer< Initiate > &x)
 clears the pointer (does not call announceInitiatorAbort) More...
 
void announceInitiatorAbort (CbcPointer< Initiate > &x)
 inform the transaction about abnormal termination and clear the pointer More...
 
bool initiated (const CbcPointer< AsyncJob > &job) const
 Must(initiated(initiate)) instead of Must(initiate.set()), for clarity. More...
 

Protected Attributes

ServiceGroupPointer theGroup
 the service group we are iterating More...
 
ServicePlan thePlan
 which services to use and in what order More...
 
Http::MessagetheMsg
 the message being adapted (virgin for each step) More...
 
HttpRequesttheCause
 the cause of the original virgin message More...
 
AccessLogEntry::Pointer al
 info for the future access.log entry More...
 
CbcPointer< Adaptation::InitiatetheLauncher
 current transaction launcher More...
 
int iterations
 number of steps initiated More...
 
bool adapted
 whether the virgin message has been replaced More...
 
CbcPointer< InitiatortheInitiator
 
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...
 

Private Member Functions

 CBDATA_CLASS (Iterator)
 

Detailed Description

Definition at line 31 of file Iterator.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ Iterator()

Adaptation::Iterator::Iterator ( Http::Message virginHeader,
HttpRequest virginCause,
AccessLogEntry::Pointer alp,
const Adaptation::ServiceGroupPointer aGroup 
)

Definition at line 22 of file Iterator.cc.

References HTTPMSGLOCK(), NULL, theCause, and theMsg.

◆ ~Iterator()

Adaptation::Iterator::~Iterator ( )
virtual

Definition at line 43 of file Iterator.cc.

References assert, HTTPMSGUNLOCK(), theCause, theLauncher, and theMsg.

Member Function Documentation

◆ announceInitiatorAbort()

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

◆ 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()

Adaptation::Iterator::CBDATA_CLASS ( Iterator  )
private

◆ clearAdaptation()

◆ clearInitiator()

◆ deleteThis()

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

◆ done()

◆ doneAll()

bool Adaptation::Iterator::doneAll ( ) const
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 210 of file Iterator.cc.

References AsyncJob::doneAll(), Adaptation::ServicePlan::exhausted(), and thePlan.

◆ filter()

◆ handleAdaptationBlock()

void Adaptation::Iterator::handleAdaptationBlock ( const Answer answer)
protected

◆ handleAdaptationError()

◆ handleAdaptedHeader()

void Adaptation::Iterator::handleAdaptedHeader ( Http::Message msg)
protected

◆ initiateAdaptation()

◆ initiated()

bool Adaptation::Initiator::initiated ( const CbcPointer< AsyncJob > &  job) const
inlineprotectedinherited

◆ initiator()

void Adaptation::Initiate::initiator ( const CbcPointer< Initiator > &  i)
inherited

◆ 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(), handleAdaptationBlock(), handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Http::Tunneler::handleConnectionClosure(), 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(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), 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().

◆ noteAdaptationAclCheckDone()

void Adaptation::Initiator::noteAdaptationAclCheckDone ( Adaptation::ServiceGroupPointer  group)
virtualinherited

AccessCheck calls this back with a possibly nil service group to signal whether adaptation is needed and where it should start.

Reimplemented in ClientHttpRequest, and Client.

Definition at line 17 of file Initiator.cc.

References Must.

Referenced by Adaptation::Initiator::~Initiator().

◆ noteAdaptationAnswer()

void Adaptation::Iterator::noteAdaptationAnswer ( const Answer answer)
virtual

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(), handleAdaptationBlock(), handleAdaptationError(), handleAdaptedHeader(), Adaptation::Answer::kind, and Adaptation::Answer::message.

◆ noteInitiatorAborted()

void Adaptation::Iterator::noteInitiatorAborted ( )
virtual

◆ sendAnswer()

◆ Start()

◆ start()

◆ status()

const char * Adaptation::Initiate::status ( ) const
protectedvirtualinherited

for debugging, starts with space

Reimplemented from AsyncJob.

Reimplemented in Adaptation::Icap::Xaction, and Adaptation::Ecap::XactionRep.

Definition at line 92 of file Initiate.cc.

References AsyncJob::status().

Referenced by Adaptation::Initiate::swanSong().

◆ step()

◆ swanSong()

◆ tellQueryAborted()

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ updatePlan()

Member Data Documentation

◆ adapted

bool Adaptation::Iterator::adapted
protected

Definition at line 73 of file Iterator.h.

Referenced by handleAdaptationError(), and handleAdaptedHeader().

◆ al

AccessLogEntry::Pointer Adaptation::Iterator::al
protected

Definition at line 70 of file Iterator.h.

Referenced by filter(), and step().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ iterations

int Adaptation::Iterator::iterations
protected

Definition at line 72 of file Iterator.h.

Referenced by step().

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ theCause

HttpRequest* Adaptation::Iterator::theCause
protected

Definition at line 69 of file Iterator.h.

Referenced by filter(), handleAdaptedHeader(), Iterator(), start(), step(), updatePlan(), and ~Iterator().

◆ theGroup

ServiceGroupPointer Adaptation::Iterator::theGroup
protected

Definition at line 66 of file Iterator.h.

Referenced by filter(), start(), step(), and updatePlan().

◆ theInitiator

◆ theLauncher

CbcPointer<Adaptation::Initiate> Adaptation::Iterator::theLauncher
protected

◆ theMsg

Http::Message* Adaptation::Iterator::theMsg
protected

◆ thePlan

ServicePlan Adaptation::Iterator::thePlan
protected

Definition at line 67 of file Iterator.h.

Referenced by doneAll(), handleAdaptationError(), handleAdaptedHeader(), start(), step(), and updatePlan().

◆ typeName


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors