XRootD
Loading...
Searching...
No Matches
XrdCl::OutQueue Class Reference

A synchronized queue for the outgoing data. More...

#include <XrdClOutQueue.hh>

Collaboration diagram for XrdCl::OutQueue:

Classes

struct  MsgHelper

Public Member Functions

uint64_t GetSize () const
uint64_t GetSizeStateless () const
 Return the size of the queue counting only the stateless messages.
void GrabExpired (OutQueue &queue, time_t exp=0)
void GrabItems (OutQueue &queue)
void GrabStateful (OutQueue &queue)
bool IsEmpty () const
 Check if the queue is empty.
void PopFront ()
 Remove a message from the front.
MessagePopMessage (MsgHandler *&handler, time_t &expires, bool &stateful)
 Get a message from the front of the queue.
void PushBack (Message *msg, MsgHandler *handler, time_t expires, bool stateful)
void PushFront (Message *msg, MsgHandler *handler, time_t expires, bool stateful)
void Report (XRootDStatus status)
 Report status to all the handlers.

Detailed Description

A synchronized queue for the outgoing data.

Definition at line 34 of file XrdClOutQueue.hh.

Member Function Documentation

◆ GetSize()

uint64_t XrdCl::OutQueue::GetSize ( ) const
inline

Definition at line 99 of file XrdClOutQueue.hh.

100 {
101 return pMessages.size();
102 }

◆ GetSizeStateless()

uint64_t XrdCl::OutQueue::GetSizeStateless ( ) const

Return the size of the queue counting only the stateless messages.

Definition at line 85 of file XrdClOutQueue.cc.

86 {
87 uint64_t size = 0;
88 MessageList::const_iterator it;
89 for( it = pMessages.begin(); it != pMessages.end(); ++it )
90 if( !it->stateful )
91 ++size;
92 return size;
93 }

◆ GrabExpired()

void XrdCl::OutQueue::GrabExpired ( OutQueue & queue,
time_t exp = 0 )

Remove all the expired messages from the queue and put them in this one

Parameters
queuequeue to take the message from
expexpiration timestamp

Definition at line 99 of file XrdClOutQueue.cc.

100 {
101 MessageList::iterator it;
102 for( it = queue.pMessages.begin(); it != queue.pMessages.end(); )
103 {
104 if( it->expires > exp )
105 {
106 ++it;
107 continue;
108 }
109 pMessages.push_back( *it );
110 it = queue.pMessages.erase( it );
111 }
112 }

Referenced by XrdCl::Stream::Tick().

Here is the caller graph for this function:

◆ GrabItems()

void XrdCl::OutQueue::GrabItems ( OutQueue & queue)

Take all the items from the queue and put them in this one

Parameters
queuequeue to take the message

Definition at line 136 of file XrdClOutQueue.cc.

137 {
138 MessageList::iterator it;
139 for( it = queue.pMessages.begin(); it != queue.pMessages.end(); ++it )
140 pMessages.push_back( *it );
141 queue.pMessages.clear();
142 }

Referenced by XrdCl::Stream::ForceError().

Here is the caller graph for this function:

◆ GrabStateful()

void XrdCl::OutQueue::GrabStateful ( OutQueue & queue)

Remove all the stateful messages from the queue and put them in this one

Parameters
queuethe queue to take the messages from

Definition at line 118 of file XrdClOutQueue.cc.

119 {
120 MessageList::iterator it;
121 for( it = queue.pMessages.begin(); it != queue.pMessages.end(); )
122 {
123 if( !it->stateful )
124 {
125 ++it;
126 continue;
127 }
128 pMessages.push_back( *it );
129 it = queue.pMessages.erase( it );
130 }
131 }

Referenced by XrdCl::Stream::OnError().

Here is the caller graph for this function:

◆ IsEmpty()

bool XrdCl::OutQueue::IsEmpty ( ) const
inline

Check if the queue is empty.

Definition at line 91 of file XrdClOutQueue.hh.

92 {
93 return pMessages.empty();
94 }

◆ PopFront()

void XrdCl::OutQueue::PopFront ( )

Remove a message from the front.

Definition at line 67 of file XrdClOutQueue.cc.

68 {
69 pMessages.pop_front();
70 }

◆ PopMessage()

Message * XrdCl::OutQueue::PopMessage ( MsgHandler *& handler,
time_t & expires,
bool & stateful )

Get a message from the front of the queue.

Pop a message from the front of the queue

Returns
0 if there is no message message

Definition at line 49 of file XrdClOutQueue.cc.

52 {
53 if( pMessages.empty() )
54 return 0;
55
56 MsgHelper m = pMessages.front();
57 handler = m.handler;
58 expires = m.expires;
59 stateful = m.stateful;
60 pMessages.pop_front();
61 return m.msg;
62 }

References XrdCl::OutQueue::MsgHelper::expires, XrdCl::OutQueue::MsgHelper::handler, XrdCl::OutQueue::MsgHelper::msg, and XrdCl::OutQueue::MsgHelper::stateful.

◆ PushBack()

void XrdCl::OutQueue::PushBack ( Message * msg,
MsgHandler * handler,
time_t expires,
bool stateful )

Add a message to the back the queue

Parameters
msgmessage to be sent
handlerhandler to be notified about the status of the operation
expirestimeout
statefulif true a disconnection will cause an error and removing from the queue, otherwise sending wil be re-attempted

Definition at line 27 of file XrdClOutQueue.cc.

31 {
32 pMessages.push_back( MsgHelper( msg, handler, expires, stateful ) );
33 }

◆ PushFront()

void XrdCl::OutQueue::PushFront ( Message * msg,
MsgHandler * handler,
time_t expires,
bool stateful )

Add a message to the front the queue

Parameters
msgmessage to be sent
handlerhandler to be notified about the status of the operation
expirestimeout
statefulif true a disconnection will cause an error and removing from the queue, otherwise sending wil be re-attempted

Definition at line 38 of file XrdClOutQueue.cc.

42 {
43 pMessages.push_front( MsgHelper( msg, handler, expires, stateful ) );
44 }

◆ Report()

void XrdCl::OutQueue::Report ( XRootDStatus status)

Report status to all the handlers.

Definition at line 75 of file XrdClOutQueue.cc.

76 {
77 MessageList::iterator it;
78 for( it = pMessages.begin(); it != pMessages.end(); ++it )
79 it->handler->OnStatusReady( it->msg, status );
80 }

Referenced by XrdCl::Stream::ForceError(), XrdCl::Stream::OnError(), and XrdCl::Stream::Tick().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: