Squid Web Cache master
Loading...
Searching...
No Matches
Mgr::Forwarder Class Referenceabstract

#include <Forwarder.h>

Inheritance diagram for Mgr::Forwarder:
[legend]
Collaboration diagram for Mgr::Forwarder:
[legend]

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Forwarder (const Comm::ConnectionPointer &aConn, const ActionParams &aParams, HttpRequest *aRequest, StoreEntry *anEntry, const AccessLogEntryPointer &anAle)
 
 ~Forwarder () override
 
void callException (const std::exception &e) override
 called when the job throws during an async call
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method
 
void handleStopRequest ()
 process external request to terminate now (i.e. during this async call)
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void HandleRemoteAck (RequestId)
 finds and calls the right Forwarder upon Coordinator's response
 
static void Start (const Pointer &job)
 
static void RegisterWithCacheManager ()
 

Public Attributes

CodeContextPointer codeContext
 
const InstanceId< AsyncJobid
 job identifier
 

Protected Types

typedef std::map< RequestId::Index, AsyncCall::PointerRequestsMap
 maps request->id to Forwarder::handleRemoteAck callback
 

Protected Member Functions

void swanSong () override
 closes our copy of the client HTTP connection socket
 
void handleError () override
 
void handleTimeout () override
 
void handleException (const std::exception &e) override
 terminate with an error
 
void start () override
 called by AsyncStart; do not call directly
 
bool doneAll () const override
 whether positive goal has been reached
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done()
 
virtual const char * status () const
 internal cleanup; do not call directly
 

Static Protected Member Functions

static void ReportAllJobs (StoreEntry *)
 writes a cache manager report about all jobs existing in this worker
 

Protected Attributes

Request::Pointer request
 
const double timeout
 response wait timeout in seconds
 
const char * stopReason
 reason for forcing done() to be true
 
const char * typeName
 kid (leaf) class name, for debugging
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any
 
bool started_ = false
 Start() has finished successfully.
 
bool swanSang_ = false
 swanSong() was called
 

Static Protected Attributes

static RequestsMap TheRequestsMap
 pending Coordinator requests
 
static RequestId::Index LastRequestId = 0
 last requestId used
 

Private Member Functions

 CBDATA_CHILD (Forwarder)
 
void noteCommClosed (const CommCloseCbParams &params)
 called when the client socket gets closed by some external force
 
void sendError (ErrorState *error)
 send error page
 
 CBDATA_INTERMEDIATE ()
 
void requestTimedOut ()
 called when Coordinator fails to start processing the request [in time]
 
void removeTimeoutEvent ()
 called when we are no longer waiting for Coordinator to respond
 
void handleRemoteAck ()
 called when Coordinator starts processing the request
 
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE()
 

Static Private Member Functions

static void RequestTimedOut (void *param)
 Ipc::Forwarder::requestTimedOut wrapper.
 
static AsyncCall::Pointer DequeueRequest (RequestId::Index)
 returns and forgets the right Forwarder callback for the request
 

Private Attributes

HttpRequesthttpRequest
 HTTP client request for detailing errors.
 
StoreEntryentry
 Store entry expecting the response.
 
Comm::ConnectionPointer conn
 HTTP client connection descriptor.
 
AsyncCall::Pointer closer
 comm_close handler for the HTTP connection
 
AccessLogEntryPointer ale
 more transaction details
 

Detailed Description

Forwards a single client cache manager request to Coordinator. Waits for an ACK from Coordinator while holding the Store entry. Fills the store entry with an error response if forwarding fails.

Definition at line 31 of file Forwarder.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

◆ RequestsMap

typedef std::map<RequestId::Index, AsyncCall::Pointer> Ipc::Forwarder::RequestsMap
protectedinherited

Definition at line 69 of file Forwarder.h.

Constructor & Destructor Documentation

◆ Forwarder()

Mgr::Forwarder::Forwarder ( const Comm::ConnectionPointer aConn,
const ActionParams aParams,
HttpRequest aRequest,
StoreEntry anEntry,
const AccessLogEntryPointer anAle 
)

◆ ~Forwarder()

Mgr::Forwarder::~Forwarder ( )
override

Definition at line 50 of file Forwarder.cc.

References HTTPMSGUNLOCK(), Must, and SWALLOW_EXCEPTIONS.

Member Function Documentation

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

void Ipc::Forwarder::callException ( const std::exception &  e)
overridevirtualinherited

Reimplemented from AsyncJob.

Definition at line 139 of file Forwarder.cc.

References AsyncJob::callException(), DBG_CRITICAL, and debugs.

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 117 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, and AsyncJob::inCall.

◆ CBDATA_CHILD()

Mgr::Forwarder::CBDATA_CHILD ( Forwarder  )
private

◆ CBDATA_INTERMEDIATE()

Ipc::Forwarder::CBDATA_INTERMEDIATE ( )
privateinherited

◆ deleteThis()

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

◆ DequeueRequest()

AsyncCall::Pointer Ipc::Forwarder::DequeueRequest ( RequestId::Index  requestId)
staticprivateinherited

Definition at line 151 of file Forwarder.cc.

References debugs, Must, and MYNAME.

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Ipc::Forwarder::doneAll ( ) const
overrideprotectedvirtualinherited

Reimplemented from AsyncJob.

Definition at line 78 of file Forwarder.cc.

References debugs, and MYNAME.

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ handleError()

void Mgr::Forwarder::handleError ( )
overrideprotectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 76 of file Forwarder.cc.

References DBG_CRITICAL, debugs, ERR_INVALID_URL, and Http::scUriTooLong.

◆ handleException()

void Mgr::Forwarder::handleException ( const std::exception &  e)
overrideprotectedvirtual

◆ handleRemoteAck()

void Ipc::Forwarder::handleRemoteAck ( )
privateinherited

Definition at line 86 of file Forwarder.cc.

References debugs, and MYNAME.

Referenced by Ipc::Forwarder::start().

◆ HandleRemoteAck()

void Ipc::Forwarder::HandleRemoteAck ( RequestId  requestId)
staticinherited

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )
inlineinherited

Definition at line 73 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ handleTimeout()

void Mgr::Forwarder::handleTimeout ( )
overrideprotectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 84 of file Forwarder.cc.

References ERR_LIFETIME_EXP, Ipc::Forwarder::handleTimeout(), and Http::scRequestTimeout.

◆ mustStop()

◆ noteCommClosed()

void Mgr::Forwarder::noteCommClosed ( const CommCloseCbParams params)
private

Definition at line 100 of file Forwarder.cc.

References debugs, and MYNAME.

Referenced by Forwarder().

◆ RegisterWithCacheManager()

void AsyncJob::RegisterWithCacheManager ( )
staticinherited

Definition at line 215 of file AsyncJob.cc.

References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().

Referenced by mainInitialize().

◆ removeTimeoutEvent()

void Ipc::Forwarder::removeTimeoutEvent ( )
privateinherited

Definition at line 167 of file Forwarder.cc.

References eventDelete(), eventFind(), and Ipc::Forwarder::RequestTimedOut().

◆ ReportAllJobs()

void AsyncJob::ReportAllJobs ( StoreEntry e)
staticprotectedinherited

Definition at line 198 of file AsyncJob.cc.

References AllJobs().

Referenced by AsyncJob::RegisterWithCacheManager().

◆ requestTimedOut()

void Ipc::Forwarder::requestTimedOut ( )
privateinherited

Definition at line 112 of file Forwarder.cc.

References debugs, and MYNAME.

◆ RequestTimedOut()

void Ipc::Forwarder::RequestTimedOut ( void *  param)
staticprivateinherited

◆ sendError()

void Mgr::Forwarder::sendError ( ErrorState error)
private

Definition at line 113 of file Forwarder.cc.

References debugs, error(), Must, MYNAME, and squid_curtime.

◆ start()

void Ipc::Forwarder::start ( )
overrideprotectedvirtualinherited

◆ Start()

◆ status()

◆ swanSong()

void Mgr::Forwarder::swanSong ( )
overrideprotectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 62 of file Forwarder.cc.

References comm_remove_close_handler(), Comm::IsConnOpen(), and Ipc::Forwarder::swanSong().

◆ toCbdata()

virtual void * CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ ale

AccessLogEntryPointer Mgr::Forwarder::ale
private

Definition at line 56 of file Forwarder.h.

◆ closer

AsyncCall::Pointer Mgr::Forwarder::closer
private

Definition at line 55 of file Forwarder.h.

Referenced by Forwarder().

◆ codeContext

CodeContextPointer Ipc::Forwarder::codeContext
inherited

Definition at line 43 of file Forwarder.h.

Referenced by Ipc::Forwarder::RequestTimedOut().

◆ conn

Comm::ConnectionPointer Mgr::Forwarder::conn
private

Definition at line 54 of file Forwarder.h.

Referenced by Forwarder().

◆ entry

StoreEntry* Mgr::Forwarder::entry
private

Definition at line 53 of file Forwarder.h.

Referenced by Forwarder().

◆ httpRequest

HttpRequest* Mgr::Forwarder::httpRequest
private

Definition at line 52 of file Forwarder.h.

Referenced by Forwarder().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
inherited

Definition at line 75 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ LastRequestId

Ipc::RequestId::Index Ipc::Forwarder::LastRequestId = 0
staticprotectedinherited

Definition at line 72 of file Forwarder.h.

◆ request

Request::Pointer Ipc::Forwarder::request
protectedinherited

Definition at line 65 of file Forwarder.h.

◆ started_

bool AsyncJob::started_ = false
protectedinherited

Definition at line 88 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ swanSang_

bool AsyncJob::swanSang_ = false
protectedinherited

Definition at line 89 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().

◆ TheRequestsMap

Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap
staticprotectedinherited

Definition at line 70 of file Forwarder.h.

◆ timeout

const double Ipc::Forwarder::timeout
protectedinherited

Definition at line 66 of file Forwarder.h.

◆ typeName


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