Maintains an fixed-size "standby" PconnPool for a single CachePeer. More...

#include <PeerPoolMgr.h>

Inheritance diagram for PeerPoolMgr:
Collaboration diagram for PeerPoolMgr:

Public Types

typedef CbcPointer< PeerPoolMgrPointer
 

Public Member Functions

 PeerPoolMgr (CachePeer *aPeer)
 
 ~PeerPoolMgr () override
 
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 Checkpoint (const Pointer &mgr, const char *reason)
 
static void Start (const Pointer &job)
 
static void RegisterWithCacheManager ()
 

Public Attributes

const InstanceId< AsyncJobid
 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...
 
bool validPeer () const
 whether the peer is still out there and in a valid state we can safely use More...
 
void checkpoint (const char *reason)
 
void openNewConnection ()
 starts the process of opening a new standby connection (if possible) More...
 
void closeOldConnections (const int howMany)
 closes 'howMany' standby connections More...
 
void handleOpenedConnection (const CommConnectCbParams &params)
 Comm::ConnOpener calls this when done opening a connection for us. More...
 
void handleSecuredPeer (Security::EncryptorAnswer &answer)
 Security::PeerConnector callback. More...
 
void pushNewConnection (const Comm::ConnectionPointer &conn)
 the final step in connection opening (and, optionally, securing) sequence 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 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 (PeerPoolMgr)
 
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More...
 

Private Attributes

CachePeerpeer
 the owner of the pool we manage More...
 
RefCount< HttpRequestrequest
 fake HTTP request for conn opening code More...
 
JobWait< Comm::ConnOpenertransportWait
 waits for a transport connection to the peer to be established/opened More...
 
JobWait< Security::BlindPeerConnectorencryptionWait
 waits for the established transport connection to be secured/encrypted More...
 
unsigned int addrUsed
 counter for cycling through peer addresses More...
 

Detailed Description

Definition at line 22 of file PeerPoolMgr.h.

Member Typedef Documentation

◆ Pointer

Definition at line 27 of file PeerPoolMgr.h.

Constructor & Destructor Documentation

◆ PeerPoolMgr()

PeerPoolMgr::PeerPoolMgr ( CachePeer aPeer)
explicit

Definition at line 31 of file PeerPoolMgr.cc.

◆ ~PeerPoolMgr()

PeerPoolMgr::~PeerPoolMgr ( )
override

Definition at line 40 of file PeerPoolMgr.cc.

References cbdataReferenceDone, and peer.

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 117 of file AsyncJob.cc.

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

◆ CBDATA_CHILD()

PeerPoolMgr::CBDATA_CHILD ( PeerPoolMgr  )
private

◆ checkpoint()

void PeerPoolMgr::checkpoint ( const char *  reason)
protected

Starts new connection, or closes the excess connections according pool configuration

Definition at line 211 of file PeerPoolMgr.cc.

References closeOldConnections(), PconnPool::count(), debugs, CachePeer::limit, openNewConnection(), peer, CachePeer::pool, CachePeer::standby, and validPeer().

Referenced by Checkpoint(), handleOpenedConnection(), handleSecuredPeer(), and start().

◆ Checkpoint()

void PeerPoolMgr::Checkpoint ( const Pointer mgr,
const char *  reason 
)
static

◆ closeOldConnections()

void PeerPoolMgr::closeOldConnections ( const int  howMany)
protected

Definition at line 204 of file PeerPoolMgr.cc.

References PconnPool::closeN(), debugs, peer, CachePeer::pool, and CachePeer::standby.

Referenced by checkpoint().

◆ deleteThis()

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

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool PeerPoolMgr::doneAll ( ) const
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 72 of file PeerPoolMgr.cc.

References AsyncJob::doneAll(), CachePeer::limit, peer, CachePeer::standby, and validPeer().

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ handleOpenedConnection()

◆ handleSecuredPeer()

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )
inlineinherited

Definition at line 73 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ mustStop()

◆ openNewConnection()

◆ pushNewConnection()

void PeerPoolMgr::pushNewConnection ( const Comm::ConnectionPointer conn)
protected

◆ RegisterWithCacheManager()

void AsyncJob::RegisterWithCacheManager ( )
staticinherited

Definition at line 215 of file AsyncJob.cc.

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

Referenced by mainInitialize().

◆ ReportAllJobs()

void AsyncJob::ReportAllJobs ( StoreEntry e)
staticprotectedinherited

Definition at line 198 of file AsyncJob.cc.

References AllJobs().

Referenced by AsyncJob::RegisterWithCacheManager().

◆ start()

void PeerPoolMgr::start ( )
overrideprotectedvirtual

◆ Start()

◆ status()

◆ swanSong()

void PeerPoolMgr::swanSong ( )
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 60 of file PeerPoolMgr.cc.

References AsyncJob::swanSong().

◆ toCbdata()

virtual void * CbdataParent::toCbdata ( )
pure virtualinherited

◆ validPeer()

bool PeerPoolMgr::validPeer ( ) const
protected

Member Data Documentation

◆ addrUsed

unsigned int PeerPoolMgr::addrUsed
private

Definition at line 71 of file PeerPoolMgr.h.

Referenced by openNewConnection().

◆ encryptionWait

JobWait<Security::BlindPeerConnector> PeerPoolMgr::encryptionWait
private

Definition at line 69 of file PeerPoolMgr.h.

Referenced by handleOpenedConnection(), handleSecuredPeer(), and openNewConnection().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
inherited

Definition at line 75 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ peer

◆ request

RefCount<HttpRequest> PeerPoolMgr::request
private

Definition at line 63 of file PeerPoolMgr.h.

Referenced by handleOpenedConnection(), openNewConnection(), and start().

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

◆ transportWait

JobWait<Comm::ConnOpener> PeerPoolMgr::transportWait
private

Definition at line 66 of file PeerPoolMgr.h.

Referenced by handleOpenedConnection(), and openNewConnection().

◆ typeName


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors