A binlog cache implementation based on IO_CACHE.
More...
#include <binlog_ostream.h>
A binlog cache implementation based on IO_CACHE.
◆ IO_CACHE_binlog_cache_storage() [1/2]
IO_CACHE_binlog_cache_storage::IO_CACHE_binlog_cache_storage |
( |
| ) |
|
|
default |
◆ IO_CACHE_binlog_cache_storage() [2/2]
◆ ~IO_CACHE_binlog_cache_storage()
IO_CACHE_binlog_cache_storage::~IO_CACHE_binlog_cache_storage |
( |
| ) |
|
|
override |
◆ begin()
bool IO_CACHE_binlog_cache_storage::begin |
( |
unsigned char ** |
buffer, |
|
|
my_off_t * |
length |
|
) |
| |
Initializes binlog cache for reading and returns the data at the begin.
buffer is controlled by binlog cache implementation, so caller should not release it. If the function sets *length to 0 and no error happens, it has reached the end of the cache.
- Parameters
-
[out] | buffer | It points to buffer where data is read. |
[out] | length | Length of the data in the buffer. |
- Return values
-
◆ close()
void IO_CACHE_binlog_cache_storage::close |
( |
| ) |
|
◆ disable_encryption()
void IO_CACHE_binlog_cache_storage::disable_encryption |
( |
| ) |
|
|
private |
Disable IO Cache temporary file encryption.
◆ disk_writes()
size_t IO_CACHE_binlog_cache_storage::disk_writes |
( |
| ) |
const |
Returns the count of calling temporary file's write()
◆ enable_encryption()
bool IO_CACHE_binlog_cache_storage::enable_encryption |
( |
| ) |
|
|
private |
Enable IO Cache temporary file encryption.
- Return values
-
◆ flush()
bool IO_CACHE_binlog_cache_storage::flush |
( |
| ) |
|
|
inlineoverridevirtual |
◆ length()
my_off_t IO_CACHE_binlog_cache_storage::length |
( |
| ) |
const |
◆ next()
bool IO_CACHE_binlog_cache_storage::next |
( |
unsigned char ** |
buffer, |
|
|
my_off_t * |
length |
|
) |
| |
Returns next piece of data.
buffer is controlled by binlog cache implementation, so caller should not release it. If the function sets length to 0 and no error happens, it has reached the end of the cache.
- Parameters
-
[out] | buffer | It points to buffer where data is read. |
[out] | length | Length of the data in the buffer. |
- Return values
-
◆ open()
bool IO_CACHE_binlog_cache_storage::open |
( |
const char * |
dir, |
|
|
const char * |
prefix, |
|
|
my_off_t |
cache_size, |
|
|
my_off_t |
max_cache_size |
|
) |
| |
Opens the binlog cache.
It creates a memory buffer as long as cache_size. The buffer will be extended up to max_cache_size when writing data. The data exceeding max_cache_size will be written into a temporary file.
- Parameters
-
[in] | dir | Where the temporary file will be created |
[in] | prefix | Prefix of the temporary file name |
[in] | cache_size | Size of the memory buffer. |
[in] | max_cache_size | Maximum size of the memory buffer |
- Return values
-
◆ operator=()
◆ reset()
bool IO_CACHE_binlog_cache_storage::reset |
( |
| ) |
|
Reset status and drop all data.
It looks like a cache never was used after reset.
◆ seek()
bool IO_CACHE_binlog_cache_storage::seek |
( |
my_off_t |
offset | ) |
|
|
inlineoverridevirtual |
Put the write position to a given offset.
The offset counts from the beginning of the file.
- Parameters
-
[in] | offset | Where the write position will be |
- Return values
-
Implements Truncatable_ostream.
◆ setup_ciphers_password()
bool IO_CACHE_binlog_cache_storage::setup_ciphers_password |
( |
| ) |
|
|
private |
Generate a new password for the temporary file encryption.
This function is called by reset() that is called every time a transaction commits to cleanup the binary log cache. The file password shall vary not only per temporary file, but also per transaction being committed within a single client connection.
- Return values
-
◆ sync()
bool IO_CACHE_binlog_cache_storage::sync |
( |
| ) |
|
|
inlineoverridevirtual |
◆ tmp_file_name()
const char * IO_CACHE_binlog_cache_storage::tmp_file_name |
( |
| ) |
const |
Returns the file name if a temporary file is opened, otherwise nullptr is returned.
◆ truncate()
bool IO_CACHE_binlog_cache_storage::truncate |
( |
my_off_t |
offset | ) |
|
|
overridevirtual |
Truncate some data at the end of the output stream.
- Parameters
-
[in] | offset | Where the output stream will be truncated to. |
- Return values
-
Implements Truncatable_ostream.
◆ write()
bool IO_CACHE_binlog_cache_storage::write |
( |
const unsigned char * |
buffer, |
|
|
my_off_t |
length |
|
) |
| |
|
overridevirtual |
Write some bytes into the output stream.
When all data is written into the stream successfully, then it return false. Otherwise, true is returned. It will never returns false when partial data is written into the stream.
- Parameters
-
[in] | buffer | Data to be written |
[in] | length | Length of the data |
- Return values
-
Implements Basic_ostream.
◆ m_io_cache
IO_CACHE IO_CACHE_binlog_cache_storage::m_io_cache |
|
private |
◆ m_max_cache_size
my_off_t IO_CACHE_binlog_cache_storage::m_max_cache_size = 0 |
|
private |
The documentation for this class was generated from the following files: