![]() |
MySQL 8.0.33
Source Code Documentation
|
It owns an allocator, a byte stream, an event_data stream and an event object stream. More...
#include <binlog_reader.h>
Public Types | |
typedef EVENT_DATA_ISTREAM | Event_data_istream |
typedef EVENT_OBJECT_ISTREAM< Event_data_istream > | Event_object_istream |
Public Member Functions | |
Basic_binlog_file_reader (bool verify_checksum, unsigned int max_event_size=UINT_MAX) | |
Basic_binlog_file_reader (const Basic_binlog_file_reader &)=delete | |
Basic_binlog_file_reader & | operator= (const Basic_binlog_file_reader &)=delete |
~Basic_binlog_file_reader () | |
bool | open (const char *file_name, my_off_t offset=0, Format_description_log_event **fdle=nullptr) |
Open a binlog file and set read position to offset. More... | |
void | close () |
Close the binlog file. More... | |
bool | is_open () |
my_off_t | position () |
bool | seek (my_off_t pos) |
bool | read_event_data (unsigned char **data, unsigned int *length) |
Wrapper of EVENT_DATA_ISTREAM::read_event_data. More... | |
Log_event * | read_event_object () |
wrapper of EVENT_OBJECT_ISTREAM::read_event_object. More... | |
bool | has_fatal_error () |
Binlog_read_error::Error_type | get_error_type () |
Return the error happened in the stream pipeline. More... | |
const char * | get_error_str () |
Return the error message of the error happened in the stream pipeline. More... | |
IFILE * | ifile () |
Event_data_istream * | event_data_istream () |
Event_object_istream * | event_object_istream () |
ALLOCATOR * | allocator () |
void | set_format_description_event (const Format_description_event &fde) |
const Format_description_event * | format_description_event () |
my_off_t | event_start_pos () |
Private Member Functions | |
Format_description_log_event * | read_fdle (my_off_t offset) |
Read the Format_description_log_events before 'offset'. More... | |
Private Attributes | |
Binlog_read_error | m_error |
IFILE | m_ifile |
Event_data_istream | m_data_istream |
Event_object_istream | m_object_istream |
ALLOCATOR | m_allocator |
Format_description_event | m_fde |
bool | m_verify_checksum = false |
my_off_t | m_event_start_pos = 0 |
It owns an allocator, a byte stream, an event_data stream and an event object stream.
The stream pipeline is setup in the constructor. All the objects required for reading a binlog file is initialized in reader class.
It maintains the Format_description_event which is needed for reading the following binlog events. A default format_description_event is initialized at the beginning. Then it will be replaced by the one read from the binlog file.
Some convenient functions is added to encapsulate the access of IFILE, EVENT_DATA_ISTREAM, EVENT_OBJECT_ISTREAM. It makes the code simpler for reading a binlog file.
typedef EVENT_DATA_ISTREAM Basic_binlog_file_reader< IFILE, EVENT_DATA_ISTREAM, EVENT_OBJECT_ISTREAM, ALLOCATOR >::Event_data_istream |
typedef EVENT_OBJECT_ISTREAM<Event_data_istream> Basic_binlog_file_reader< IFILE, EVENT_DATA_ISTREAM, EVENT_OBJECT_ISTREAM, ALLOCATOR >::Event_object_istream |
|
inline |
|
delete |
|
inline |
|
inline |
|
inline |
Close the binlog file.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the error message of the error happened in the stream pipeline.
|
inline |
Return the error happened in the stream pipeline.
|
inline |
|
inline |
|
inline |
|
inline |
Open a binlog file and set read position to offset.
It will read and store Format_description_event automatically if offset is bigger than current position and fde is nullptr. Otherwise fde is use instead of finding fde from the file if fde is not null.
[in] | file_name | name of the binlog file which will be opened. |
[in] | offset | The position where it starts to read. |
[out] | fdle | For returning an Format_description_log_event object. |
false | Succeed |
true | Error |
|
delete |
|
inline |
|
inline |
Wrapper of EVENT_DATA_ISTREAM::read_event_data.
|
inline |
wrapper of EVENT_OBJECT_ISTREAM::read_event_object.
|
inlineprivate |
Read the Format_description_log_events before 'offset'.
[in] | offset | The position where the read should stop. |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |