XRootD
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. More...
 
- 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)
Definition: BufferUtils.hh:23

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  int counter(0);
45  it_l = it_r;
46  // inner loop over each internal extent range
47  while (it_r != it_end) {
48  if ((it_r->end() - it_l->begin()) > m_maxSize) break; // start a new holder
49  tmp.push_back(*it_r); // just put it into an extent
50  ++it_r;
51  ++counter;
52  }
53  outputs.push_back(tmp);
54  usedBytes += tmp.bytesContained();
55  wastedBytes += tmp.bytesMissing();
56  }
57  m_usedBytes += usedBytes;
58  m_wastedBytes += wastedBytes;
59  BUFLOG("XrdCephReadVBasic: In size: " << extentsHolderInput.size() << " "
60  << extentsHolderInput.extents().size() << " " << outputs.size() << " "
61  << " useful bytes: " << usedBytes << " wasted bytes:" << wastedBytes);
62 
63 
64  return outputs;
65 } // convert
Designed to hold individual extents, but itself provide Extent-like capabilities Useful in cases of c...
Definition: BufferUtils.hh:109
size_t bytesContained() const
Definition: BufferUtils.cc:124
void push_back(const Extent &in)
Definition: BufferUtils.cc:101
const ExtentContainer & extents() const
Definition: BufferUtils.hh:133
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: