xrootd
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
XrdPfc::IOFile Class Reference

Downloads original file into a single file on local disk. Handles read requests as they come along. More...

#include <XrdPfcIOFile.hh>

Inheritance diagram for XrdPfc::IOFile:
Inheritance graph
[legend]
Collaboration diagram for XrdPfc::IOFile:
Collaboration graph
[legend]

Public Member Functions

 IOFile (XrdOucCacheIO *io, Cache &cache)
 
 ~IOFile ()
 
bool HasFile () const
 Check if File was opened successfully.
 
int Read (char *buff, long long off, int size) override
 Pass Read request to the corresponding File object.
 
void Read (XrdOucCacheIOCB &iocb, char *buff, long long off, int size) override
 
void pgRead (XrdOucCacheIOCB &iocb, char *buff, long long off, int size, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0) override
 
int ReadV (const XrdOucIOVec *readV, int n) override
 Pass ReadV request to the corresponding File object.
 
void ReadV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int n) override
 
void Update (XrdOucCacheIO &iocp) override
 
bool ioActive () override
 Abstract virtual method of XrdPfc::IO Called to check if destruction needs to be done in a separate task.
 
void DetachFinalize () override
 Abstract virtual method of XrdPfc::IO Called to destruct the IO object after it is no longer used.
 
int Fstat (struct stat &sbuff) override
 
long long FSize () override
 
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)
 
- Public Member Functions inherited from XrdPfc::IO
 IO (XrdOucCacheIO *io, Cache &cache)
 
virtual XrdOucCacheIOBase ()
 Original data source.
 
const char * Path () override
 Original data source URL.
 
int Sync () override
 
int Trunc (long long Offset) override
 
int Write (char *Buffer, long long Offset, int Length) override
 
bool Detach (XrdOucCacheIOCD &iocdP) final
 
const char * GetLocation ()
 
XrdSysTraceGetTrace ()
 
XrdOucCacheIOGetInput ()
 
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 int Write (char *buff, long long offs, int wlen)=0
 
virtual void Write (XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
 
- Public Member Functions inherited from XrdOucCacheIO
virtual const char * Location (bool refresh=false)
 
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 WriteV (const XrdOucIOVec *writV, int wnum)
 
virtual void WriteV (XrdOucCacheIOCB &iocb, const XrdOucIOVec *writV, int wnum)
 
 XrdOucCacheIO ()
 Construct and Destructor.
 

Private Member Functions

int ReadBegin (char *buff, long long off, int size, ReadReqRH *rh)
 
int ReadEnd (int retval, ReadReqRH *rh)
 
int ReadVBegin (const XrdOucIOVec *readV, int n, ReadReqRH *rh)
 
int ReadVEnd (int retval, ReadReqRH *rh)
 
int initCachedStat ()
 

Private Attributes

Filem_file
 
struct statm_localStat
 

Additional Inherited Members

- Static Public Attributes inherited from XrdOucCacheIO
static const uint64_t forceCS = 0x0000000000000001ULL
 
static const int SingleUse = 0x0001
 Mark pages for single use.
 
- Protected Member Functions inherited from XrdPfc::IO
const char * GetPath ()
 
std::string GetFilename ()
 
const char * RefreshLocation ()
 
unsigned short ObtainReadSid ()
 
- Protected Member Functions inherited from XrdOucCacheIO
virtual ~XrdOucCacheIO ()
 
- Protected Attributes inherited from XrdPfc::IO
Cachem_cache
 reference to Cache object
 
const char * m_traceID
 
RAtomic_int m_active_read_reqs
 number of active read requests
 

Detailed Description

Downloads original file into a single file on local disk. Handles read requests as they come along.

Constructor & Destructor Documentation

◆ IOFile()

XrdPfc::IOFile::IOFile ( XrdOucCacheIO io,
Cache cache 
)

◆ ~IOFile()

XrdPfc::IOFile::~IOFile ( )

Member Function Documentation

◆ DetachFinalize()

void XrdPfc::IOFile::DetachFinalize ( )
overridevirtual

Abstract virtual method of XrdPfc::IO Called to destruct the IO object after it is no longer used.

Implements XrdPfc::IO.

◆ FSize()

long long XrdPfc::IOFile::FSize ( )
overridevirtual

Obtain size of the file.

Returns
Size of the file in bytes.

Implements XrdOucCacheIO.

◆ Fstat()

int XrdPfc::IOFile::Fstat ( struct stat sbuff)
overridevirtual

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 from XrdOucCacheIO.

◆ HasFile()

bool XrdPfc::IOFile::HasFile ( ) const
inline

Check if File was opened successfully.

References m_file.

◆ initCachedStat()

int XrdPfc::IOFile::initCachedStat ( )
private

◆ ioActive()

bool XrdPfc::IOFile::ioActive ( )
overridevirtual

Abstract virtual method of XrdPfc::IO Called to check if destruction needs to be done in a separate task.

Implements XrdPfc::IO.

◆ pgRead() [1/3]

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 from XrdOucCacheIO.

◆ pgRead() [2/3]

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

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 from XrdOucCacheIO.

◆ pgRead() [3/3]

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 from XrdOucCacheIO.

◆ Read() [1/2]

int XrdPfc::IOFile::Read ( char *  buff,
long long  off,
int  size 
)
overridevirtual

Pass Read request to the corresponding File object.

Implements XrdOucCacheIO.

◆ Read() [2/2]

void XrdPfc::IOFile::Read ( XrdOucCacheIOCB iocb,
char *  buff,
long long  offs,
int  rlen 
)
overridevirtual

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 from XrdOucCacheIO.

◆ ReadBegin()

int XrdPfc::IOFile::ReadBegin ( char *  buff,
long long  off,
int  size,
ReadReqRH rh 
)
private

◆ ReadEnd()

int XrdPfc::IOFile::ReadEnd ( int  retval,
ReadReqRH rh 
)
private

◆ ReadV() [1/2]

int XrdPfc::IOFile::ReadV ( const XrdOucIOVec readV,
int  n 
)
overridevirtual

Pass ReadV request to the corresponding File object.

Reimplemented from XrdOucCacheIO.

◆ ReadV() [2/2]

void XrdPfc::IOFile::ReadV ( XrdOucCacheIOCB iocb,
const XrdOucIOVec readV,
int  rnum 
)
overridevirtual

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 from XrdOucCacheIO.

◆ ReadVBegin()

int XrdPfc::IOFile::ReadVBegin ( const XrdOucIOVec readV,
int  n,
ReadReqRH rh 
)
private

◆ ReadVEnd()

int XrdPfc::IOFile::ReadVEnd ( int  retval,
ReadReqRH rh 
)
private

◆ Update()

void XrdPfc::IOFile::Update ( XrdOucCacheIO iocp)
overridevirtual

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 from XrdPfc::IO.

Member Data Documentation

◆ m_file

File* XrdPfc::IOFile::m_file
private

Referenced by HasFile().

◆ m_localStat

struct stat* XrdPfc::IOFile::m_localStat
private

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