xrootd
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
XrdCl::PostMaster Class Reference

A hub for dispatching and receiving messages. More...

#include <XrdClPostMaster.hh>

Collaboration diagram for XrdCl::PostMaster:
Collaboration graph
[legend]

Public Member Functions

 PostMaster ()
 Constructor. More...
 
virtual ~PostMaster ()
 Destructor. More...
 
bool Initialize ()
 Initializer. More...
 
bool Finalize ()
 Finalizer. More...
 
bool Start ()
 Start the post master. More...
 
bool Stop ()
 Stop the postmaster. More...
 
bool Reinitialize ()
 Reinitialize after fork. More...
 
Status Send (const URL &url, Message *msg, bool stateful, time_t expires)
 
Status Send (const URL &url, Message *msg, OutgoingMsgHandler *handler, bool stateful, time_t expires)
 
Status Receive (const URL &url, Message *&msg, MessageFilter *filter, time_t expires)
 
Status Receive (const URL &url, IncomingMsgHandler *handler, time_t expires)
 
Status QueryTransport (const URL &url, uint16_t query, AnyObject &result)
 
Status RegisterEventHandler (const URL &url, ChannelEventHandler *handler)
 Register channel event handler. More...
 
Status RemoveEventHandler (const URL &url, ChannelEventHandler *handler)
 Remove a channel event handler. More...
 
TaskManagerGetTaskManager ()
 Get the task manager object user by the post master. More...
 
JobManagerGetJobManager ()
 Get the job manager object user by the post master. More...
 

Private Types

typedef std::map< std::string,
Channel * > 
ChannelMap
 

Private Member Functions

ChannelGetChannel (const URL &url)
 

Private Attributes

PollerpPoller
 
TaskManagerpTaskManager
 
ChannelMap pChannelMap
 
XrdSysMutex pChannelMapMutex
 
bool pInitialized
 
JobManagerpJobManager
 

Detailed Description

A hub for dispatching and receiving messages.

Member Typedef Documentation

typedef std::map<std::string, Channel*> XrdCl::PostMaster::ChannelMap
private

Constructor & Destructor Documentation

XrdCl::PostMaster::PostMaster ( )
XrdCl::PostMaster::~PostMaster ( )
virtual

Destructor.

References pJobManager, pPoller, and pTaskManager.

Member Function Documentation

bool XrdCl::PostMaster::Finalize ( )
Channel * XrdCl::PostMaster::GetChannel ( const URL url)
private
JobManager* XrdCl::PostMaster::GetJobManager ( )
inline

Get the job manager object user by the post master.

References pJobManager.

Referenced by XrdCl::FileStateHandler::TimeOutRequests().

TaskManager* XrdCl::PostMaster::GetTaskManager ( )
inline

Get the task manager object user by the post master.

References pTaskManager.

Referenced by XrdCl::ForkHandler::Child(), XrdCl::DefaultEnv::GetPostMaster(), and XrdCl::XRootDMsgHandler::Process().

bool XrdCl::PostMaster::Initialize ( )
Status XrdCl::PostMaster::QueryTransport ( const URL url,
uint16_t  query,
AnyObject result 
)

Query the transport handler for a given URL

Parameters
urlthe channel to be queried
querythe query as defined in the TransportQuery struct or others that may be recognized by the protocol transport
resultthe result of the query
Returns
status of the query

References XrdCl::errNotSupported, XrdCl::errUninitialized, GetChannel(), pInitialized, XrdCl::Channel::QueryTransport(), XrdCl::stError, and XrdCl::stFatal.

Referenced by XrdCl::XRootDMsgHandler::Process(), XrdCl::XRootDMsgHandler::RewriteRequestRedirect(), and XrdCl::MessageUtils::SendMessage().

Status XrdCl::PostMaster::Receive ( const URL url,
Message *&  msg,
MessageFilter filter,
time_t  expires 
)

Synchronously receive a message - blocks until a message matching a filter is found in the incoming queue or the timeout passes

Parameters
urlsender of the message
msgreference to a message pointer, the pointer will point to the received message
filterfilter object defining what to look for
expiresexpiration timestamp
Returns
success when the message has been received successfully, failure otherwise

References XrdCl::errNotSupported, XrdCl::errUninitialized, GetChannel(), pInitialized, XrdCl::Channel::Receive(), XrdCl::stError, and XrdCl::stFatal.

Referenced by XrdCl::XRootDMsgHandler::OnStatusReady().

Status XrdCl::PostMaster::Receive ( const URL url,
IncomingMsgHandler handler,
time_t  expires 
)

Listen to incoming messages, the listener is notified when a new message arrives and when the timeout passes

Parameters
urlsender of the message
handlerhandler to be notified about new messages
expiresexpiration timestamp
Returns
success when the listener has been inserted correctly

References XrdCl::errNotSupported, XrdCl::errUninitialized, GetChannel(), pInitialized, XrdCl::Channel::Receive(), XrdCl::stError, and XrdCl::stFatal.

Status XrdCl::PostMaster::RegisterEventHandler ( const URL url,
ChannelEventHandler handler 
)
bool XrdCl::PostMaster::Reinitialize ( )

Reinitialize after fork.

Status XrdCl::PostMaster::RemoveEventHandler ( const URL url,
ChannelEventHandler handler 
)
Status XrdCl::PostMaster::Send ( const URL url,
Message msg,
bool  stateful,
time_t  expires 
)

Send a message synchronously - synchronously means that it will block until the message is written to a socket

DEADLOCK WARNING: no lock should be taken while calling this method that are used in the callback as well.

Parameters
urlrecipient of the message
msgmessage to be sent
statfulphysical stream disconnection causes an error
expiresunix timestamp after which a failure should be reported if sending was unsuccessful
Returns
success if the message has been pushed through the wire, failure otherwise

References XrdCl::errNotSupported, XrdCl::errUninitialized, GetChannel(), pInitialized, XrdCl::Channel::Send(), XrdCl::stError, and XrdCl::stFatal.

Referenced by XrdCl::XRootDMsgHandler::RetryAtServer(), and XrdCl::MessageUtils::SendMessage().

Status XrdCl::PostMaster::Send ( const URL url,
Message msg,
OutgoingMsgHandler handler,
bool  stateful,
time_t  expires 
)

Send the message asynchronously - the message is inserted into the send queue and a listener is called when the message is succesfsully pushed through the wire or when the timeout elapses

DEADLOCK WARNING: no lock should be taken while calling this method that are used in the callback as well.

Parameters
urlrecipient of the message
msgmessage to be sent
expiresunix timestamp after which a failure is reported to the handler
handlerhandler will be notified about the status
statefulphysical stream disconnection causes an error
Returns
success if the message was successfully inserted into the send queues, failure otherwise

References XrdCl::errNotSupported, XrdCl::errUninitialized, GetChannel(), pInitialized, XrdCl::Channel::Send(), XrdCl::stError, and XrdCl::stFatal.

bool XrdCl::PostMaster::Start ( )
bool XrdCl::PostMaster::Stop ( )

Member Data Documentation

ChannelMap XrdCl::PostMaster::pChannelMap
private

Referenced by Finalize(), and GetChannel().

XrdSysMutex XrdCl::PostMaster::pChannelMapMutex
private

Referenced by GetChannel().

bool XrdCl::PostMaster::pInitialized
private
JobManager* XrdCl::PostMaster::pJobManager
private
Poller* XrdCl::PostMaster::pPoller
private
TaskManager* XrdCl::PostMaster::pTaskManager
private

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