xrootd
XrdClOutQueue.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_OUT_QUEUE_HH__
20#define __XRD_CL_OUT_QUEUE_HH__
21
22#include <list>
23#include <utility>
24#include "XrdCl/XrdClStatus.hh"
25
26namespace XrdCl
27{
28 class Message;
29 class OutgoingMsgHandler;
30
31 //----------------------------------------------------------------------------
33 //----------------------------------------------------------------------------
35 {
36 public:
37 //------------------------------------------------------------------------
47 //------------------------------------------------------------------------
48 void PushBack( Message *msg,
49 OutgoingMsgHandler *handler,
50 time_t expires,
51 bool stateful );
52
53 //------------------------------------------------------------------------
63 //------------------------------------------------------------------------
64 void PushFront( Message *msg,
65 OutgoingMsgHandler *handler,
66 time_t expires,
67 bool stateful );
68
69 //------------------------------------------------------------------------
73 //------------------------------------------------------------------------
75 time_t &expires,
76 bool &stateful );
77
78 //------------------------------------------------------------------------
80 //------------------------------------------------------------------------
81 void PopFront();
82
83 //------------------------------------------------------------------------
85 //------------------------------------------------------------------------
86 void Report( Status status );
87
88 //------------------------------------------------------------------------
90 //------------------------------------------------------------------------
91 bool IsEmpty() const
92 {
93 return pMessages.empty();
94 }
95
96 //------------------------------------------------------------------------
97 // Return the size of the queue
98 //------------------------------------------------------------------------
99 uint64_t GetSize() const
100 {
101 return pMessages.size();
102 }
103
104 //------------------------------------------------------------------------
106 //------------------------------------------------------------------------
107 uint64_t GetSizeStateless() const;
108
109 //------------------------------------------------------------------------
115 //------------------------------------------------------------------------
116 void GrabExpired( OutQueue &queue, time_t exp = 0 );
117
118 //------------------------------------------------------------------------
123 //------------------------------------------------------------------------
124 void GrabStateful( OutQueue &queue );
125
126 //------------------------------------------------------------------------
130 //------------------------------------------------------------------------
131 void GrabItems( OutQueue &queue );
132
133 private:
134 //------------------------------------------------------------------------
135 // Helper struct holding all the message data
136 //------------------------------------------------------------------------
138 {
139 MsgHelper( Message *m, OutgoingMsgHandler *h, time_t r, bool s ):
140 msg( m ), handler( h ), expires( r ), stateful( s ) {}
141
144 time_t expires;
146 };
147
148 typedef std::list<MsgHelper> MessageList;
150 };
151}
152
153#endif // __XRD_CL_OUT_QUEUE_HH__
The message representation used throughout the system.
Definition: XrdClMessage.hh:30
A synchronized queue for the outgoing data.
Definition: XrdClOutQueue.hh:35
bool IsEmpty() const
Check if the queue is empty.
Definition: XrdClOutQueue.hh:91
void GrabStateful(OutQueue &queue)
void PopFront()
Remove a message from the front.
void GrabExpired(OutQueue &queue, time_t exp=0)
void Report(Status status)
Report status to all the handlers.
void PushFront(Message *msg, OutgoingMsgHandler *handler, time_t expires, bool stateful)
void GrabItems(OutQueue &queue)
void PushBack(Message *msg, OutgoingMsgHandler *handler, time_t expires, bool stateful)
MessageList pMessages
Definition: XrdClOutQueue.hh:149
std::list< MsgHelper > MessageList
Definition: XrdClOutQueue.hh:148
uint64_t GetSizeStateless() const
Return the size of the queue counting only the stateless messages.
Message * PopMessage(OutgoingMsgHandler *&handler, time_t &expires, bool &stateful)
uint64_t GetSize() const
Definition: XrdClOutQueue.hh:99
Message status handler.
Definition: XrdClPostMasterInterfaces.hh:168
Definition: XrdClAnyObject.hh:26
Definition: XrdClOutQueue.hh:138
OutgoingMsgHandler * handler
Definition: XrdClOutQueue.hh:143
time_t expires
Definition: XrdClOutQueue.hh:144
Message * msg
Definition: XrdClOutQueue.hh:142
MsgHelper(Message *m, OutgoingMsgHandler *h, time_t r, bool s)
Definition: XrdClOutQueue.hh:139
bool stateful
Definition: XrdClOutQueue.hh:145
Procedure execution status.
Definition: XrdClStatus.hh:110