xrootd
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
XrdThrottle::File Class Reference

#include <XrdThrottle.hh>

Inheritance diagram for XrdThrottle::File:
Inheritance graph
[legend]
Collaboration diagram for XrdThrottle::File:
Collaboration graph
[legend]

Public Member Functions

virtual int open (const char *fileName, XrdSfsFileOpenMode openMode, mode_t createMode, const XrdSecEntity *client, const char *opaque=0)
 
virtual int close ()
 
virtual int checkpoint (cpAct act, struct iov *range=0, int n=0)
 
virtual int fctl (const int cmd, const char *args, XrdOucErrInfo &out_error)
 
virtual const char * FName ()
 
virtual int getMmap (void **Addr, off_t &Size)
 
virtual XrdSfsXferSize pgRead (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0)
 
virtual XrdSfsXferSize pgRead (XrdSfsAio *aioparm, uint64_t opts=0)
 
virtual XrdSfsXferSize pgWrite (XrdSfsFileOffset offset, char *buffer, XrdSfsXferSize rdlen, uint32_t *csvec, uint64_t opts=0)
 
virtual XrdSfsXferSize pgWrite (XrdSfsAio *aioparm, uint64_t opts=0)
 
virtual int read (XrdSfsFileOffset fileOffset, XrdSfsXferSize amount)
 
virtual XrdSfsXferSize read (XrdSfsFileOffset fileOffset, char *buffer, XrdSfsXferSize buffer_size)
 
virtual int read (XrdSfsAio *aioparm)
 
virtual XrdSfsXferSize write (XrdSfsFileOffset fileOffset, const char *buffer, XrdSfsXferSize buffer_size)
 
virtual int write (XrdSfsAio *aioparm)
 
virtual int sync ()
 
virtual int sync (XrdSfsAio *aiop)
 
virtual int stat (struct stat *buf)
 
virtual int truncate (XrdSfsFileOffset fileOffset)
 
virtual int getCXinfo (char cxtype[4], int &cxrsz)
 
virtual int SendData (XrdSfsDio *sfDio, XrdSfsFileOffset offset, XrdSfsXferSize size)
 
virtual int fctl (const int cmd, const char *args, XrdOucErrInfo &eInfo)=0
 
virtual int fctl (const int cmd, int alen, const char *args, const XrdSecEntity *client=0)
 
- Public Member Functions inherited from XrdSfsFile
virtual XrdSfsXferSize readv (XrdOucIOVec *readV, int rdvCnt)
 
virtual XrdSfsXferSize writev (XrdOucIOVec *writeV, int wdvCnt)
 
virtual void setXio (XrdSfsXio *xioP)
 
 XrdSfsFile (const char *user=0, int MonID=0)
 
 XrdSfsFile (XrdSfsFile &wrapF)
 
 XrdSfsFile (XrdOucErrInfo &eInfo)
 
virtual ~XrdSfsFile ()
 Destructor.
 

Private Member Functions

 File (const char *, unique_sfs_ptr, XrdThrottleManager &, XrdSysError &)
 
virtual ~File ()
 

Private Attributes

bool m_is_open {false}
 
unique_sfs_ptr m_sfs
 
int m_uid
 
std::string m_loadshed
 
std::string m_connection_id
 
std::string m_user
 
XrdThrottleManagerm_throttle
 
XrdSysErrorm_eroute
 

Friends

class FileSystem
 

Additional Inherited Members

- Public Types inherited from XrdSfsFile
enum  cpAct {
  cpCreate =0 , cpDelete , cpRestore , cpQuery ,
  cpTrunc , cpWrite
}
 
- Public Attributes inherited from XrdSfsFile
XrdOucErrInfoerror
 
- Static Public Attributes inherited from XrdSfsFile
static const uint64_t Verify = 0x8000000000000000ULL
 Options for pgRead() and pgWrite() as noted below.
 

Constructor & Destructor Documentation

◆ File()

XrdThrottle::File::File ( const char *  ,
unique_sfs_ptr  ,
XrdThrottleManager ,
XrdSysError  
)
private

◆ ~File()

virtual XrdThrottle::File::~File ( )
privatevirtual

Member Function Documentation

◆ checkpoint()

virtual int XrdThrottle::File::checkpoint ( cpAct  act,
struct iov range = 0,
int  n = 0 
)
virtual

Reimplemented from XrdSfsFile.

◆ close()

virtual int XrdThrottle::File::close ( )
virtual

Close the file.

Returns
One of SFS_OK or SFS_ERROR.

Implements XrdSfsFile.

◆ fctl() [1/3]

virtual int XrdSfsFile::fctl ( const int  cmd,
const char *  args,
XrdOucErrInfo eInfo 
)
virtual

Execute a special operation on the file (version 1)

Parameters
cmd- The operation to be performed (see below). SFS_FCTL_GETFD Return file descriptor if possible SFS_FCTL_STATV Reserved for future use.
args- specific arguments to cmd SFS_FCTL_GETFD Set to zero.
eInfo- The object where error info or results are to be returned. This is legacy and the error onject may be used as well.
Returns
If an error occurs or the operation is not support, SFS_ERROR should be returned with error.code set to errno. Otherwise, SFS_FCTL_GETFD error.code holds the real file descriptor number If the value is negative, sendfile() is not used. If the value is SFS_SFIO_FDVAL then the SendData() method is used for future read requests.

Implements XrdSfsFile.

◆ fctl() [2/3]

virtual int XrdThrottle::File::fctl ( const int  cmd,
const char *  args,
XrdOucErrInfo eInfo 
)
virtual

Execute a special operation on the file (version 1)

Parameters
cmd- The operation to be performed (see below). SFS_FCTL_GETFD Return file descriptor if possible SFS_FCTL_STATV Reserved for future use.
args- specific arguments to cmd SFS_FCTL_GETFD Set to zero.
eInfo- The object where error info or results are to be returned. This is legacy and the error onject may be used as well.
Returns
If an error occurs or the operation is not support, SFS_ERROR should be returned with error.code set to errno. Otherwise, SFS_FCTL_GETFD error.code holds the real file descriptor number If the value is negative, sendfile() is not used. If the value is SFS_SFIO_FDVAL then the SendData() method is used for future read requests.

Implements XrdSfsFile.

◆ fctl() [3/3]

virtual int XrdSfsFile::fctl ( const int  cmd,
int  alen,
const char *  args,
const XrdSecEntity client = 0 
)
virtual

Execute a special operation on the file (version 2)

Parameters
cmd- The operation to be performed: SFS_FCTL_SPEC1 Perform implementation defined action
alen- Length of data pointed to by args.
args- Data sent with request, zero if alen is zero.
client- Client's identify (see common description).
Returns
SFS_OK a null response is sent.
SFS_DATA error.code length of the data to be sent. error.message contains the data to be sent. o/w one of SFS_ERROR, SFS_REDIRECT, or SFS_STALL.

Reimplemented from XrdSfsFile.

◆ FName()

virtual const char * XrdThrottle::File::FName ( )
virtual

Get the file path.

Returns
Null terminated string of the path used in open().

Implements XrdSfsFile.

◆ getCXinfo()

virtual int XrdThrottle::File::getCXinfo ( char  cxtype[4],
int &  cxrsz 
)
virtual

Get compression information for the file.

Parameters
cxtype- Place where the compression algorithm name is to be placed
cxrsz- Place where the compression page size is to be returned
Returns
One of the valid SFS return codes described above. If the file is not compressed or an error is returned, cxrsz must be set to 0.

Implements XrdSfsFile.

◆ getMmap()

virtual int XrdThrottle::File::getMmap ( void **  Addr,
off_t &  Size 
)
virtual

Get file's memory mapping if one exists (memory mapped files only).

Parameters
Addr- Place where the starting memory address is returned.
Size- Place where the file's size is returned.
Returns
SFS_OK when the file is memory mapped or any other code otherwise.

Implements XrdSfsFile.

◆ open()

virtual int XrdThrottle::File::open ( const char *  fileName,
XrdSfsFileOpenMode  openMode,
mode_t  createMode,
const XrdSecEntity client,
const char *  opaque = 0 
)
virtual

Open a file.

Parameters
fileName- Pointer to the path of the file to be opened.
openMode- Flags indicating how the open is to be handled. SFS_O_CREAT create the file SFS_O_MKPTH Make directory path if missing SFS_O_NOWAIT do not impose operational delays SFS_O_NOTPC do not allow TPC operation SFS_O_POSC persist only on successful close SFS_O_RAWIO allow client-side decompression SFS_O_RDONLY open read/only SFS_O_RDWR open read/write SFS_O_REPLICA Open for replication SFS_O_RESET Reset any cached information SFS_O_TRUNC truncate existing file to zero length SFS_O_WRONLY open write/only
createMode- The file's mode if it will be created.
client- Client's identify (see common description).
opaque- path's CGI information (see common description).
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED

Implements XrdSfsFile.

◆ pgRead() [1/2]

virtual XrdSfsXferSize XrdThrottle::File::pgRead ( XrdSfsAio aioparm,
uint64_t  opts = 0 
)
virtual

Read file pages and checksums using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
opts- Processing options (see above).
Returns
SFS_OK Request accepted and will be scheduled.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented from XrdSfsFile.

◆ pgRead() [2/2]

virtual XrdSfsXferSize XrdThrottle::File::pgRead ( XrdSfsFileOffset  offset,
char *  buffer,
XrdSfsXferSize  rdlen,
uint32_t *  csvec,
uint64_t  opts = 0 
)
virtual

Read file pages into a buffer and return corresponding checksums.

Parameters
offset- The offset where the read is to start. It may be unaligned with certain caveats relative to csvec.
buffer- pointer to buffer where the bytes are to be placed.
rdlen- The number of bytes to read. The amount must be an integral number of XrdSfsPage::Size bytes.
csvec- A vector of entries to be filled with the cooresponding CRC32C checksum for each page. However, if the offset is unaligned, then csvec[0] contains the crc for the page fragment that brings it to alignment for csvec[1]. It must be sized to hold all aligned XrdSys::Pagesize crc's plus additional ones for leading and ending page fragments, if any.
opts- Processing options (see above).
Returns
>= 0 The number of bytes that placed in buffer.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented from XrdSfsFile.

◆ pgWrite() [1/2]

virtual XrdSfsXferSize XrdThrottle::File::pgWrite ( XrdSfsAio aioparm,
uint64_t  opts = 0 
)
virtual

Write file pages and checksums using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
opts- Processing options (see above).
Returns
SFS_OK Request accepted and will be scheduled.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented from XrdSfsFile.

◆ pgWrite() [2/2]

virtual XrdSfsXferSize XrdThrottle::File::pgWrite ( XrdSfsFileOffset  offset,
char *  buffer,
XrdSfsXferSize  wrlen,
uint32_t *  csvec,
uint64_t  opts = 0 
)
virtual

Write file pages into a file with corresponding checksums.

Parameters
offset- The offset where the write is to start. It may be unaligned with certain caveats relative to csvec.
buffer- pointer to buffer containing the bytes to write.
wrlen- The number of bytes to write. If amount is not an integral number of XrdSys::PageSize bytes, then this must be the last write to the file at or above the offset.
csvec- A vector which contains the corresponding CRC32 checksum for each page or page fragment. If offset is unaligned then csvec[0] is the crc of the leading fragment to align the subsequent full page who's crc is in csvec[1]. It must be sized to hold all aligned XrdSys::Pagesize crc's plus additional ones for leading and ending page fragments, if any.
opts- Processing options (see above).
Returns
>= 0 The number of bytes written.
SFS_ERROR File could not be read, error holds the reason.

Reimplemented from XrdSfsFile.

◆ read() [1/3]

virtual int XrdThrottle::File::read ( XrdSfsAio aioparm)
virtual

Read file bytes using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
Returns
SFS_OK Request accepted and will be scheduled.
SFS_ERROR File could not be read, error holds the reason.

Implements XrdSfsFile.

◆ read() [2/3]

virtual XrdSfsXferSize XrdThrottle::File::read ( XrdSfsFileOffset  offset,
char *  buffer,
XrdSfsXferSize  size 
)
virtual

Read file bytes into a buffer.

Parameters
offset- The offset where the read is to start.
buffer- pointer to buffer where the bytes are to be placed.
size- The number of bytes to read.
Returns
>= 0 The number of bytes that placed in buffer.
SFS_ERROR File could not be read, error holds the reason.

Implements XrdSfsFile.

◆ read() [3/3]

virtual int XrdThrottle::File::read ( XrdSfsFileOffset  offset,
XrdSfsXferSize  size 
)
virtual

Preread file blocks into the file system cache.

Parameters
offset- The offset where the read is to start.
size- The number of bytes to pre-read.
Returns
>= 0 The number of bytes that will be pre-read.
SFS_ERROR File could not be preread, error holds the reason.

Implements XrdSfsFile.

◆ SendData()

virtual int XrdThrottle::File::SendData ( XrdSfsDio sfDio,
XrdSfsFileOffset  offset,
XrdSfsXferSize  size 
)
virtual

Send file bytes via a XrdSfsDio sendfile object to a client (optional).

Parameters
sfDio- Pointer to the sendfile object for data transfer.
offset- The offset where the read is to start.
size- The number of bytes to read and send.
Returns
SFS_ERROR File not read, error object has reason.
SFS_OK Either data has been successfully sent via sfDio or no data has been sent and a normal read() should be issued.

Reimplemented from XrdSfsFile.

◆ stat()

virtual int XrdThrottle::File::stat ( struct stat *  buf)
virtual

Return state information on the file.

Parameters
buf- Pointer to the structure where info it to be returned.
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL. When SFS_OK is returned, buf must hold stat information.

Implements XrdSfsFile.

◆ sync() [1/2]

virtual int XrdThrottle::File::sync ( )
virtual

Make sure all outstanding data is actually written to the file (sync).

Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, SFS_STALL, or SFS_STARTED

Implements XrdSfsFile.

◆ sync() [2/2]

virtual int XrdThrottle::File::sync ( XrdSfsAio aiop)
virtual

Make sure all outstanding data is actually written to the file (async).

Returns
SFS_OK Request accepted and will be scheduled.
SFS_ERROR Request could not be accepted, return error has reason.

Implements XrdSfsFile.

◆ truncate()

virtual int XrdThrottle::File::truncate ( XrdSfsFileOffset  fsize)
virtual

Truncate the file.

Parameters
fsize- The size that the file is to have.
Returns
One of SFS_OK, SFS_ERROR, SFS_REDIRECT, or SFS_STALL

Implements XrdSfsFile.

◆ write() [1/2]

virtual int XrdThrottle::File::write ( XrdSfsAio aioparm)
virtual

Write file bytes using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
Returns
0 Request accepted and will be scheduled.
!0 Request not accepted, returned value is errno.

Implements XrdSfsFile.

◆ write() [2/2]

virtual XrdSfsXferSize XrdThrottle::File::write ( XrdSfsFileOffset  offset,
const char *  buffer,
XrdSfsXferSize  size 
)
virtual

Write file bytes from a buffer.

Parameters
offset- The offset where the write is to start.
buffer- pointer to buffer where the bytes reside.
size- The number of bytes to write.
Returns
>= 0 The number of bytes that were written.
SFS_ERROR File could not be written, error holds the reason.

Implements XrdSfsFile.

Friends And Related Symbol Documentation

◆ FileSystem

friend class FileSystem
friend

Member Data Documentation

◆ m_connection_id

std::string XrdThrottle::File::m_connection_id
private

◆ m_eroute

XrdSysError& XrdThrottle::File::m_eroute
private

◆ m_is_open

bool XrdThrottle::File::m_is_open {false}
private

◆ m_loadshed

std::string XrdThrottle::File::m_loadshed
private

◆ m_sfs

unique_sfs_ptr XrdThrottle::File::m_sfs
private

◆ m_throttle

XrdThrottleManager& XrdThrottle::File::m_throttle
private

◆ m_uid

int XrdThrottle::File::m_uid
private

◆ m_user

std::string XrdThrottle::File::m_user
private

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