Loading...
Searching...
No Matches
XrdClPostMaster.hh
Go to the documentation of this file.
//------------------------------------------------------------------------------
// Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
// Author: Lukasz Janyst <ljanyst@cern.ch>
//------------------------------------------------------------------------------
// XRootD is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// XRootD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#ifndef __XRD_CL_POST_MASTER_HH__
#define __XRD_CL_POST_MASTER_HH__
#include <cstdint>
#include <map>
#include <vector>
#include <functional>
#include <memory>
#include "XrdCl/XrdClStatus.hh"
#include "XrdCl/XrdClURL.hh"
#include "XrdCl/XrdClPostMasterInterfaces.hh"
#include "XrdSys/XrdSysPthread.hh"
namespace XrdCl
{
class Poller;
class TaskManager;
class Channel;
class JobManager;
class Job;
struct PostMasterImpl;
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
class PostMaster
{
public:
//------------------------------------------------------------------------
//------------------------------------------------------------------------
PostMaster();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
virtual ~PostMaster();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
bool Initialize();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
bool Finalize();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
bool Start();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
bool Stop();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
bool Reinitialize();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
XRootDStatus Send( const URL &url,
Message *msg,
MsgHandler *handler,
bool stateful,
time_t expires );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status Redirect( const URL &url,
Message *msg,
MsgHandler *handler);
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status QueryTransport( const URL &url,
uint16_t query,
AnyObject &result );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status RegisterEventHandler( const URL &url,
ChannelEventHandler *handler );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status RemoveEventHandler( const URL &url,
ChannelEventHandler *handler );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
TaskManager *GetTaskManager();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
JobManager *GetJobManager();
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status ForceDisconnect( const URL &url );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status ForceDisconnect( const URL &url, bool hush );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Status ForceReconnect( const URL &url );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
uint16_t NbConnectedStrm( const URL &url );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void SetOnDataConnectHandler( const URL &url,
std::shared_ptr<Job> onConnJob );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void SetOnConnectHandler( std::unique_ptr<Job> onConnJob );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void SetConnectionErrorHandler( std::function<void( const URL&, const XRootDStatus& )> handler );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void NotifyConnectHandler( const URL &url );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void NotifyConnErrHandler( const URL &url, const XRootDStatus &status );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void CollapseRedirect( const URL &oldurl, const URL &newURL );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
void DecFileInstCnt( const URL &url );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
bool IsRunning();
private:
Channel *GetChannel( const URL &url );
std::unique_ptr<PostMasterImpl> pImpl;
};
}
#endif // __XRD_CL_POST_MASTER_HH__
XrdClPostMasterInterfaces.hh
XrdClStatus.hh
XrdClURL.hh
XrdSysPthread.hh
XrdCl::AnyObject
Definition XrdClAnyObject.hh:33
XrdCl::ChannelEventHandler
Channel event handler.
Definition XrdClPostMasterInterfaces.hh:210
XrdCl::Channel
A communication channel between the client and the server.
Definition XrdClChannel.hh:49
XrdCl::JobManager
A synchronized queue.
Definition XrdClJobManager.hh:51
XrdCl::Job
Interface for a job to be run by the job manager.
Definition XrdClJobManager.hh:34
XrdCl::Message
The message representation used throughout the system.
Definition XrdClMessage.hh:32
XrdCl::MsgHandler
Message handler.
Definition XrdClPostMasterInterfaces.hh:51
XrdCl::Poller
Interface for socket pollers.
Definition XrdClPoller.hh:87
XrdCl::PostMaster::SetOnDataConnectHandler
void SetOnDataConnectHandler(const URL &url, std::shared_ptr< Job > onConnJob)
Set the on-connect handler for data streams.
Definition XrdClPostMaster.cc:391
XrdCl::PostMaster::CollapseRedirect
void CollapseRedirect(const URL &oldurl, const URL &newURL)
Collapse channel URL - replace the URL of the channel.
Definition XrdClPostMaster.cc:447
XrdCl::PostMaster::Start
bool Start()
Start the post master.
Definition XrdClPostMaster.cc:169
XrdCl::PostMaster::IsRunning
bool IsRunning()
Definition XrdClPostMaster.cc:514
XrdCl::PostMaster::Finalize
bool Finalize()
Finalizer.
Definition XrdClPostMaster.cc:147
XrdCl::PostMaster::Send
XRootDStatus Send(const URL &url, Message *msg, MsgHandler *handler, bool stateful, time_t expires)
Definition XrdClPostMaster.cc:223
XrdCl::PostMaster::ForceReconnect
Status ForceReconnect(const URL &url)
Reconnect the channel.
Definition XrdClPostMaster.cc:364
XrdCl::PostMaster::Stop
bool Stop()
Stop the postmaster.
Definition XrdClPostMaster.cc:197
XrdCl::PostMaster::Reinitialize
bool Reinitialize()
Reinitialize after fork.
Definition XrdClPostMaster.cc:215
XrdCl::PostMaster::GetTaskManager
TaskManager * GetTaskManager()
Get the task manager object user by the post master.
Definition XrdClPostMaster.cc:308
XrdCl::PostMaster::NbConnectedStrm
uint16_t NbConnectedStrm(const URL &url)
Get the number of connected data streams.
Definition XrdClPostMaster.cc:380
XrdCl::PostMaster::SetOnConnectHandler
void SetOnConnectHandler(std::unique_ptr< Job > onConnJob)
Set the global connection error handler.
Definition XrdClPostMaster.cc:403
XrdCl::PostMaster::RemoveEventHandler
Status RemoveEventHandler(const URL &url, ChannelEventHandler *handler)
Remove a channel event handler.
Definition XrdClPostMaster.cc:292
XrdCl::PostMaster::~PostMaster
virtual ~PostMaster()
Destructor.
Definition XrdClPostMaster.cc:113
XrdCl::PostMaster::PostMaster
PostMaster()
Constructor.
Definition XrdClPostMaster.cc:106
XrdCl::PostMaster::SetConnectionErrorHandler
void SetConnectionErrorHandler(std::function< void(const URL &, const XRootDStatus &)> handler)
Set the global on-error on-connect handler for control streams.
Definition XrdClPostMaster.cc:412
XrdCl::PostMaster::ForceDisconnect
Status ForceDisconnect(const URL &url)
Shut down a channel.
Definition XrdClPostMaster.cc:324
XrdCl::PostMaster::Redirect
Status Redirect(const URL &url, Message *msg, MsgHandler *handler)
Definition XrdClPostMaster.cc:238
XrdCl::PostMaster::NotifyConnErrHandler
void NotifyConnErrHandler(const URL &url, const XRootDStatus &status)
Notify the global error connection handler.
Definition XrdClPostMaster.cc:434
XrdCl::PostMaster::QueryTransport
Status QueryTransport(const URL &url, uint16_t query, AnyObject &result)
Definition XrdClPostMaster.cc:252
XrdCl::PostMaster::RegisterEventHandler
Status RegisterEventHandler(const URL &url, ChannelEventHandler *handler)
Register channel event handler.
Definition XrdClPostMaster.cc:276
XrdCl::PostMaster::NotifyConnectHandler
void NotifyConnectHandler(const URL &url)
Notify the global on-connect handler.
Definition XrdClPostMaster.cc:421
XrdCl::PostMaster::GetJobManager
JobManager * GetJobManager()
Get the job manager object user by the post master.
Definition XrdClPostMaster.cc:316
XrdCl::PostMaster::Initialize
bool Initialize()
Initializer.
Definition XrdClPostMaster.cc:120
XrdCl::PostMaster::DecFileInstCnt
void DecFileInstCnt(const URL &url)
Decrement file object instance count bound to this channel.
Definition XrdClPostMaster.cc:501
XrdCl::TaskManager
Definition XrdClTaskManager.hh:76
XrdCl::URL
URL representation.
Definition XrdClURL.hh:31
XrdCl::XRootDStatus
Request status.
Definition XrdClXRootDResponses.hh:219
XrdCl
Definition XrdClAction.hh:34
XrdCl::PostMasterImpl
Definition XrdClPostMaster.cc:59
XrdCl::Status
Procedure execution status.
Definition XrdClStatus.hh:115