#include <RockHeaderUpdater.h>
Classes | |
class | IoCbParams |
Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
HeaderUpdater (const Rock::SwapDir::Pointer &aStore, const Ipc::StoreMapUpdate &update) | |
~HeaderUpdater () override=default | |
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... | |
bool | doneAll () const override |
whether positive goal has been reached More... | |
void | swanSong () override |
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 | ReportAllJobs (StoreEntry *) |
writes a cache manager report about all jobs existing in this worker More... | |
Protected Attributes | |
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 (HeaderUpdater) | |
void | startReading () |
void | stopReading (const char *why) |
void | readMore (const char *why) |
void | noteRead (const IoCbParams result) |
void | noteDoneReading (int errflag) |
void | parseReadBytes () |
void | startWriting () |
void | noteDoneWriting (int errflag) |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Private Attributes | |
Rock::SwapDir::Pointer | store |
cache_dir where the entry is stored More... | |
Ipc::StoreMapUpdate | update |
Ipc::StoreMap update reservation. More... | |
StoreIOState::Pointer | reader |
reads old headers and old data More... | |
StoreIOState::Pointer | writer |
writes new headers and old data More... | |
SBuf | readerBuffer |
I/O buffer for a single read operation. More... | |
SBuf | exchangeBuffer |
bytes read but not yet discarded or written More... | |
uint64_t | bytesRead |
total entry bytes read from Store so far More... | |
size_t | staleSwapHeaderSize |
stored size of the stale entry metadata More... | |
SlotId | staleSplicingPointNext |
non-updatable old HTTP body suffix start More... | |
Static Private Attributes | |
static StoreIOState::STRCB | NoteRead |
static StoreIOState::STIOCB | NoteDoneReading |
static StoreIOState::STIOCB | NoteDoneWriting |
Detailed Description
Updates HTTP headers of a single Rock store entry:
- reads old body data in the same slot as the last old headers slot, if any
- writes new headers (1+ slots)
- writes old data (0-2 slots)
- chains the new entry prefix (1+ slots) to the old entry suffix (0+ slots)
Definition at line 26 of file RockHeaderUpdater.h.
Member Typedef Documentation
◆ Pointer
|
inherited |
Definition at line 34 of file AsyncJob.h.
Constructor & Destructor Documentation
◆ HeaderUpdater()
Rock::HeaderUpdater::HeaderUpdater | ( | const Rock::SwapDir::Pointer & | aStore, |
const Ipc::StoreMapUpdate & | update | ||
) |
Definition at line 20 of file RockHeaderUpdater.cc.
◆ ~HeaderUpdater()
|
overridedefault |
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 |
◆ 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()
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 34 of file RockHeaderUpdater.cc.
References AsyncJob::doneAll().
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ handleStopRequest()
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
◆ 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().
◆ noteDoneReading()
|
private |
Definition at line 152 of file RockHeaderUpdater.cc.
◆ noteDoneWriting()
|
private |
Definition at line 250 of file RockHeaderUpdater.cc.
References debugs, Must, Rock::IoState::splicingPoint, and Rock::IoState::writeableAnchor_.
◆ noteRead()
|
private |
Definition at line 110 of file RockHeaderUpdater.cc.
References Rock::HeaderUpdater::IoCbParams::buf, debugs, Must, and Rock::HeaderUpdater::IoCbParams::size.
◆ parseReadBytes()
|
private |
Definition at line 268 of file RockHeaderUpdater.cc.
References debugs, headersEnd(), Must, and Store::UnpackSwapMetaSize().
◆ readMore()
|
private |
Definition at line 127 of file RockHeaderUpdater.cc.
References debugs, Must, and storeRead().
◆ 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().
◆ start()
|
overrideprotectedvirtual |
◆ 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().
◆ startReading()
|
private |
Definition at line 72 of file RockHeaderUpdater.cc.
◆ startWriting()
|
private |
Definition at line 166 of file RockHeaderUpdater.cc.
References debugs, Must, Rock::IoState::staleSplicingPointNext, StoreIOState::wroteAll, and xfree.
◆ 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().
◆ stopReading()
|
private |
Definition at line 82 of file RockHeaderUpdater.cc.
References debugs, Must, StoreIOState::readerDone, Rock::IoState::splicingPoint, and Rock::IoState::staleSplicingPointNext.
◆ swanSong()
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 40 of file RockHeaderUpdater.cc.
References StoreIOState::readerDone, AsyncJob::swanSong(), Rock::IoState::writeableAnchor_, and StoreIOState::writerGone.
◆ toCbdata()
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ bytesRead
|
private |
Definition at line 69 of file RockHeaderUpdater.h.
◆ exchangeBuffer
|
private |
Definition at line 68 of file RockHeaderUpdater.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().
◆ NoteDoneReading
|
staticprivate |
Definition at line 48 of file RockHeaderUpdater.h.
◆ NoteDoneWriting
|
staticprivate |
Definition at line 49 of file RockHeaderUpdater.h.
◆ NoteRead
|
staticprivate |
Definition at line 47 of file RockHeaderUpdater.h.
◆ reader
|
private |
Definition at line 64 of file RockHeaderUpdater.h.
◆ readerBuffer
|
private |
Definition at line 67 of file RockHeaderUpdater.h.
◆ staleSplicingPointNext
|
private |
Definition at line 73 of file RockHeaderUpdater.h.
◆ staleSwapHeaderSize
|
private |
Definition at line 71 of file RockHeaderUpdater.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().
◆ store
|
private |
Definition at line 61 of file RockHeaderUpdater.h.
◆ 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().
◆ update
|
private |
Definition at line 62 of file RockHeaderUpdater.h.
◆ writer
|
private |
Definition at line 65 of file RockHeaderUpdater.h.
The documentation for this class was generated from the following files:
- src/fs/rock/RockHeaderUpdater.h
- src/fs/rock/RockHeaderUpdater.cc