Loading...
Searching...
No Matches
XrdCephBuffer::XrdCephReadVBasic Class Reference

Combine requests into single reads accoriding to some basic rules. Read a minimum amount of data (2MiB default), keep adding chunks until the used fraction is lower than some threshold, or 64MiB is reached. Calling code unraveles the correct ranges for each. More...

`#include <XrdCephReadVBasic.hh>`

Inheritance diagram for XrdCephBuffer::XrdCephReadVBasic:
Collaboration diagram for XrdCephBuffer::XrdCephReadVBasic:

## Public Member Functions

| XrdCephReadVBasic ()
virtual | ~XrdCephReadVBasic ()
virtual std::vector< ExtentHolder > | convert (const ExtentHolder &extentsHolderInput) override

Take in a set of extents representing the readV requests. return a vector of each combined read request. Caller translates the readV request into a set of Extents (passed to an ExtentHolder). The logic of the specific concrete implementation combines the set of readV requests into merged requests. Output is a vector of those requests. Each ExtentHolder element holds the offset and len to be read, and also the contained extents of the readVs. The index of the readV element is not held, so the caller must ensure to match up appropriately.

Public Member Functions inherited from XrdCephBuffer::IXrdCephReadVAdapter
virtual | ~IXrdCephReadVAdapter ()

## Protected Attributes

ssize_t | m_maxSize = 16*1024*1024
ssize_t | m_minSize = 2*1024*1024

## Detailed Description

Combine requests into single reads accoriding to some basic rules. Read a minimum amount of data (2MiB default), keep adding chunks until the used fraction is lower than some threshold, or 64MiB is reached. Calling code unraveles the correct ranges for each.

Definition at line 25 of file XrdCephReadVBasic.hh.

## Constructor & Destructor Documentation

## XrdCephReadVBasic()

XrdCephBuffer::XrdCephReadVBasic::XrdCephReadVBasic | ( |  | ) |

inline

Definition at line 28 of file XrdCephReadVBasic.hh.

{}

## ~XrdCephReadVBasic()

XrdCephReadVBasic::~XrdCephReadVBasic | ( |  | ) |

virtual

Definition at line 8 of file XrdCephReadVBasic.cc.

{
size_t totalBytes = m_usedBytes + m_wastedBytes;
float goodFrac_pct = totalBytes > 0 ? m_usedBytes/(totalBytes*100.) : 0;
BUFLOG("XrdCephReadVBasic: Summary: "
<< " Used: " << m_usedBytes << " Wasted: " << m_wastedBytes << " goodFrac: "
<< goodFrac_pct
);
}
BUFLOG
#define BUFLOG(x)
Definition BufferUtils.hh:23

References BUFLOG.

## Member Function Documentation

## convert()

std::vector< ExtentHolder > XrdCephReadVBasic::convert | ( | const ExtentHolder & | extentsIn | ) |

override virtual

Take in a set of extents representing the readV requests. return a vector of each combined read request. Caller translates the readV request into a set of Extents (passed to an ExtentHolder). The logic of the specific concrete implementation combines the set of readV requests into merged requests. Output is a vector of those requests. Each ExtentHolder element holds the offset and len to be read, and also the contained extents of the readVs. The index of the readV element is not held, so the caller must ensure to match up appropriately.

Parameters

  extentsIn |

Returns
  std::vector<ExtentHolder>

Implements XrdCephBuffer::IXrdCephReadVAdapter.

Definition at line 18 of file XrdCephReadVBasic.cc.

{
std::vector<ExtentHolder> outputs;
const ExtentContainer &extentsIn = extentsHolderInput.extents();
ExtentContainer::const_iterator it_l = extentsIn.begin();
ExtentContainer::const_iterator it_r = extentsIn.begin();
ExtentContainer::const_iterator it_end = extentsIn.end();
// Shortcut the process if range is small
if ((it_end->end() - it_l->begin()) <= m_minSize) {
ExtentHolder tmp(extentsIn);
outputs.push_back(tmp);
BUFLOG("XrdCephReadVBasic: Combine all extents: "
<< tmp.size() << " "
<< it_l->begin() << " " << it_end->end() );
return outputs;
}
size_t usedBytes(0);
size_t wastedBytes(0);
// outer loop over extents
while (it_r != it_end)
{
ExtentHolder tmp;
it_l = it_r;
// inner loop over each internal extent range
while (it_r != it_end) {
if ((it_r->end() - it_l->begin()) > m_maxSize) break; // start a new holder
tmp.push_back(*it_r); // just put it into an extent
++it_r;
}
outputs.push_back(tmp);
usedBytes += tmp.bytesContained();
wastedBytes += tmp.bytesMissing();
}
m_usedBytes += usedBytes;
m_wastedBytes += wastedBytes;
BUFLOG("XrdCephReadVBasic: In size: " << extentsHolderInput.size() << " "
<< extentsHolderInput.extents().size() << " " << outputs.size() << " "
<< " useful bytes: " << usedBytes << " wasted bytes:" << wastedBytes);
return outputs;
} // convert
XrdCephBuffer::ExtentHolder::extents
const ExtentContainer & extents() const
Definition BufferUtils.hh:133
XrdCephBuffer::ExtentHolder::bytesContained
size_t bytesContained() const
Definition BufferUtils.cc:124
XrdCephBuffer::ExtentHolder::push_back
void push_back(const Extent &in)
Definition BufferUtils.cc:101
XrdCephBuffer::ExtentHolder::bytesMissing
size_t bytesMissing() const
Definition BufferUtils.cc:132
XrdCephBuffer::XrdCephReadVBasic::m_minSize
ssize_t m_minSize
Definition XrdCephReadVBasic.hh:34
XrdCephBuffer::XrdCephReadVBasic::m_maxSize
ssize_t m_maxSize
Definition XrdCephReadVBasic.hh:35
XrdCephBuffer::ExtentContainer
std::vector< Extent > ExtentContainer
Container defintion for Extents Typedef to provide a container of extents as a simple stl vector cont...
Definition BufferUtils.hh:99

References BUFLOG, XrdCephBuffer::ExtentHolder::bytesContained(), XrdCephBuffer::ExtentHolder::bytesMissing(), XrdCephBuffer::ExtentHolder::extents(), m_maxSize, m_minSize, XrdCephBuffer::ExtentHolder::push_back(), and XrdCephBuffer::ExtentHolder::size().

Here is the call graph for this function:

## Member Data Documentation

## m_maxSize

ssize_t XrdCephBuffer::XrdCephReadVBasic::m_maxSize = 16*1024*1024

protected

Definition at line 35 of file XrdCephReadVBasic.hh.

Referenced by convert().

## m_minSize

ssize_t XrdCephBuffer::XrdCephReadVBasic::m_minSize = 2*1024*1024

protected

Definition at line 34 of file XrdCephReadVBasic.hh.

Referenced by convert().

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

- XrdCephReadVBasic.hh
- XrdCephReadVBasic.cc