Loading...
Searching...
No Matches
XrdCl::StreamSelector Struct Reference

Selects less loaded stream for read operation over multiple streams. More...

Collaboration diagram for XrdCl::StreamSelector:

## Public Member Functions

| StreamSelector (uint16_t size)
void | AdjustQueues (uint16_t size)
void | MsgReceived (uint16_t substrm)
uint16_t | Select (const std::vector< bool > &connected)

## Detailed Description

Selects less loaded stream for read operation over multiple streams.

Definition at line 137 of file XrdClXRootDTransport.cc.

## Constructor & Destructor Documentation

## StreamSelector()

XrdCl::StreamSelector::StreamSelector | ( | uint16_t | size | ) |

inline

Definition at line 139 of file XrdClXRootDTransport.cc.

{
//----------------------------------------------------------------------
// Subtract one because we shouldn't take into account the control
// stream.
//----------------------------------------------------------------------
strmqueues.resize( size - 1, 0 );
}

## Member Function Documentation

## AdjustQueues()

void XrdCl::StreamSelector::AdjustQueues | ( | uint16_t | size | ) |

inline

Definition at line 151 of file XrdClXRootDTransport.cc.

{
strmqueues.resize( size - 1, 0);
}

## MsgReceived()

void XrdCl::StreamSelector::MsgReceived | ( | uint16_t | substrm | ) |

inline

Definition at line 184 of file XrdClXRootDTransport.cc.

{
if( substrm > 0 )
--strmqueues[substrm - 1];
}

## Select()

uint16_t XrdCl::StreamSelector::Select | ( | const std::vector< bool > & | connected | ) |

inline

Definition at line 161 of file XrdClXRootDTransport.cc.

{
uint16_t ret = 0;
size_t minval = std::numeric_limits<size_t>::max();
for( uint16_t i = 0; i < connected.size() && i < strmqueues.size(); ++i )
{
if( !connected[i] ) continue;
if( strmqueues[i] < minval )
{
ret = i;
minval = strmqueues[i];
}
}
++strmqueues[ret];
return ret + 1;
}

The documentation for this struct was generated from the following file:

- XrdClXRootDTransport.cc