MySQL 8.4.2
Source Code Documentation
|
Helper class for doing synchronous file IO. More...
#include <os0file.h>
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... | |
dberr_t | execute_with_retry (const IORequest &request, const size_t max_retries=NUM_RETRIES_ON_PARTIAL_IO) |
Do the read/write with retry. 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... | |
const size_t | m_orig_bytes |
The total number of bytes to be read/written. More... | |
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.
|
inline |
Constructor.
[in] | fh | File handle |
[in,out] | buf | Buffer to read/write |
[in] | n | Number of bytes to read/write |
[in] | offset | Offset where to read or write |
|
default |
Destructor.
|
inline |
Move the read/write offset up to where the partial IO succeeded.
[in] | n_bytes | The number of bytes to advance |
ssize_t SyncFileIO::execute | ( | const IORequest & | request | ) |
Do the read/write.
[in] | request | The IO context and type |
dberr_t SyncFileIO::execute_with_retry | ( | const IORequest & | request, |
const size_t | max_retries = NUM_RETRIES_ON_PARTIAL_IO |
||
) |
Do the read/write with retry.
[in] | request | The IO context and type |
[in] | max_retries | the maximum number of retries on partial i/o. |
|
private |
Buffer to read/write.
|
private |
Open file handle.
|
private |
Number of bytes to read/write.
|
private |
Offset from where to read/write.
|
private |
The total number of bytes to be read/written.