ewmscp  ..
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
inputHandler::base::reader Class Referenceabstract

(abstract) class for reading a file An instance of this class is used to read data from a file vie the readBlock function. More...

#include <inputHandler.h>

Inheritance diagram for inputHandler::base::reader:
[legend]
Collaboration diagram for inputHandler::base::reader:
[legend]

Public Member Functions

virtual ~reader () noexcept(false)=default
 
virtual bool setupSparseRegions (const std::string &)
 set up internal list of data and hole regions, normally does nothing More...
 
virtual bool readBlock (block &b)=0
 read one block from the file More...
 
virtual void readBlockP (block &, size_t, off_t)
 read one block from the file, starting at offset. More...
 
virtual void checkUnchangedness ()=0
 check if the file is unchanged by comparing cuttent stat to initial stat More...
 
virtual void seek (size_t)
 like the standard seek, to be used only when appending new data to a file More...
 
- Public Member Functions inherited from ioHandle
 ioHandle ()
 
virtual ~ioHandle () noexcept(false)
 
virtual bool parallelizable () const
 tell if this handler is capable of parallel IO. Unsually not the case More...
 
virtual void setXattr (const std::string &, const std::string &)
 
virtual std::string getXattr (const std::string &)
 get one extended attribute value More...
 
virtual void removeXattr (const std::string &)
 
virtual size_t getBlockSize () const
 
virtual void setBlockSize (size_t newSize)
 
virtual std::unique_ptr< const genericStatgetStat ()=0
 
virtual std::unique_ptr< attrDataTypegetAttrData (const outputHandler::base *)
 get attributes in the optimal way for setting with aOutputHandler More...
 
virtual std::unique_ptr< acl::listgetAclData ()
 get acls More...
 

Protected Member Functions

 reader (const genericStat &inititalStat)
 
- Protected Member Functions inherited from unwindCheck
 unwindCheck ()=default
 
 ~unwindCheck ()=default
 
bool isUnwinding () const
 
- Protected Member Functions inherited from ioHandle
 ioHandle ()
 
virtual ~ioHandle () noexcept(false)
 
virtual bool parallelizable () const
 tell if this handler is capable of parallel IO. Unsually not the case More...
 
virtual void setXattr (const std::string &, const std::string &)
 
virtual std::string getXattr (const std::string &)
 get one extended attribute value More...
 
virtual void removeXattr (const std::string &)
 
virtual size_t getBlockSize () const
 
virtual void setBlockSize (size_t newSize)
 
virtual std::unique_ptr< const genericStatgetStat ()=0
 
virtual std::unique_ptr< attrDataTypegetAttrData (const outputHandler::base *)
 get attributes in the optimal way for setting with aOutputHandler More...
 
virtual std::unique_ptr< acl::listgetAclData ()
 get acls More...
 

Protected Attributes

const genericStatreadInitialStat
 stat at beginning, needed for unchngedness check More...
 
std::remove_const< decltype(readInitialStat.size)>::type totalBytesRead = 0
 number of bytes read so far, needed for check on growing files More...
 
- Protected Attributes inherited from ioHandle
size_t blockSize
 in bytes, block size to be used when reading or writing More...
 

Detailed Description

(abstract) class for reading a file An instance of this class is used to read data from a file vie the readBlock function.

Definition at line 72 of file inputHandler.h.

Constructor & Destructor Documentation

◆ reader()

inputHandler::base::reader::reader ( const genericStat inititalStat)
inlineprotected

Definition at line 76 of file inputHandler.h.

76 : readInitialStat(inititalStat) {};

◆ ~reader()

virtual inputHandler::base::reader::~reader ( )
virtualdefaultnoexcept
Exceptions
std::system_errorif close fails, e.g. data can't be written

Member Function Documentation

◆ checkUnchangedness()

virtual void inputHandler::base::reader::checkUnchangedness ( )
pure virtual

check if the file is unchanged by comparing cuttent stat to initial stat

Exceptions
delayAdvisingErrorif file has changed according to size of mtime
std::system_errorif stat fails

Implemented in inputHandler::posixFile::readerPosixFile, and inputHandler::dummy::readerDummy.

◆ readBlock()

virtual bool inputHandler::base::reader::readBlock ( block b)
pure virtual

read one block from the file

Returns
true if the last block was read, false if more to follow
Exceptions
std::system_errorif read fails
delayAdvisingErrorif file changes during reading

Implemented in inputHandler::posixFile::readerPosixFile, inputHandler::dummy::readerDummy, and inputHandler::Gpfs::readerGpfs.

Referenced by copyRequest::base::doUnthreadedCopy(), and copyRequest::base::reader().

Here is the caller graph for this function:

◆ readBlockP()

virtual void inputHandler::base::reader::readBlockP ( block ,
size_t  ,
off_t   
)
inlinevirtual

read one block from the file, starting at offset.

meant for pparallel reading, often not implemented only for non-sparse files

Exceptions
std::system_errorif read fails
delayAdvisingErrorif file changes during reading
std::logic_errorif attempted on sparse file

Reimplemented in inputHandler::posixFile::readerPosixFile, inputHandler::dummy::readerDummy, and inputHandler::Gpfs::readerGpfs.

Definition at line 100 of file inputHandler.h.

100  {
101  throw unimplementedActionError("parallel reading not implemented");
102  }

Referenced by copyRequest::base::readWorker().

Here is the caller graph for this function:

◆ seek()

virtual void inputHandler::base::reader::seek ( size_t  )
inlinevirtual

like the standard seek, to be used only when appending new data to a file

Exceptions
std::system_errorif seek fails
unimplementedActionErrorif seek is not implemented (most input handlers)

Reimplemented in inputHandler::posixFile::readerPosixFile.

Definition at line 112 of file inputHandler.h.

113  {
114  throw unimplementedActionError("seek not implemented");
115  };

◆ setupSparseRegions()

virtual bool inputHandler::base::reader::setupSparseRegions ( const std::string &  )
inlinevirtual

set up internal list of data and hole regions, normally does nothing

Returns
true if sparse handling will happen, false otherwise

Reimplemented in inputHandler::posixFile::readerPosixFile.

Definition at line 83 of file inputHandler.h.

83  {
84  return false;
85  };

Member Data Documentation

◆ readInitialStat

const genericStat& inputHandler::base::reader::readInitialStat
protected

stat at beginning, needed for unchngedness check

Definition at line 74 of file inputHandler.h.

Referenced by inputHandler::posixFile::readerPosixFile::readerPosixFile().

◆ totalBytesRead

std::remove_const<decltype(readInitialStat.size)>::type inputHandler::base::reader::totalBytesRead = 0
protected

number of bytes read so far, needed for check on growing files

Definition at line 75 of file inputHandler.h.


The documentation for this class was generated from the following file:
unimplementedActionError
class for exceptions that result from unimplemented functions Exceptions of this kind are to be throw...
Definition: copyRequestTypes.h:32
inputHandler::base::reader::readInitialStat
const genericStat & readInitialStat
stat at beginning, needed for unchngedness check
Definition: inputHandler.h:74