xrootd
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
XrdOucCacheIO Class Referenceabstract

#include <XrdOucCache.hh>

Inheritance diagram for XrdOucCacheIO:
Inheritance graph
[legend]

Classes

struct  aprParms
 

Public Member Functions

virtual bool Detach (XrdOucCacheIOCD &iocd)=0
 
virtual long long FSize ()=0
 
virtual int Fstat (struct stat &sbuff)
 
virtual const char * Location (bool refresh=false)
 
virtual const char * Path ()=0
 
virtual int pgRead (char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual void pgRead (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual int pgWrite (char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual void pgWrite (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wrlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
 
virtual void Preread (long long offs, int rlen, int opts=0)
 
virtual void Preread (aprParms &Parms)
 
virtual int Read (char *buff, long long offs, int rlen)=0
 
virtual void Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
 
virtual int ReadV (const XrdOucIOVec *readV, int rnum)
 
virtual void ReadV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
 
virtual int Sync ()=0
 
virtual void Sync (XrdOucCacheIOCB &iocb)
 
virtual int Trunc (long long offs)=0
 
virtual void Trunc (XrdOucCacheIOCB &iocb, long long offs)
 
virtual void Update (XrdOucCacheIO &iocp)
 
virtual int Write (char *buff, long long offs, int wlen)=0
 
virtual void Write (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
 
virtual int WriteV (const XrdOucIOVec *writV, int wnum)
 
virtual void WriteV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *writV, int wnum)
 
 XrdOucCacheIO ()
 Construct and Destructor.
 

Static Public Attributes

static const uint64_t forceCS = 0x0000000000000001ULL
 
static const int SingleUse = 0x0001
 Mark pages for single use.
 

Protected Member Functions

virtual ~XrdOucCacheIO ()
 

Detailed Description

The XrdOucCacheIO object is responsible for interacting with the original data source/target. It can be used with or without a front-end cache.

Constructor & Destructor Documentation

◆ XrdOucCacheIO()

XrdOucCacheIO::XrdOucCacheIO ( )
inline

Construct and Destructor.

◆ ~XrdOucCacheIO()

virtual XrdOucCacheIO::~XrdOucCacheIO ( )
inlineprotectedvirtual

Member Function Documentation

◆ Detach()

virtual bool XrdOucCacheIO::Detach ( XrdOucCacheIOCD iocd)
pure virtual

Detach this CacheIO object from the cache.

Note
This method must be called instead of using the delete operator since CacheIO objects may have multiple outstanding references and actual deletion may need to be deferred.
Parameters
iocdreference to the detach complete callback object.
Returns
true Deletion can occur immediately. There is no outstanding I/O.
false Deletion must be deferred until it is safe to so from the cache perspective. At which point, the cache will call the DetachDone() method in the passed callback object. No locks may be held with respect to the CacheIO object when this is done to avoid deadlocks.

Implemented in XrdPosixPrepIO, XrdPosixFile, XrdRmcData, and XrdPfc::IO.

◆ FSize()

virtual long long XrdOucCacheIO::FSize ( )
pure virtual

Obtain size of the file.

Returns
Size of the file in bytes.

Implemented in XrdPosixPrepIO, XrdRmcData, XrdPfc::IOFile, XrdPfc::IOFileBlock, and XrdPosixFile.

Referenced by XrdRmcData::FSize().

◆ Fstat()

virtual int XrdOucCacheIO::Fstat ( struct stat sbuff)
inlinevirtual

Perform an fstat() operation (defaults to passthrough).

Parameters
sbuffreference to the stat buffer to be filled in. Only fields st_size, st_blocks, st_mtime (st_atime and st_ctime may be set to st_mtime), st_ino, and st_mode need to be set. All other fields are preset and should not be changed.
Returns
<0 - fstat failed, value is -errno. =0 - fstat succeeded, sbuff holds stat information. >0 - fstat could not be done, forward operation to next level.

Reimplemented in XrdPosixPrepIO, XrdPosixFile, XrdPfc::IOFile, and XrdPfc::IOFileBlock.

◆ Location()

virtual const char * XrdOucCacheIO::Location ( bool  refresh = false)
inlinevirtual

Get the file's location (i.e. endpoint hostname and port)

Parameters
refresh- when true, recomputes the location in case it changed st the location is cached from the previous successful call.
Returns
A pointer to the file's location. It remains valid until the file is closed or Location() is called with refresh set to true. A null string means the file is not open or location is unknown.

Reimplemented in XrdPosixFile.

◆ Path()

virtual const char * XrdOucCacheIO::Path ( )
pure virtual

Get the path associated with this object.

Returns
Pointer to the path.

Implemented in XrdPosixPrepIO, XrdRmcData, XrdPfc::IO, and XrdPosixFile.

Referenced by XrdRmcData::Path().

◆ pgRead() [1/2]

virtual int XrdOucCacheIO::pgRead ( char *  buff,
long long  offs,
int  rdlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
virtual

Reimplemented in XrdPfc::IOFile, and XrdPosixFile.

Referenced by pgRead().

◆ pgRead() [2/2]

virtual void XrdOucCacheIO::pgRead ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  rdlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
inlinevirtual

Read file pages and checksums using asynchronous I/O (default sync).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to buffer where the bytes are to be placed.
offsThe offset where the read is to start.
rdlenThe number of bytes to read.
csvecA vector which will be filled with the corresponding CRC32C checksum for each page or page segment.
optsProcessing options: forceCS - always return checksums even when not available.
csfixWhen not nil, returns the number of corrected checksum errs.

Reimplemented in XrdPfc::IOFile, XrdPfc::IOFile, and XrdPosixFile.

References XrdOucCacheIOCB::Done(), and pgRead().

◆ pgWrite() [1/2]

virtual int XrdOucCacheIO::pgWrite ( char *  buff,
long long  offs,
int  wrlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
virtual

Write file pages from a buffer and corresponding verified checksums.

Parameters
buffpointer to buffer holding the bytes to be written.
offsThe offset where the write is to start.
wrlenThe number of bytes to write. offs+wrlen (i.e. it establishes an end of file).
csvecA vector of that holds the corresponding verified CRC32C checksum for each page or page segment.
optsProcessing options.
csfixWhen not nil, returns the number of corrected checksum errs.
Returns
>= 0 The number of bytes written.
-errno File could not be written, returned value is the reason.

Reimplemented in XrdPosixFile.

Referenced by pgWrite().

◆ pgWrite() [2/2]

virtual void XrdOucCacheIO::pgWrite ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  wrlen,
std::vector< uint32_t > &  csvec,
uint64_t  opts = 0,
int *  csfix = 0 
)
inlinevirtual

Write file pages and checksums using asynchronous I/O (default sync).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to buffer holding the bytes to be written.
offsThe offset where the write is to start.
wrlenThe number of bytes to write.
csvecA vector of that holds the corresponding verified CRC32C checksum for each page or page segment.
optsProcessing options.
csfixWhen not nil, returns the number of corrected checksum errs.

Reimplemented in XrdPosixFile.

References XrdOucCacheIOCB::Done(), and pgWrite().

◆ Preread() [1/2]

virtual void XrdOucCacheIO::Preread ( aprParms Parms)
inlinevirtual

Reimplemented in XrdRmcData.

◆ Preread() [2/2]

virtual void XrdOucCacheIO::Preread ( long long  offs,
int  rlen,
int  opts = 0 
)
inlinevirtual

Reimplemented in XrdRmcData.

◆ Read() [1/2]

virtual int XrdOucCacheIO::Read ( char *  buff,
long long  offs,
int  rlen 
)
pure virtual

Perform an synchronous read.

Parameters
buffpointer to the buffer to receive the results. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
rlenthe number of bytes to read.
Returns
< 0 - Read failed, value is -errno. >=0 - Read succeeded, value is number of bytes read.

Implemented in XrdPfc::IOFile, XrdPosixFile, XrdPfc::IOFileBlock, XrdPosixPrepIO, XrdRmcData, and XrdPfc::IOFileBlock.

Referenced by Read().

◆ Read() [2/2]

virtual void XrdOucCacheIO::Read ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  rlen 
)
inlinevirtual

Perform an asynchronous read (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to the buffer to receive the results. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
rlenthe number of bytes to read.

Reimplemented in XrdPfc::IOFile, XrdPfc::IOFileBlock, XrdPosixPrepIO, and XrdPosixFile.

References XrdOucCacheIOCB::Done(), and Read().

◆ ReadV() [1/2]

virtual int XrdOucCacheIO::ReadV ( const XrdOucIOVec readV,
int  rnum 
)
virtual

Perform an synchronous vector read.

Parameters
readVpointer to a vector of read requests.
rnumthe number of elements in the vector.
Returns
< 0 - ReadV failed, value is -errno. >=0 - ReadV succeeded, value is number of bytes read.

Reimplemented in XrdPosixPrepIO, XrdPfc::IOFile, and XrdPosixFile.

Referenced by ReadV().

◆ ReadV() [2/2]

virtual void XrdOucCacheIO::ReadV ( XrdOucCacheIOCB iocb,
const XrdOucIOVec readV,
int  rnum 
)
inlinevirtual

Perform an asynchronous vector read (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
readVpointer to a vector of read requests.
rnumthe number of elements in the vector.

Reimplemented in XrdPfc::IOFile, XrdPosixFile, and XrdPosixPrepIO.

References XrdOucCacheIOCB::Done(), and ReadV().

◆ Sync() [1/2]

virtual int XrdOucCacheIO::Sync ( )
pure virtual

Perform an synchronous sync() operation.

Returns
<0 - Sync failed, value is -errno. =0 - Sync succeeded.

Implemented in XrdPosixPrepIO, XrdRmcData, XrdPfc::IO, XrdPosixFile, and XrdPfc::IO.

◆ Sync() [2/2]

virtual void XrdOucCacheIO::Sync ( XrdOucCacheIOCB iocb)
inlinevirtual

Perform an asynchronous sync() operation (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.

Reimplemented in XrdPfc::IO, XrdPosixPrepIO, and XrdPosixFile.

References XrdOucCacheIOCB::Done(), and Sync().

Referenced by Sync().

◆ Trunc() [1/2]

virtual int XrdOucCacheIO::Trunc ( long long  offs)
pure virtual

Perform an synchronous trunc() operation.

Parameters
offsthe size the file is have.
Returns
<0 - Trunc failed, value is -errno. =0 - Trunc succeeded.

Implemented in XrdPfc::IO, XrdPosixPrepIO, XrdRmcData, XrdPfc::IO, and XrdPosixFile.

Referenced by Trunc().

◆ Trunc() [2/2]

virtual void XrdOucCacheIO::Trunc ( XrdOucCacheIOCB iocb,
long long  offs 
)
inlinevirtual

Perform an asynchronous trunc() operation (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
offsthe size the file is have.

Reimplemented in XrdPfc::IO.

References XrdOucCacheIOCB::Done(), and Trunc().

◆ Update()

virtual void XrdOucCacheIO::Update ( XrdOucCacheIO iocp)
inlinevirtual

Update the originally passed XrdOucCacheIO object with the object passed. All future uses underlying XrdOucCacheIO object must now use this object. Update() is called when Prepare() indicated that the file should not be physically opened and a file method was invoked in the XrdOucCacheIO passed to Attach(). When this occurs, the file is actually opened and Update() called to replace the original XrdOucCacheIO object with one that uses the newly opened file.

Parameters
iocpreference to the new XrdOucCacheIO object.

Reimplemented in XrdPfc::IO, XrdPfc::IOFile, and XrdPfc::IOFileBlock.

◆ Write() [1/2]

virtual int XrdOucCacheIO::Write ( char *  buff,
long long  offs,
int  wlen 
)
pure virtual

Perform an synchronous write.

Parameters
buffpointer to the buffer holding the contents. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
wlenthe number of bytes to write
Returns
< 0 - Write failed, value is -errno. >=0 - Write succeeded, value is number of bytes written.

Implemented in XrdPosixFile, XrdPfc::IO, XrdPosixPrepIO, XrdRmcData, and XrdPfc::IO.

Referenced by Write().

◆ Write() [2/2]

virtual void XrdOucCacheIO::Write ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  wlen 
)
inlinevirtual

Perform an asynchronous write (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
buffpointer to the buffer holding the contents. The buffer must remain valid until the callback is invoked.
offsthe offset into the file.
wlenthe number of bytes to write

Reimplemented in XrdPfc::IO, XrdPosixPrepIO, and XrdPosixFile.

References XrdOucCacheIOCB::Done(), and Write().

◆ WriteV() [1/2]

virtual int XrdOucCacheIO::WriteV ( const XrdOucIOVec writV,
int  wnum 
)
virtual

Perform an synchronous vector write.

Parameters
writVpointer to a vector of write requests.
wnumthe number of elements in the vector.
Returns
< 0 - WriteV failed, value is -errno. >=0 - WriteV succeeded, value is number of bytes written.

Referenced by WriteV().

◆ WriteV() [2/2]

virtual void XrdOucCacheIO::WriteV ( XrdOucCacheIOCB iocb,
const XrdOucIOVec writV,
int  wnum 
)
inlinevirtual

Perform an asynchronous vector write (defaults to synchronous).

Parameters
iocbreference to the callback object that receives the result. All results are returned via this object's Done() method. If the caller holds any locks they must be recursive locks as the callback may occur on the calling thread.
writVpointer to a vector of read requests.
wnumthe number of elements in the vector.

References XrdOucCacheIOCB::Done(), and WriteV().

Member Data Documentation

◆ forceCS

const uint64_t XrdOucCacheIO::forceCS = 0x0000000000000001ULL
static

Read file pages into a buffer and return corresponding checksums.

Parameters
buffpointer to buffer where the bytes are to be placed.
offsThe offset where the read is to start.
rdlenThe number of bytes to read.
csvecA vector whose entries which will be filled with the corresponding CRC32C checksum for each page or pgae segment. If a zero length vector is returned, checksums are not present.
optsProcessing options: forceCS - always return checksums even when not available.
csfixWhen not nil, returns the number of corrected checksum errs.
Returns
>= 0 The number of bytes placed in buffer.
-errno File could not be read, return value is the reason.

◆ SingleUse

const int XrdOucCacheIO::SingleUse = 0x0001
static

Mark pages for single use.

Perform an asynchronous preread (may be ignored).

Parameters
offsthe offset into the file.
rlenthe number of bytes to preread into the cache.
optsone or more of the options defined below.

The documentation for this class was generated from the following file: