XRootD
IXrdCephBufferData.hh
Go to the documentation of this file.
1 #ifndef __IXRD_CEPH_BUFFER_DATA_HH__
2 #define __IXRD_CEPH_BUFFER_DATA_HH__
3 //------------------------------------------------------------------------------
4 // Interface to the actual buffer data object used to store the data
5 // Intention to be able to abstract the underlying implementation and code against the inteface
6 // e.g. if choice of buffer data object
7 //------------------------------------------------------------------------------
8 
9 #include <sys/types.h>
10 
11 namespace XrdCephBuffer {
12 
19  public:
20  virtual ~IXrdCephBufferData(){}
21  virtual size_t capacity() const = 0;
22  virtual size_t length() const = 0;
23  virtual void setLength(size_t len) =0 ;
24  virtual bool isValid() const =0;
25  virtual void setValid(bool isValid) =0;
26 
27  virtual off_t startingOffset() const = 0;
28  virtual off_t setStartingOffset(off_t offset) = 0;
29 
30  virtual ssize_t invalidate() = 0;
31 
32  virtual ssize_t readBuffer(void* buf, off_t offset, size_t blen) const = 0;
33 
34  virtual ssize_t writeBuffer(const void* buf, off_t offset, size_t blen,off_t externalOffset) = 0;
35 
36  virtual const void* raw() const = 0; // const accessor to the 'raw' or underlying object
37  virtual void* raw() = 0; // accessor to the 'raw' or underlying object
38 
39 
40  protected:
41 
42 };
43 
44 }
45 
46 #endif
Interface to the Buffer's physical representation. Allow an interface to encapsulate the requirements...
virtual ssize_t readBuffer(void *buf, off_t offset, size_t blen) const =0
set cache into an invalid state
virtual ssize_t writeBuffer(const void *buf, off_t offset, size_t blen, off_t externalOffset)=0
copy data from the internal buffer to buf
virtual size_t capacity() const =0
virtual off_t startingOffset() const =0
virtual size_t length() const =0
total available space
virtual off_t setStartingOffset(off_t offset)=0
virtual ssize_t invalidate()=0
virtual void setLength(size_t len)=0
Currently occupied and valid space, which may be less than capacity.
virtual bool isValid() const =0
Currently occupied and valid space, which may be less than capacity.
virtual void setValid(bool isValid)=0
virtual const void * raw() const =0
write data into the buffer, store the external offset
is a simple implementation of IXrdCephBufferData using std::vector<char> representation for the buffe...
Definition: BufferUtils.hh:29