![]() |
XRootD
|
#include <XrdCephBufferAlgSimple.hh>
Public Member Functions | |
XrdCephBufferAlgSimple (std::unique_ptr< IXrdCephBufferData > buffer, std::unique_ptr< ICephIOAdapter > cephio, int fd, bool useStriperlessReads=true) | |
virtual | ~XrdCephBufferAlgSimple () |
virtual IXrdCephBufferData * | buffer () |
virtual const IXrdCephBufferData * | buffer () const |
virtual ssize_t | flushWriteCache () override |
remember to flush the cache on final writes More... | |
virtual ssize_t | read (volatile void *buff, off_t offset, size_t blen) override |
read data through the buffer More... | |
virtual ssize_t | read_aio (XrdSfsAio *aoip) override |
possible aio based code More... | |
virtual ssize_t | write (const void *buff, off_t offset, size_t blen) override |
write data through the buffer More... | |
virtual ssize_t | write_aio (XrdSfsAio *aoip) override |
possible aio based code More... | |
![]() | |
virtual | ~IXrdCephBufferAlg () |
Protected Member Functions | |
virtual ssize_t | rawRead (void *buff, off_t offset, size_t blen) |
virtual ssize_t | rawWrite (void *buff, off_t offset, size_t blen) |
Non-async buffering code for non-aio read operations. Create a single buffer of a given size. For reads, if data in the buffer read and return the available bytes; if no useful data in the buffer fill the full buffer and return the requested read. If the data is partially in the buffer for the range requested, return only that subset; client should check and make an additional call for the data not returned. if 0 bytes are returned, it should be assumed it is at the end of the file.
Definition at line 27 of file XrdCephBufferAlgSimple.hh.
XrdCephBufferAlgSimple::XrdCephBufferAlgSimple | ( | std::unique_ptr< IXrdCephBufferData > | buffer, |
std::unique_ptr< ICephIOAdapter > | cephio, | ||
int | fd, | ||
bool | useStriperlessReads = true |
||
) |
Definition at line 20 of file XrdCephBufferAlgSimple.cc.
|
virtual |
Definition at line 28 of file XrdCephBufferAlgSimple.cc.
References BUFLOG.
|
inlinevirtual |
Definition at line 43 of file XrdCephBufferAlgSimple.hh.
|
inlinevirtual |
Definition at line 42 of file XrdCephBufferAlgSimple.hh.
|
overridevirtual |
remember to flush the cache on final writes
Implements XrdCephBuffer::IXrdCephBufferAlg.
Definition at line 354 of file XrdCephBufferAlgSimple.cc.
References BUFLOG.
Referenced by write().
|
protectedvirtual |
Definition at line 381 of file XrdCephBufferAlgSimple.cc.
|
protectedvirtual |
Definition at line 385 of file XrdCephBufferAlgSimple.cc.
|
overridevirtual |
read data through the buffer
If the requested read is larger than the buffer size, just bypass the cache. Invalidate the cache in anycase
In principle, only should ever have the first loop, however, in the case a read request passes over the boundary of the buffer, two reads will be needed; the first to read out the current buffer, and a second, to read the partial data from the refilled buffer
If we need to load data in the cache, do it here.
Implements XrdCephBuffer::IXrdCephBufferAlg.
Definition at line 90 of file XrdCephBufferAlgSimple.cc.
References BUFLOG, and ceph_posix_maybestriper_pread().
Referenced by read_aio().
|
overridevirtual |
possible aio based code
Implements XrdCephBuffer::IXrdCephBufferAlg.
Definition at line 43 of file XrdCephBufferAlgSimple.cc.
References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::doneRead(), read(), XrdSfsAio::Result, and XrdSfsAio::sfsAio.
|
overridevirtual |
write data through the buffer
We expect the next write to be in order and well defined. Determine the expected offset, and compare against offset provided Expected offset is the end of the buffer. m_bufferStartingOffset is the represented offset in ceph that buffer[0] represents
We should be equally careful if the offset of the buffer start is not aligned sensibly. Log this only for now, but #TODO, this should be come an error condition for over cautitious behaviour.
Provide some sanity checking for the write to the buffer. We call an error on this conditions as there is no immediate solution that is satisfactory.
< track how many bytes left to write
Typically would expect only one loop, i.e. the write request is smaller than the buffer. If bigger, or the request stradles the end of the buffer, will need another loop
If the cache is already full, lets flush to disk now
Check again if we can write data into the storage
Implements XrdCephBuffer::IXrdCephBufferAlg.
Definition at line 207 of file XrdCephBufferAlgSimple.cc.
References BUFLOG, and flushWriteCache().
Referenced by write_aio().
|
overridevirtual |
possible aio based code
Implements XrdCephBuffer::IXrdCephBufferAlg.
Definition at line 67 of file XrdCephBufferAlgSimple.cc.
References aiocb::aio_buf, aiocb::aio_nbytes, aiocb::aio_offset, XrdSfsAio::doneWrite(), XrdSfsAio::Result, XrdSfsAio::sfsAio, and write().