MySQL 8.0.41
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SyncFileIO Class Reference

Helper class for doing synchronous file IO. More...

Public Member Functions

 SyncFileIO (os_file_t fh, void *buf, ulint n, os_offset_t offset)
 Constructor. More...
 
 ~SyncFileIO ()=default
 Destructor. More...
 
ssize_t execute (const IORequest &request)
 Do the read/write. More...
 
void advance (ssize_t n_bytes)
 Move the read/write offset up to where the partial IO succeeded. More...
 

Private Attributes

os_file_t m_fh
 Open file handle. More...
 
void * m_buf
 Buffer to read/write. More...
 
ssize_t m_n
 Number of bytes to read/write. More...
 
os_offset_t m_offset
 Offset from where to read/write. More...
 

Detailed Description

Helper class for doing synchronous file IO.

Currently, the objective is to hide the OS specific code, so that the higher level functions aren't peppered with "#ifdef". Makes the code flow difficult to follow.

Constructor & Destructor Documentation

◆ SyncFileIO()

SyncFileIO::SyncFileIO ( os_file_t  fh,
void *  buf,
ulint  n,
os_offset_t  offset 
)
inline

Constructor.

Parameters
[in]fhFile handle
[in,out]bufBuffer to read/write
[in]nNumber of bytes to read/write
[in]offsetOffset where to read or write

◆ ~SyncFileIO()

SyncFileIO::~SyncFileIO ( )
default

Destructor.

Member Function Documentation

◆ advance()

void SyncFileIO::advance ( ssize_t  n_bytes)
inline

Move the read/write offset up to where the partial IO succeeded.

Parameters
[in]n_bytesThe number of bytes to advance

◆ execute()

ssize_t SyncFileIO::execute ( const IORequest request)

Do the read/write.

Parameters
[in]requestThe IO context and type
Returns
the number of bytes read/written or negative value on error

Member Data Documentation

◆ m_buf

void* SyncFileIO::m_buf
private

Buffer to read/write.

◆ m_fh

os_file_t SyncFileIO::m_fh
private

Open file handle.

◆ m_n

ssize_t SyncFileIO::m_n
private

Number of bytes to read/write.

◆ m_offset

os_offset_t SyncFileIO::m_offset
private

Offset from where to read/write.


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