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 <stdint.h>
23#include <map>
24#include <vector>
25#include <functional>
26
27#include "XrdCl/XrdClStatus.hh"
28#include "XrdCl/XrdClURL.hh"
30
32
33namespace XrdCl
34{
35 class Poller;
36 class TaskManager;
37 class Channel;
38 class JobManager;
39 class Job;
40
41 //----------------------------------------------------------------------------
43 //----------------------------------------------------------------------------
45 {
46 public:
47 //------------------------------------------------------------------------
49 //------------------------------------------------------------------------
51
52 //------------------------------------------------------------------------
54 //------------------------------------------------------------------------
55 virtual ~PostMaster();
56
57 //------------------------------------------------------------------------
59 //------------------------------------------------------------------------
60 bool Initialize();
61
62 //------------------------------------------------------------------------
64 //------------------------------------------------------------------------
65 bool Finalize();
66
67 //------------------------------------------------------------------------
69 //------------------------------------------------------------------------
70 bool Start();
71
72 //------------------------------------------------------------------------
74 //------------------------------------------------------------------------
75 bool Stop();
76
77 //------------------------------------------------------------------------
79 //------------------------------------------------------------------------
81
82 //------------------------------------------------------------------------
96 //------------------------------------------------------------------------
97 Status Send( const URL &url,
98 Message *msg,
99 bool stateful,
100 time_t expires );
101
102 //------------------------------------------------------------------------
118 //------------------------------------------------------------------------
119 Status Send( const URL &url,
120 Message *msg,
121 OutgoingMsgHandler *handler,
122 bool stateful,
123 time_t expires );
124
125 //------------------------------------------------------------------------
127 //------------------------------------------------------------------------
128 Status Redirect( const URL &url,
129 Message *msg,
130 IncomingMsgHandler *handler);
131
132 //------------------------------------------------------------------------
143 //------------------------------------------------------------------------
144 Status Receive( const URL &url,
145 Message *&msg,
146 MessageFilter *filter,
147 time_t expires );
148
149 //------------------------------------------------------------------------
157 //------------------------------------------------------------------------
158 Status Receive( const URL &url,
159 IncomingMsgHandler *handler,
160 time_t expires );
161
162 //------------------------------------------------------------------------
170 //------------------------------------------------------------------------
172 uint16_t query,
173 AnyObject &result );
174
175 //------------------------------------------------------------------------
177 //------------------------------------------------------------------------
179 ChannelEventHandler *handler );
180
181 //------------------------------------------------------------------------
183 //------------------------------------------------------------------------
185 ChannelEventHandler *handler );
186
187 //------------------------------------------------------------------------
189 //------------------------------------------------------------------------
191 {
192 return pTaskManager;
193 }
194
195 //------------------------------------------------------------------------
197 //------------------------------------------------------------------------
199 {
200 return pJobManager;
201 }
202
203 //------------------------------------------------------------------------
205 //------------------------------------------------------------------------
207
208 //------------------------------------------------------------------------
210 //------------------------------------------------------------------------
211 uint16_t NbConnectedStrm( const URL &url );
212
213 //------------------------------------------------------------------------
215 //------------------------------------------------------------------------
216 void SetOnConnectHandler( const URL &url,
217 Job *onConnJob );
218
219 private:
220 Channel *GetChannel( const URL &url );
221
222 typedef std::map<std::string, Channel*> ChannelMap;
230 };
231}
232
233#endif // __XRD_CL_POST_MASTER_HH__
Definition: XrdClAnyObject.hh:33
Channel event handler.
Definition: XrdClPostMasterInterfaces.hh:221
A communication channel between the client and the server.
Definition: XrdClChannel.hh:49
Message handler.
Definition: XrdClPostMasterInterfaces.hh:69
A synchronized queue.
Definition: XrdClJobManager.hh:51
Interface for a job to be run by the job manager.
Definition: XrdClJobManager.hh:34
Message filter.
Definition: XrdClPostMasterInterfaces.hh:47
The message representation used throughout the system.
Definition: XrdClMessage.hh:30
Message status handler.
Definition: XrdClPostMasterInterfaces.hh:168
Interface for socket pollers.
Definition: XrdClPoller.hh:87
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:45
void SetOnConnectHandler(const URL &url, Job *onConnJob)
Set the on-connect handler for data streams.
Status Receive(const URL &url, Message *&msg, MessageFilter *filter, time_t expires)
TaskManager * pTaskManager
Definition: XrdClPostMaster.hh:224
bool Start()
Start the post master.
bool Finalize()
Finalizer.
bool Stop()
Stop the postmaster.
bool Reinitialize()
Reinitialize after fork.
TaskManager * GetTaskManager()
Get the task manager object user by the post master.
Definition: XrdClPostMaster.hh:190
virtual ~PostMaster()
Destructor.
std::map< std::string, Channel * > ChannelMap
Definition: XrdClPostMaster.hh:222
Status Send(const URL &url, Message *msg, OutgoingMsgHandler *handler, bool stateful, time_t expires)
uint16_t NbConnectedStrm(const URL &url)
Get the number of connected data streams.
JobManager * pJobManager
Definition: XrdClPostMaster.hh:229
Status RemoveEventHandler(const URL &url, ChannelEventHandler *handler)
Remove a channel event handler.
PostMaster()
Constructor.
Status Redirect(const URL &url, Message *msg, IncomingMsgHandler *handler)
Status ForceDisconnect(const URL &url)
Shut down a channel.
XrdSysMutex pChannelMapMutex
Definition: XrdClPostMaster.hh:226
bool pInitialized
Definition: XrdClPostMaster.hh:228
Status Receive(const URL &url, IncomingMsgHandler *handler, time_t expires)
Status QueryTransport(const URL &url, uint16_t query, AnyObject &result)
ChannelMap pChannelMap
Definition: XrdClPostMaster.hh:225
Status RegisterEventHandler(const URL &url, ChannelEventHandler *handler)
Register channel event handler.
Channel * GetChannel(const URL &url)
Poller * pPoller
Definition: XrdClPostMaster.hh:223
JobManager * GetJobManager()
Get the job manager object user by the post master.
Definition: XrdClPostMaster.hh:198
XrdSysRWLock pDisconnectLock
Definition: XrdClPostMaster.hh:227
Status Send(const URL &url, Message *msg, bool stateful, time_t expires)
bool Initialize()
Initializer.
Definition: XrdClTaskManager.hh:76
URL representation.
Definition: XrdClURL.hh:31
Definition: XrdSysPthread.hh:166
Definition: XrdSysPthread.hh:296
Definition: XrdClAnyObject.hh:26
Procedure execution status.
Definition: XrdClStatus.hh:110