xrootd
Public Member Functions | Private Attributes | List of all members
XrdCl::File Class Reference

A file. More...

#include <XrdClFile.hh>

Public Member Functions

 File ()
 Constructor. More...
 
virtual ~File ()
 Destructor. More...
 
XRootDStatus Open (const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Open (const std::string &url, OpenFlags::Flags flags, Access::Mode mode=Access::None, uint16_t timeout=0)
 
XRootDStatus Close (ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Close (uint16_t timeout=0)
 
XRootDStatus Stat (bool force, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Stat (bool force, StatInfo *&response, uint16_t timeout=0)
 
XRootDStatus Read (uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Read (uint64_t offset, uint32_t size, void *buffer, uint32_t &bytesRead, uint16_t timeout=0)
 
XRootDStatus Write (uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Write (uint64_t offset, uint32_t size, const void *buffer, uint16_t timeout=0)
 
XRootDStatus Sync (ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Sync (uint16_t timeout=0)
 
XRootDStatus Truncate (uint64_t size, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus Truncate (uint64_t size, uint16_t timeout=0)
 
XRootDStatus VectorRead (const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
 
XRootDStatus VectorRead (const ChunkList &chunks, void *buffer, VectorReadInfo *&vReadInfo, uint16_t timeout=0)
 
bool IsOpen () const
 Check if the file is open. More...
 
void EnableReadRecovery (bool enable=true)
 
void EnableWriteRecovery (bool enable=true)
 
std::string GetDataServer () const
 Get the data server the file is accessed at. More...
 
URL GetLastURL () const
 Get final url with all the cgi information. More...
 

Private Attributes

FileStateHandler * pStateHandler
 

Detailed Description

A file.

Constructor & Destructor Documentation

XrdCl::File::File ( )

Constructor.

virtual XrdCl::File::~File ( )
virtual

Destructor.

Member Function Documentation

XRootDStatus XrdCl::File::Close ( ResponseHandler handler,
uint16_t  timeout = 0 
)

Close the file - async

Parameters
handlerhandler to be notified about the status of the operation
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Close ( uint16_t  timeout = 0)

Close the file - sync

Parameters
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
void XrdCl::File::EnableReadRecovery ( bool  enable = true)

Enable/disable state recovery procedures while the file is open for reading

void XrdCl::File::EnableWriteRecovery ( bool  enable = true)

Enable/disable state recovery procedures while the file is open for writing or read/write

std::string XrdCl::File::GetDataServer ( ) const

Get the data server the file is accessed at.

URL XrdCl::File::GetLastURL ( ) const

Get final url with all the cgi information.

bool XrdCl::File::IsOpen ( ) const

Check if the file is open.

XRootDStatus XrdCl::File::Open ( const std::string &  url,
OpenFlags::Flags  flags,
Access::Mode  mode,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Open the file pointed to by the given URL - async

Parameters
urlurl of the file to be opened
flagsOpenFlags::Flags
modeAccess::Mode for new files, 0 otherwise
handlerhandler to be notified about the status of the operation
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Open ( const std::string &  url,
OpenFlags::Flags  flags,
Access::Mode  mode = Access::None,
uint16_t  timeout = 0 
)

Open the file pointed to by the given URL - sync

Parameters
urlurl of the file to be opened
flagsOpenFlags::Flags
modeAccess::Mode for new files, 0 otherwise
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Read ( uint64_t  offset,
uint32_t  size,
void *  buffer,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Read a data chunk at a given offset - async

Parameters
offsetoffset from the beginning of the file
sizenumber of bytes to be read
buffera pointer to a buffer big enough to hold the data or 0 if the buffer should be allocated by the system
handlerhandler to be notified when the response arrives, the response parameter will hold a ChunkInfo object if the procedure was successful
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Read ( uint64_t  offset,
uint32_t  size,
void *  buffer,
uint32_t &  bytesRead,
uint16_t  timeout = 0 
)

Read a data chunk at a given offset - sync

Parameters
offsetoffset from the beginning of the file
sizenumber of bytes to be read
buffera pointer to a buffer big enough to hold the data
bytesReadnumber of bytes actually read
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Stat ( bool  force,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Obtain status information for this file - async

Parameters
forcedo not use the cached information, force re-stating
handlerhandler to be notified when the response arrives, the response parameter will hold a StatInfo object if the procedure is successful
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Stat ( bool  force,
StatInfo *&  response,
uint16_t  timeout = 0 
)

Obtain status information for this file - sync

Parameters
forcedo not use the cached information, force re-stating
responsethe response (to be deleted by the user)
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Sync ( ResponseHandler handler,
uint16_t  timeout = 0 
)

Commit all pending disk writes - async

Parameters
handlerhandler to be notified when the response arrives
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Sync ( uint16_t  timeout = 0)

Commit all pending disk writes - sync

Parameters
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Truncate ( uint64_t  size,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Truncate the file to a particular size - async

Parameters
sizedesired size of the file
handlerhandler to be notified when the response arrives
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Truncate ( uint64_t  size,
uint16_t  timeout = 0 
)

Truncate the file to a particular size - sync

Parameters
sizedesired size of the file
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::VectorRead ( const ChunkList chunks,
void *  buffer,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Read scattered data chunks in one operation - async

Parameters
chunkslist of the chunks to be read and buffers to put the data in. The default maximum chunk size is 2097136 bytes and the default maximum number of chunks per request is 1024. The server may be queried using FileSystem::Query for the actual settings.
bufferif zero the buffer pointers in the chunk list will be used, otherwise it needs to point to a buffer big enough to hold the requested data
handlerhandler to be notified when the response arrives
timeouttimeout value, if 0 then the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::VectorRead ( const ChunkList chunks,
void *  buffer,
VectorReadInfo *&  vReadInfo,
uint16_t  timeout = 0 
)

Read scattered data chunks in one operation - sync

Parameters
chunkslist of the chunks to be read and buffers to put the data in. The default maximum chunk size is 2097136 bytes and the default maximum number of chunks per request is 1024. The server may be queried using FileSystem::Query for the actual settings.
bufferif zero the buffer pointers in the chunk list will be used, otherwise it needs to point to a buffer big enough to hold the requested data
vReadInfobuffer size and chunk information
timeouttimeout value, if 0 then the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Write ( uint64_t  offset,
uint32_t  size,
const void *  buffer,
ResponseHandler handler,
uint16_t  timeout = 0 
)

Write a data chunk at a given offset - async The call interprets and returns the server response, which may be either a success or a failure, it does not contain the number of bytes that were actually written.

Parameters
offsetoffset from the beginning of the file
sizenumber of bytes to be written
buffera pointer to the buffer holding the data to be written
handlerhandler to be notified when the response arrives
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation
XRootDStatus XrdCl::File::Write ( uint64_t  offset,
uint32_t  size,
const void *  buffer,
uint16_t  timeout = 0 
)

Write a data chunk at a given offset - sync The call interprets and returns the server response, which may be either a success or a failure, it does not contain the number of bytes that were actually written.

Parameters
offsetoffset from the beginning of the file
sizenumber of bytes to be written
buffera pointer to the buffer holding the data to be written
timeouttimeout value, if 0 the environment default will be used
Returns
status of the operation

Member Data Documentation

FileStateHandler* XrdCl::File::pStateHandler
private

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