#include <RockHeaderUpdater.h>

Inheritance diagram for Rock::HeaderUpdater:
Collaboration diagram for Rock::HeaderUpdater:

Classes

class  IoCbParams
 

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 HeaderUpdater (const Rock::SwapDir::Pointer &aStore, const Ipc::StoreMapUpdate &update)
 
virtual ~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...
 
virtual void * toCbdata ()=0
 

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 () override
 called by AsyncStart; do not call directly More...
 
virtual bool doneAll () const override
 whether positive goal has been reached More...
 
virtual 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...
 

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...
 
const InstanceId< AsyncJobid
 job identifier 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)
 

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...
 
int 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

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

virtual Rock::HeaderUpdater::~HeaderUpdater ( )
overridevirtualdefault

Member Function Documentation

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

Rock::HeaderUpdater::CBDATA_CHILD ( HeaderUpdater  )
private

◆ deleteThis()

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

◆ done()

◆ doneAll()

bool Rock::HeaderUpdater::doneAll ( ) const
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 34 of file RockHeaderUpdater.cc.

References AsyncJob::doneAll(), reader, and writer.

Referenced by noteDoneWriting().

◆ 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(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), 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(), noteDoneReading(), Adaptation::Iterator::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().

◆ noteDoneReading()

void Rock::HeaderUpdater::noteDoneReading ( int  errflag)
private

Definition at line 153 of file RockHeaderUpdater.cc.

References debugs, Must, AsyncJob::mustStop(), reader, and writer.

Referenced by readMore().

◆ noteDoneWriting()

void Rock::HeaderUpdater::noteDoneWriting ( int  errflag)
private

◆ noteRead()

◆ parseReadBytes()

void Rock::HeaderUpdater::parseReadBytes ( )
private

◆ readMore()

void Rock::HeaderUpdater::readMore ( const char *  why)
private

◆ Start()

◆ start()

void Rock::HeaderUpdater::start ( )
overrideprotectedvirtual

◆ startReading()

void Rock::HeaderUpdater::startReading ( )
private

Definition at line 72 of file RockHeaderUpdater.cc.

References Ipc::StoreMapUpdate::entry, NoteDoneReading, reader, readMore(), store, and update.

Referenced by start().

◆ startWriting()

◆ status()

◆ stopReading()

◆ swanSong()

void Rock::HeaderUpdater::swanSong ( )
overrideprotectedvirtual

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ bytesRead

uint64_t Rock::HeaderUpdater::bytesRead
private

Definition at line 69 of file RockHeaderUpdater.h.

Referenced by noteRead(), and readMore().

◆ exchangeBuffer

SBuf Rock::HeaderUpdater::exchangeBuffer
private

Definition at line 68 of file RockHeaderUpdater.h.

Referenced by noteRead(), parseReadBytes(), and startWriting().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ NoteDoneReading

void Rock::HeaderUpdater::NoteDoneReading
staticprivate

Definition at line 48 of file RockHeaderUpdater.h.

Referenced by readMore(), and startReading().

◆ NoteDoneWriting

void Rock::HeaderUpdater::NoteDoneWriting
staticprivate

Definition at line 49 of file RockHeaderUpdater.h.

Referenced by startWriting().

◆ NoteRead

void Rock::HeaderUpdater::NoteRead
staticprivate

Definition at line 47 of file RockHeaderUpdater.h.

Referenced by readMore(), and stopReading().

◆ reader

StoreIOState::Pointer Rock::HeaderUpdater::reader
private

◆ readerBuffer

SBuf Rock::HeaderUpdater::readerBuffer
private

Definition at line 67 of file RockHeaderUpdater.h.

Referenced by noteRead(), and readMore().

◆ staleSplicingPointNext

SlotId Rock::HeaderUpdater::staleSplicingPointNext
private

Definition at line 73 of file RockHeaderUpdater.h.

Referenced by startWriting(), and stopReading().

◆ staleSwapHeaderSize

int Rock::HeaderUpdater::staleSwapHeaderSize
private

Definition at line 71 of file RockHeaderUpdater.h.

Referenced by parseReadBytes().

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ store

Rock::SwapDir::Pointer Rock::HeaderUpdater::store
private

Definition at line 61 of file RockHeaderUpdater.h.

Referenced by noteDoneWriting(), readMore(), startReading(), startWriting(), and swanSong().

◆ typeName

◆ update

Ipc::StoreMapUpdate Rock::HeaderUpdater::update
private

◆ writer

StoreIOState::Pointer Rock::HeaderUpdater::writer
private

Definition at line 65 of file RockHeaderUpdater.h.

Referenced by doneAll(), noteDoneReading(), noteDoneWriting(), startWriting(), and swanSong().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors