1 #ifndef __CEPH_BUFFER_UTILS_HH__
2 #define __CEPH_BUFFER_UTILS_HH__
10 #include <sys/types.h>
20 #define CEPHBUFDEBUG 1
23 #define BUFLOG(x) {std::unique_lock<std::mutex>cephbuf_iolock; std::stringstream _bs; _bs << x; std::clog << _bs.str() << std::endl;}
46 std::chrono::steady_clock::time_point m_start;
65 inline off_t
offset()
const {
return m_offset; }
66 inline size_t len()
const {
return m_len; }
67 inline off_t
begin()
const {
return m_offset; }
68 inline off_t
end()
const {
return m_offset + m_len; }
69 inline bool empty()
const {
return m_len == 0;}
77 inline off_t
last_pos()
const {
return m_offset + m_len - 1; }
std::mutex cephbuf_iolock
Designed to hold individual extents, but itself provide Extent-like capabilities Useful in cases of c...
bool empty() const
Total range in bytes of the extents.
size_t bytesContained() const
ExtentContainer getExtents() const
size_t size() const
number of extent elements
ExtentContainer getSortedExtents() const
void push_back(const Extent &in)
void sort()
inplace sort by offset of contained extents
size_t bytesMissing() const
const ExtentContainer & extents() const
ExtentContainer m_extents
off_t end() const
similar to stl vector end.
Extent containedExtent(off_t pos, size_t len) const
return the subset of range that is in this extent
off_t begin() const
Same as offset, but a bit more stl container like.
bool isContiguous(const Extent &rhs) const
bool operator==(const Extent &rhs) const
off_t last_pos() const
last real position
bool operator<(const Extent &rhs) const
bool allInExtent(off_t pos, size_t len) const
is all the range in this extent
bool in_extent(off_t pos) const
is this position within the range of this extent
Extent(off_t offset, size_t len)
Ecapsulates an offsets and length, with added functionaliyu Class that represents an offset possition...
bool someInExtent(off_t pos, size_t len) const
is some of the range in this extent
Timer_ns(long &output_ns)
RAII based timer information outputing a long value of ns Almost trivial class to time something and ...
is a simple implementation of IXrdCephBufferData using std::vector<char> representation for the buffe...
std::vector< Extent > ExtentContainer
Container defintion for Extents Typedef to provide a container of extents as a simple stl vector cont...