XRootD
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< ExtentHolderconvert (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.

28{}

◆ ~XrdCephReadVBasic()

XrdCephReadVBasic::~XrdCephReadVBasic ( )
virtual

Definition at line 8 of file XrdCephReadVBasic.cc.

8 {
9
10 size_t totalBytes = m_usedBytes + m_wastedBytes;
11 float goodFrac_pct = totalBytes > 0 ? m_usedBytes/(totalBytes*100.) : 0;
12 BUFLOG("XrdCephReadVBasic: Summary: "
13 << " Used: " << m_usedBytes << " Wasted: " << m_wastedBytes << " goodFrac: "
14 << goodFrac_pct
15 );
16}
#define BUFLOG(x)

References BUFLOG.

Member Function Documentation

◆ convert()

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

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.

19{
20 std::vector<ExtentHolder> outputs;
21
22 const ExtentContainer &extentsIn = extentsHolderInput.extents();
23
24 ExtentContainer::const_iterator it_l = extentsIn.begin();
25 ExtentContainer::const_iterator it_r = extentsIn.begin();
26 ExtentContainer::const_iterator it_end = extentsIn.end();
27
28 // Shortcut the process if range is small
29 if ((it_end->end() - it_l->begin()) <= m_minSize) {
30 ExtentHolder tmp(extentsIn);
31 outputs.push_back(tmp);
32 BUFLOG("XrdCephReadVBasic: Combine all extents: "
33 << tmp.size() << " "
34 << it_l->begin() << " " << it_end->end() );
35 return outputs;
36 }
37 size_t usedBytes(0);
38 size_t wastedBytes(0);
39
40 // outer loop over extents
41 while (it_r != it_end)
42 {
43 ExtentHolder tmp;
44 it_l = it_r;
45 // inner loop over each internal extent range
46 while (it_r != it_end) {
47 if ((it_r->end() - it_l->begin()) > m_maxSize) break; // start a new holder
48 tmp.push_back(*it_r); // just put it into an extent
49 ++it_r;
50 }
51 outputs.push_back(tmp);
52 usedBytes += tmp.bytesContained();
53 wastedBytes += tmp.bytesMissing();
54 }
55 m_usedBytes += usedBytes;
56 m_wastedBytes += wastedBytes;
57 BUFLOG("XrdCephReadVBasic: In size: " << extentsHolderInput.size() << " "
58 << extentsHolderInput.extents().size() << " " << outputs.size() << " "
59 << " useful bytes: " << usedBytes << " wasted bytes:" << wastedBytes);
60
61
62 return outputs;
63} // convert
const ExtentContainer & extents() const
void push_back(const Extent &in)
std::vector< Extent > ExtentContainer
Container defintion for Extents Typedef to provide a container of extents as a simple stl vector cont...

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: