Coordinates shared activities of Strands (Squid processes or threads) More...

#include <Coordinator.h>

Inheritance diagram for Ipc::Coordinator:
Collaboration diagram for Ipc::Coordinator:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Coordinator ()
 
void broadcastSignal (int sig) const
 send sig to registered strands More...
 
const StrandCoordsstrands () const
 currently registered strands More...
 
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 CoordinatorInstance ()
 
static String MakeAddr (const char *proccessLabel, int id)
 calculates IPC message address for strand id of processLabel type More...
 
static String CoordinatorAddr ()
 get the IPC message address for coordinator process More...
 
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Public Attributes

struct sockaddr_un address
 UDS address from path; treat as read-only. More...
 

Protected Member Functions

virtual void start ()
 called by AsyncStart; do not call directly More...
 
virtual void receive (const TypedMsgHdr &message)
 handle IPC message just read More...
 
StrandCoordfindStrand (int kidId)
 registered strand or NULL More...
 
void registerStrand (const StrandCoord &)
 adds or updates existing More...
 
void handleRegistrationRequest (const HereIamMessage &)
 register,ACK More...
 
void notifySearcher (const StrandSearchRequest &request, const StrandCoord &)
 answer the waiting search request More...
 
void handleSearchRequest (const StrandSearchRequest &request)
 answers or queues the request if the answer is not yet known More...
 
void handleSharedListenRequest (const SharedListenRequest &request)
 returns cached socket or calls openListenSocket() More...
 
void handleCacheMgrRequest (const Mgr::Request &request)
 
void handleCacheMgrResponse (const Mgr::Response &response)
 
void handleSnmpRequest (const Snmp::Request &request)
 
void handleSnmpResponse (const Snmp::Response &response)
 
Comm::ConnectionPointer openListenSocket (const SharedListenRequest &request, int &errNo)
 calls comm_open_listener() More...
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
void doListen ()
 read the next incoming message More...
 
virtual void timedout ()
 called after setTimeout() if timed out More...
 
Comm::ConnectionPointerconn ()
 creates if needed and returns raw UDS socket descriptor More...
 
void setTimeout (int seconds, const char *handlerName)
 call timedout() if no UDS messages in a given number of seconds More...
 
void clearTimeout ()
 remove previously set timeout, if any More...
 
void setOptions (int newOptions)
 changes socket options More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
virtual void swanSong ()
 
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 Types

typedef std::list
< StrandSearchRequest
Searchers
 search requests More...
 
typedef std::map
< OpenListenerParams,
Comm::ConnectionPointer
Listeners
 params:connection map More...
 

Private Member Functions

 CBDATA_CLASS (Coordinator)
 
 Coordinator (const Coordinator &)
 
Coordinatoroperator= (const Coordinator &)
 

Private Attributes

StrandCoords strands_
 registered processes and threads More...
 
Searchers searchers
 yet unanswered search requests in arrival order More...
 
Listeners listeners
 cached comm_open_listener() results More...
 

Static Private Attributes

static CoordinatorTheInstance = NULL
 the only class instance in existence More...
 

Detailed Description

Definition at line 30 of file Coordinator.h.

Member Typedef Documentation

Definition at line 74 of file Coordinator.h.

Definition at line 34 of file AsyncJob.h.

Definition at line 71 of file Coordinator.h.

Constructor & Destructor Documentation

Ipc::Coordinator::Coordinator ( )

Definition at line 34 of file Coordinator.cc.

Ipc::Coordinator::Coordinator ( const Coordinator )
private

Member Function Documentation

void Ipc::Coordinator::broadcastSignal ( int  sig) const

Definition at line 281 of file Coordinator.cc.

References debugs, and HERE().

void AsyncJob::callEnd ( )
virtualinherited
void AsyncJob::callStart ( AsyncCall call)
inherited
bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

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

Ipc::Coordinator::CBDATA_CLASS ( Coordinator  )
private
void Ipc::UdsOp::clearTimeout ( )
protectedinherited

Definition at line 62 of file UdsOp.cc.

References commUnsetConnTimeout(), and conn.

Comm::ConnectionPointer & Ipc::UdsOp::conn ( )
protectedinherited

Definition at line 41 of file UdsOp.cc.

References COMM_DOBIND, comm_open_uds(), Comm::Connection::fd, Comm::IsConnOpen(), Must, and NULL.

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited
void Ipc::Port::doListen ( )
protectedinherited

Definition at line 36 of file Port.cc.

References buf, comm_read(), conn, debugs, HERE(), JobCallback, and Ipc::Port::noteRead().

bool AsyncJob::done ( ) const
protectedinherited

Definition at line 90 of file AsyncJob.cc.

References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.

Referenced by AsyncJob::callEnd(), and Downloader::downloadFinished().

bool Ipc::Port::doneAll ( ) const
protectedvirtualinherited

Reimplemented from AsyncJob.

Definition at line 46 of file Port.cc.

Ipc::StrandCoord * Ipc::Coordinator::findStrand ( int  kidId)
protected

Definition at line 44 of file Coordinator.cc.

References NULL.

void Ipc::Coordinator::handleCacheMgrResponse ( const Mgr::Response response)
protected

Definition at line 193 of file Coordinator.cc.

References Ipc::Inquirer::HandleRemoteAck().

void Ipc::Coordinator::handleRegistrationRequest ( const HereIamMessage msg)
protected
void Ipc::Coordinator::handleSearchRequest ( const StrandSearchRequest request)
protected
void Ipc::Coordinator::handleSnmpRequest ( const Snmp::Request request)
protected
void Ipc::Coordinator::handleSnmpResponse ( const Snmp::Response response)
protected

Definition at line 246 of file Coordinator.cc.

References debugs, Ipc::Inquirer::HandleRemoteAck(), and HERE().

Ipc::Coordinator * Ipc::Coordinator::Instance ( )
static

Definition at line 291 of file Coordinator.cc.

Referenced by SquidMain().

String Ipc::Port::MakeAddr ( const char *  proccessLabel,
int  id 
)
staticinherited
void Ipc::Coordinator::notifySearcher ( const StrandSearchRequest request,
const StrandCoord strand 
)
protected
Coordinator& Ipc::Coordinator::operator= ( const Coordinator )
private
void Ipc::Coordinator::registerStrand ( const StrandCoord strand)
protected

Definition at line 54 of file Coordinator.cc.

References debugs, HERE(), i, Ipc::StrandCoord::kidId, String::size(), and Ipc::StrandCoord::tag.

void Ipc::UdsOp::setOptions ( int  newOptions)
protectedinherited

Definition at line 35 of file UdsOp.cc.

Referenced by Ipc::Port::Port().

void Ipc::UdsOp::setTimeout ( int  seconds,
const char *  handlerName 
)
protectedinherited

Definition at line 54 of file UdsOp.cc.

References asyncCall(), commSetConnTimeout(), conn, handler(), and Ipc::UdsOp::noteTimeout().

void Ipc::Coordinator::start ( )
protectedvirtual

Implements Ipc::Port.

Definition at line 39 of file Coordinator.cc.

References Ipc::Port::start().

const Ipc::StrandCoords & Ipc::Coordinator::strands ( ) const

Definition at line 302 of file Coordinator.cc.

virtual void Ipc::UdsOp::timedout ( )
inlineprotectedvirtualinherited

Reimplemented in Ipc::UdsSender, and Ipc::Strand.

Definition at line 39 of file UdsOp.h.

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

struct sockaddr_un Ipc::UdsOp::address
inherited

Definition at line 36 of file UdsOp.h.

Referenced by Ipc::UdsSender::UdsSender().

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 70 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
protectedinherited
Listeners Ipc::Coordinator::listeners
private

Definition at line 75 of file Coordinator.h.

Searchers Ipc::Coordinator::searchers
private

Definition at line 72 of file Coordinator.h.

const char* AsyncJob::stopReason
protectedinherited
StrandCoords Ipc::Coordinator::strands_
private

Definition at line 69 of file Coordinator.h.

Ipc::Coordinator * Ipc::Coordinator::TheInstance = NULL
staticprivate

Definition at line 77 of file Coordinator.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors