xrootd
XrdClPostMaster.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3// Author: Lukasz Janyst <ljanyst@cern.ch>
4//------------------------------------------------------------------------------
5// XRootD is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// XRootD is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17//------------------------------------------------------------------------------
18
19#ifndef __XRD_CL_POST_MASTER_HH__
20#define __XRD_CL_POST_MASTER_HH__
21
22#include <cstdint>
23#include <map>
24#include <vector>
25#include <functional>
26#include <memory>
27
28#include "XrdCl/XrdClStatus.hh"
29#include "XrdCl/XrdClURL.hh"
31
33
34namespace XrdCl
35{
36 class Poller;
37 class TaskManager;
38 class Channel;
39 class JobManager;
40 class Job;
41
42 struct PostMasterImpl;
43
44 //----------------------------------------------------------------------------
46 //----------------------------------------------------------------------------
48 {
49 public:
50 //------------------------------------------------------------------------
52 //------------------------------------------------------------------------
54
55 //------------------------------------------------------------------------
57 //------------------------------------------------------------------------
58 virtual ~PostMaster();
59
60 //------------------------------------------------------------------------
62 //------------------------------------------------------------------------
63 bool Initialize();
64
65 //------------------------------------------------------------------------
67 //------------------------------------------------------------------------
68 bool Finalize();
69
70 //------------------------------------------------------------------------
72 //------------------------------------------------------------------------
73 bool Start();
74
75 //------------------------------------------------------------------------
77 //------------------------------------------------------------------------
78 bool Stop();
79
80 //------------------------------------------------------------------------
82 //------------------------------------------------------------------------
84
85 //------------------------------------------------------------------------
101 //------------------------------------------------------------------------
102 XRootDStatus Send( const URL &url,
103 Message *msg,
104 MsgHandler *handler,
105 bool stateful,
106 time_t expires );
107
108 //------------------------------------------------------------------------
110 //------------------------------------------------------------------------
111 Status Redirect( const URL &url,
112 Message *msg,
113 MsgHandler *handler);
114
115 //------------------------------------------------------------------------
123 //------------------------------------------------------------------------
125 uint16_t query,
126 AnyObject &result );
127
128 //------------------------------------------------------------------------
130 //------------------------------------------------------------------------
132 ChannelEventHandler *handler );
133
134 //------------------------------------------------------------------------
136 //------------------------------------------------------------------------
138 ChannelEventHandler *handler );
139
140 //------------------------------------------------------------------------
142 //------------------------------------------------------------------------
144
145 //------------------------------------------------------------------------
147 //------------------------------------------------------------------------
149
150 //------------------------------------------------------------------------
152 //------------------------------------------------------------------------
154
155 //------------------------------------------------------------------------
157 //------------------------------------------------------------------------
158 uint16_t NbConnectedStrm( const URL &url );
159
160 //------------------------------------------------------------------------
162 //------------------------------------------------------------------------
163 void SetOnDataConnectHandler( const URL &url,
164 std::shared_ptr<Job> onConnJob );
165
166 //------------------------------------------------------------------------
168 //------------------------------------------------------------------------
169 void SetOnConnectHandler( std::unique_ptr<Job> onConnJob );
170
171 //------------------------------------------------------------------------
173 //------------------------------------------------------------------------
174 void SetConnectionErrorHandler( std::function<void( const URL&, const XRootDStatus& )> handler );
175
176 //------------------------------------------------------------------------
178 //------------------------------------------------------------------------
179 void NotifyConnectHandler( const URL &url );
180
181 //------------------------------------------------------------------------
183 //------------------------------------------------------------------------
184 void NotifyConnErrHandler( const URL &url, const XRootDStatus &status );
185
186 //------------------------------------------------------------------------
188 //------------------------------------------------------------------------
189 void CollapseRedirect( const URL &oldurl, const URL &newURL );
190
191 //------------------------------------------------------------------------
193 //------------------------------------------------------------------------
194 void DecFileInstCnt( const URL &url );
195
196 //------------------------------------------------------------------------
198 //------------------------------------------------------------------------
199 bool IsRunning();
200
201 private:
202 Channel *GetChannel( const URL &url );
203
204 std::unique_ptr<PostMasterImpl> pImpl;
205 };
206}
207
208#endif // __XRD_CL_POST_MASTER_HH__
Definition: XrdClAnyObject.hh:33
Channel event handler.
Definition: XrdClPostMasterInterfaces.hh:210
A communication channel between the client and the server.
Definition: XrdClChannel.hh:49
A synchronized queue.
Definition: XrdClJobManager.hh:51
The message representation used throughout the system.
Definition: XrdClMessage.hh:30
Message handler.
Definition: XrdClPostMasterInterfaces.hh:51
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:48
std::unique_ptr< PostMasterImpl > pImpl
Definition: XrdClPostMaster.hh:204
void SetOnDataConnectHandler(const URL &url, std::shared_ptr< Job > onConnJob)
Set the on-connect handler for data streams.
void CollapseRedirect(const URL &oldurl, const URL &newURL)
Collapse channel URL - replace the URL of the channel.
bool Start()
Start the post master.
bool Finalize()
Finalizer.
XRootDStatus Send(const URL &url, Message *msg, MsgHandler *handler, bool stateful, time_t expires)
bool Stop()
Stop the postmaster.
bool Reinitialize()
Reinitialize after fork.
TaskManager * GetTaskManager()
Get the task manager object user by the post master.
virtual ~PostMaster()
Destructor.
uint16_t NbConnectedStrm(const URL &url)
Get the number of connected data streams.
void SetOnConnectHandler(std::unique_ptr< Job > onConnJob)
Set the global connection error handler.
Status RemoveEventHandler(const URL &url, ChannelEventHandler *handler)
Remove a channel event handler.
PostMaster()
Constructor.
void SetConnectionErrorHandler(std::function< void(const URL &, const XRootDStatus &)> handler)
Set the global on-error on-connect handler for control streams.
Status ForceDisconnect(const URL &url)
Shut down a channel.
Status Redirect(const URL &url, Message *msg, MsgHandler *handler)
void NotifyConnErrHandler(const URL &url, const XRootDStatus &status)
Notify the global error connection handler.
Status QueryTransport(const URL &url, uint16_t query, AnyObject &result)
Status RegisterEventHandler(const URL &url, ChannelEventHandler *handler)
Register channel event handler.
void NotifyConnectHandler(const URL &url)
Notify the global on-connect handler.
Channel * GetChannel(const URL &url)
JobManager * GetJobManager()
Get the job manager object user by the post master.
bool Initialize()
Initializer.
void DecFileInstCnt(const URL &url)
Decrement file object instance count bound to this channel.
Definition: XrdClTaskManager.hh:76
URL representation.
Definition: XrdClURL.hh:31
Request status.
Definition: XrdClXRootDResponses.hh:219
Definition: XrdClAction.hh:34
Procedure execution status.
Definition: XrdClStatus.hh:114