MySQL 8.0.40
Source Code Documentation
|
Byte container that provides a storage for serializing session binlog events. More...
#include <binlog_ostream.h>
Public Member Functions | |
~Binlog_cache_storage () override | |
bool | open (my_off_t cache_size, my_off_t max_cache_size) |
void | close () |
bool | write (const unsigned char *buffer, my_off_t length) override |
Write some bytes into the output stream. More... | |
bool | truncate (my_off_t offset) |
Truncates some data at the end of the binlog cache. More... | |
bool | reset () |
Reset status and drop all data. More... | |
size_t | disk_writes () const |
Returns the count of disk writes. More... | |
const char * | tmp_file_name () const |
Returns the name of the temporary file. More... | |
bool | copy_to (Basic_ostream *ostream, bool *ostream_error=nullptr) |
Copy all data to a output stream. More... | |
my_off_t | length () const |
Returns data length. More... | |
bool | is_empty () const |
Returns true if binlog cache is empty. More... | |
Public Member Functions inherited from Basic_ostream | |
virtual | ~Basic_ostream ()=default |
Private Attributes | |
Truncatable_ostream * | m_pipeline_head = nullptr |
IO_CACHE_binlog_cache_storage | m_file |
Byte container that provides a storage for serializing session binlog events.
This way of arranging the classes separates storage layer and binlog layer, hides the implementation detail of low level storage.
|
override |
void Binlog_cache_storage::close | ( | ) |
|
inline |
Copy all data to a output stream.
This function hides the internal implementation of storage detail. So it will not disturb the callers if the implementation of Binlog_cache_storage is changed. If we add a pipeline stream in this class, then we need to change the implementation of this function. But callers are not affected.
[out] | ostream | Where the data will be copied into |
[out] | ostream_error | It will be set to true if an error happens on ostream and the pointer is not null. It is valid only when the function returns true. |
false | Success |
true | Error happens in either the istream or ostream. |
|
inline |
Returns the count of disk writes.
|
inline |
Returns true if binlog cache is empty.
|
inline |
Returns data length.
|
inline |
Reset status and drop all data.
It looks like a cache was never used after reset.
|
inline |
Returns the name of the temporary file.
|
inline |
Truncates some data at the end of the binlog cache.
[in] | offset | Where the binlog cache will be truncated to. |
false | Success |
true | Error |
|
inlineoverridevirtual |
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.
[in] | buffer | Data to be written |
[in] | length | Length of the data |
false | Success. |
true | Error. |
Implements Basic_ostream.
|
private |
|
private |