#include <ActionWriter.h>
Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
ActionWriter (const Action::Pointer &anAction, const Comm::ConnectionPointer &conn) | |
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 | |
void | start () override |
called by AsyncStart; do not call directly More... | |
void | swanSong () override |
bool | doneAll () const override |
whether positive goal has been reached More... | |
void | scheduleStoreCopy () |
request more action results from the store More... | |
void | noteStoreCopied (StoreIOBuffer ioBuf) |
receive some action results from the store More... | |
void | scheduleCommWrite (const StoreIOBuffer &ioBuf) |
tell Comm to write action results More... | |
void | noteCommWrote (const CommIoCbParams ¶ms) |
called by Comm after the action results are written More... | |
void | noteCommClosed (const CommCloseCbParams ¶ms) |
called by Comm if the client socket got closed More... | |
void | close () |
closes the local connection to the HTTP client, if any More... | |
void | deleteThis (const char *aReason) |
void | mustStop (const char *aReason) |
bool | done () const |
the job is destroyed in callEnd() when done() More... | |
virtual const char * | status () const |
internal cleanup; do not call directly More... | |
Static Protected Member Functions | |
static void | NoteStoreCopied (void *data, StoreIOBuffer ioBuf) |
static void | HandleStoreAbort (StoreToCommWriter *param) |
called by Store if the entry is no longer usable More... | |
static void | ReportAllJobs (StoreEntry *) |
writes a cache manager report about all jobs existing in this worker More... | |
Protected Attributes | |
Comm::ConnectionPointer | clientConnection |
HTTP client descriptor. More... | |
StoreEntry * | entry |
store entry with the cache manager response More... | |
store_client * | sc |
our registration with the store More... | |
int64_t | writeOffset |
number of bytes written to the client More... | |
AsyncCall::Pointer | closer |
comm_close handler More... | |
char | buffer [HTTP_REQBUF_SZ] |
action results; Store fills, Comm writes 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... | |
bool | started_ = false |
Start() has finished successfully. More... | |
bool | swanSang_ = false |
swanSong() was called More... | |
Private Member Functions | |
CBDATA_CHILD (ActionWriter) | |
CBDATA_INTERMEDIATE () | |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Private Attributes | |
Action::Pointer | action |
action that fills the entry More... | |
Detailed Description
Creates Store entry, fills it using action's fillEntry(), and Comm-writes it using parent StoreToCommWriter.
Definition at line 22 of file ActionWriter.h.
Member Typedef Documentation
◆ Pointer
|
inherited |
Definition at line 34 of file AsyncJob.h.
Constructor & Destructor Documentation
◆ ActionWriter()
Mgr::ActionWriter::ActionWriter | ( | const Action::Pointer & | anAction, |
const Comm::ConnectionPointer & | conn | ||
) |
Definition at line 19 of file ActionWriter.cc.
Member Function Documentation
◆ 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.
◆ CBDATA_CHILD()
|
private |
◆ CBDATA_INTERMEDIATE()
|
privateinherited |
◆ close()
|
protectedinherited |
closes our copy of the client HTTP connection socket
Definition at line 43 of file StoreToCommWriter.cc.
References comm_remove_close_handler(), and Comm::IsConnOpen().
◆ 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()
|
overrideprotectedvirtualinherited |
Reimplemented from AsyncJob.
Definition at line 158 of file StoreToCommWriter.cc.
References STORE_OK.
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ handleStopRequest()
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
◆ HandleStoreAbort()
|
staticprotectedinherited |
Definition at line 166 of file StoreToCommWriter.cc.
References Mgr::StoreToCommWriter::clientConnection, Comm::Connection::close(), and Comm::IsConnOpen().
Referenced by Mgr::StoreToCommWriter::start().
◆ 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().
◆ noteCommClosed()
|
protectedinherited |
Definition at line 130 of file StoreToCommWriter.cc.
References debugs, and MYNAME.
Referenced by Mgr::StoreToCommWriter::StoreToCommWriter().
◆ noteCommWrote()
|
protectedinherited |
Definition at line 118 of file StoreToCommWriter.cc.
References debugs, CommCommonCbParams::fd, CommCommonCbParams::flag, Must, MYNAME, Comm::OK, and CommIoCbParams::size.
Referenced by Mgr::StoreToCommWriter::scheduleCommWrite().
◆ noteStoreCopied()
|
protectedinherited |
Definition at line 93 of file StoreToCommWriter.cc.
References debugs, StoreIOBuffer::error, StoreIOBuffer::flags, StoreIOBuffer::length, Must, and MYNAME.
Referenced by Mgr::StoreToCommWriter::NoteStoreCopied().
◆ NoteStoreCopied()
|
staticprotectedinherited |
Definition at line 80 of file StoreToCommWriter.cc.
References asyncCall(), Must, Mgr::StoreToCommWriter::noteStoreCopied(), and ScheduleCallHere.
◆ 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().
◆ scheduleCommWrite()
|
protectedinherited |
Definition at line 104 of file StoreToCommWriter.cc.
References asyncCall(), StoreIOBuffer::data, debugs, Comm::IsConnOpen(), StoreIOBuffer::length, Must, MYNAME, Mgr::StoreToCommWriter::noteCommWrote(), and Comm::Write().
◆ scheduleStoreCopy()
|
protectedinherited |
Definition at line 70 of file StoreToCommWriter.cc.
References debugs, Must, MYNAME, sc, and storeClientCopy().
◆ start()
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 27 of file ActionWriter.cc.
References action(), debugs, Must, MYNAME, and Mgr::StoreToCommWriter::start().
◆ 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()
|
protectedvirtualinherited |
for debugging, starts with space
Reimplemented in Adaptation::Ecap::XactionRep, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Adaptation::Initiate, Http::Tunneler, Comm::TcpAcceptor, HappyConnOpener, Ipc::Inquirer, and Security::PeerConnector.
Definition at line 182 of file AsyncJob.cc.
References MemBuf::append(), Packable::appendf(), MemBuf::content(), MemBuf::reset(), AsyncJob::stopReason, and MemBuf::terminate().
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), Adaptation::Initiate::status(), and Comm::TcpAcceptor::status().
◆ swanSong()
|
overrideprotectedvirtualinherited |
Reimplemented from AsyncJob.
Definition at line 142 of file StoreToCommWriter.cc.
References debugs, MYNAME, sc, and storeUnregister().
Referenced by Mgr::Filler::swanSong().
◆ toCbdata()
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ action
|
private |
Definition at line 34 of file ActionWriter.h.
Referenced by ActionWriter().
◆ buffer
|
protectedinherited |
Definition at line 69 of file StoreToCommWriter.h.
◆ clientConnection
|
protectedinherited |
Definition at line 62 of file StoreToCommWriter.h.
Referenced by Mgr::StoreToCommWriter::StoreToCommWriter(), and Mgr::StoreToCommWriter::HandleStoreAbort().
◆ closer
|
protectedinherited |
Definition at line 68 of file StoreToCommWriter.h.
Referenced by Mgr::StoreToCommWriter::StoreToCommWriter().
◆ entry
|
protectedinherited |
Definition at line 64 of file StoreToCommWriter.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().
◆ sc
|
protectedinherited |
Definition at line 65 of file StoreToCommWriter.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().
◆ 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().
◆ writeOffset
|
protectedinherited |
Definition at line 66 of file StoreToCommWriter.h.
The documentation for this class was generated from the following files:
- src/mgr/ActionWriter.h
- src/mgr/ActionWriter.cc