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 
26 #include "XrdCl/XrdClStatus.hh"
27 #include "XrdCl/XrdClURL.hh"
29 
30 #include "XrdSys/XrdSysPthread.hh"
31 
32 namespace XrdCl
33 {
34  class Poller;
35  class TaskManager;
36  class Channel;
37  class JobManager;
38 
39  //----------------------------------------------------------------------------
41  //----------------------------------------------------------------------------
42  class PostMaster
43  {
44  public:
45  //------------------------------------------------------------------------
47  //------------------------------------------------------------------------
48  PostMaster();
49 
50  //------------------------------------------------------------------------
52  //------------------------------------------------------------------------
53  virtual ~PostMaster();
54 
55  //------------------------------------------------------------------------
57  //------------------------------------------------------------------------
58  bool Initialize();
59 
60  //------------------------------------------------------------------------
62  //------------------------------------------------------------------------
63  bool Finalize();
64 
65  //------------------------------------------------------------------------
67  //------------------------------------------------------------------------
68  bool Start();
69 
70  //------------------------------------------------------------------------
72  //------------------------------------------------------------------------
73  bool Stop();
74 
75  //------------------------------------------------------------------------
77  //------------------------------------------------------------------------
78  bool Reinitialize();
79 
80  //------------------------------------------------------------------------
94  //------------------------------------------------------------------------
95  Status Send( const URL &url,
96  Message *msg,
97  bool stateful,
98  time_t expires );
99 
100  //------------------------------------------------------------------------
116  //------------------------------------------------------------------------
117  Status Send( const URL &url,
118  Message *msg,
119  OutgoingMsgHandler *handler,
120  bool stateful,
121  time_t expires );
122 
123  //------------------------------------------------------------------------
125  //------------------------------------------------------------------------
126  Status Redirect( const URL &url,
127  Message *msg,
128  IncomingMsgHandler *handler);
129 
130  //------------------------------------------------------------------------
141  //------------------------------------------------------------------------
142  Status Receive( const URL &url,
143  Message *&msg,
144  MessageFilter *filter,
145  time_t expires );
146 
147  //------------------------------------------------------------------------
155  //------------------------------------------------------------------------
156  Status Receive( const URL &url,
157  IncomingMsgHandler *handler,
158  time_t expires );
159 
160  //------------------------------------------------------------------------
168  //------------------------------------------------------------------------
169  Status QueryTransport( const URL &url,
170  uint16_t query,
171  AnyObject &result );
172 
173  //------------------------------------------------------------------------
175  //------------------------------------------------------------------------
176  Status RegisterEventHandler( const URL &url,
177  ChannelEventHandler *handler );
178 
179  //------------------------------------------------------------------------
181  //------------------------------------------------------------------------
182  Status RemoveEventHandler( const URL &url,
183  ChannelEventHandler *handler );
184 
185  //------------------------------------------------------------------------
187  //------------------------------------------------------------------------
188  TaskManager *GetTaskManager()
189  {
190  return pTaskManager;
191  }
192 
193  //------------------------------------------------------------------------
195  //------------------------------------------------------------------------
196  JobManager *GetJobManager()
197  {
198  return pJobManager;
199  }
200 
201  private:
202  Channel *GetChannel( const URL &url );
203 
204  typedef std::map<std::string, Channel*> ChannelMap;
205  Poller *pPoller;
206  TaskManager *pTaskManager;
210  JobManager *pJobManager;
211  };
212 }
213 
214 #endif // __XRD_CL_POST_MASTER_HH__
Definition: XrdClAnyObject.hh:32
Status QueryTransport(const URL &url, uint16_t query, AnyObject &result)
Message filter.
Definition: XrdClPostMasterInterfaces.hh:46
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
Status Receive(const URL &url, Message *&msg, MessageFilter *filter, time_t expires)
TaskManager * GetTaskManager()
Get the task manager object user by the post master.
Definition: XrdClPostMaster.hh:188
Status Redirect(const URL &url, Message *msg, IncomingMsgHandler *handler)
Status RegisterEventHandler(const URL &url, ChannelEventHandler *handler)
Register channel event handler.
bool Start()
Start the post master.
bool Finalize()
Finalizer.
Procedure execution status.
Definition: XrdClStatus.hh:107
JobManager * pJobManager
Definition: XrdClPostMaster.hh:210
Definition: XrdSysPthread.hh:140
PostMaster()
Constructor.
Poller * pPoller
Definition: XrdClPostMaster.hh:205
bool Reinitialize()
Reinitialize after fork.
Channel event handler.
Definition: XrdClPostMasterInterfaces.hh:220
virtual ~PostMaster()
Destructor.
Message handler.
Definition: XrdClPostMasterInterfaces.hh:68
bool Initialize()
Initializer.
URL representation.
Definition: XrdClURL.hh:30
JobManager * GetJobManager()
Get the job manager object user by the post master.
Definition: XrdClPostMaster.hh:196
ChannelMap pChannelMap
Definition: XrdClPostMaster.hh:207
Channel * GetChannel(const URL &url)
Status RemoveEventHandler(const URL &url, ChannelEventHandler *handler)
Remove a channel event handler.
Message status handler.
Definition: XrdClPostMasterInterfaces.hh:167
A hub for dispatching and receiving messages.
Definition: XrdClPostMaster.hh:42
XrdSysMutex pChannelMapMutex
Definition: XrdClPostMaster.hh:208
TaskManager * pTaskManager
Definition: XrdClPostMaster.hh:206
std::map< std::string, Channel * > ChannelMap
Definition: XrdClPostMaster.hh:204
bool pInitialized
Definition: XrdClPostMaster.hh:209
Status Send(const URL &url, Message *msg, bool stateful, time_t expires)
bool Stop()
Stop the postmaster.