XRootD
Loading...
Searching...
No Matches
XrdClChannel.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_CHANNEL_HH__
20#define __XRD_CL_POST_CHANNEL_HH__
21
22#include <cstdint>
23#include <vector>
24#include <ctime>
25#include <functional>
26
27#include "XrdCl/XrdClStatus.hh"
28#include "XrdCl/XrdClURL.hh"
29#include "XrdCl/XrdClPoller.hh"
30#include "XrdCl/XrdClInQueue.hh"
34
36
37namespace XrdCl
38{
39 class Stream;
40 class JobManager;
43 class Job;
44
45 //----------------------------------------------------------------------------
60 //----------------------------------------------------------------------------
61 class Channel
62 {
63 public:
64 //------------------------------------------------------------------------
72 //------------------------------------------------------------------------
73 Channel( const URL &url,
74 Poller *poller,
75 TransportHandler *transport,
76 TaskManager *taskManager,
77 JobManager *jobManager,
78 const URL &prefurl = URL() );
79
80 //------------------------------------------------------------------------
82 //------------------------------------------------------------------------
83 ~Channel();
84
85 //------------------------------------------------------------------------
87 //------------------------------------------------------------------------
88 const URL &GetURL() const
89 {
90 return pUrl;
91 }
92
93 //------------------------------------------------------------------------
105 //------------------------------------------------------------------------
107 MsgHandler *handler,
108 bool stateful,
109 time_t expires );
110
111 //------------------------------------------------------------------------
118 //------------------------------------------------------------------------
119 Status QueryTransport( uint16_t query, AnyObject &result );
120
121 //------------------------------------------------------------------------
123 //------------------------------------------------------------------------
125
126 //------------------------------------------------------------------------
128 //------------------------------------------------------------------------
130
131 //------------------------------------------------------------------------
133 //------------------------------------------------------------------------
134 void Tick( time_t now );
135
136 //------------------------------------------------------------------------
138 //------------------------------------------------------------------------
140
141 //------------------------------------------------------------------------
143 //------------------------------------------------------------------------
144 Status ForceDisconnect( bool hush );
145
146 //------------------------------------------------------------------------
149 //------------------------------------------------------------------------
150 Status ForceDisconnect( std::shared_ptr<Channel> self,
151 const uint64_t sess );
152
153 //------------------------------------------------------------------------
155 //------------------------------------------------------------------------
157
158 //------------------------------------------------------------------------
160 //------------------------------------------------------------------------
161 uint16_t NbConnectedStrm();
162
163 //------------------------------------------------------------------------
165 //------------------------------------------------------------------------
166 void SetOnDataConnectHandler( std::shared_ptr<Job> &onConnJob );
167
168 //------------------------------------------------------------------------
171 //------------------------------------------------------------------------
172 bool CanCollapse( const URL &url );
173
174 //------------------------------------------------------------------------
176 //------------------------------------------------------------------------
177 void DecFileInstCnt();
178
179 //------------------------------------------------------------------------
181 //------------------------------------------------------------------------
182 void SetSelf( std::shared_ptr<Channel> &self );
183
184 //------------------------------------------------------------------------
188 //------------------------------------------------------------------------
189 void Finalize();
190
191 private:
192
193 URL pUrl;
194 Poller *pPoller;
195 TransportHandler *pTransport;
196 TaskManager *pTaskManager;
197 std::unique_ptr<Stream> pStream;
198 XrdSysMutex pMutex;
199 AnyObject pChannelData;
200 InQueue pIncoming;
201 TickGeneratorTask *pTickGenerator;
202 JobManager *pJobManager;
203 std::weak_ptr<Channel> pSelf;
204 };
205}
206
207#endif // __XRD_CL_POST_CHANNEL_HH__
const URL & GetURL() const
Get the URL.
uint16_t NbConnectedStrm()
Get the number of connected data streams.
Status ForceReconnect()
Force reconnect.
void RemoveEventHandler(ChannelEventHandler *handler)
Remove a channel event handler.
void SetOnDataConnectHandler(std::shared_ptr< Job > &onConnJob)
Set the on-connect handler for data streams.
~Channel()
Destructor.
void RegisterEventHandler(ChannelEventHandler *handler)
Register channel event handler.
void DecFileInstCnt()
Decrement file object instance count bound to this channel.
Status ForceDisconnect()
Force disconnect of all streams.
XRootDStatus Send(Message *msg, MsgHandler *handler, bool stateful, time_t expires)
void SetSelf(std::shared_ptr< Channel > &self)
Gives us access to the shared pointer that the postmaster holds for us.
void Tick(time_t now)
Handle a time event.
bool CanCollapse(const URL &url)
Status QueryTransport(uint16_t query, AnyObject &result)
Channel(const URL &url, Poller *poller, TransportHandler *transport, TaskManager *taskManager, JobManager *jobManager, const URL &prefurl=URL())
A synchronize queue for incoming data.
A synchronized queue.
Interface for a job to be run by the job manager.
The message representation used throughout the system.
Interface for socket pollers.
Perform the handshake and the authentication for each physical stream.
URL representation.
Definition XrdClURL.hh:31
An interface for metadata redirectors.
Procedure execution status.