MySQL 8.4.2
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 (const Basic_binlog_file_reader &&)=delete | |
Basic_binlog_file_reader & | operator= (const Basic_binlog_file_reader &)=delete |
Basic_binlog_file_reader & | operator= (const Basic_binlog_file_reader &&)=delete |
~Basic_binlog_file_reader () override | |
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 () const |
my_off_t | position () const override |
Return the current position in bytes, relative to the beginning of the file. More... | |
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 () override |
wrapper of EVENT_OBJECT_ISTREAM::read_event_object. More... | |
bool | has_fatal_error () const override |
Return true if there was a previous error. More... | |
Binlog_read_error::Error_type | get_error_type () const override |
Return the error happened in the stream pipeline. More... | |
const char * | get_error_str () const override |
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 mysql::binlog::event::Format_description_event &fde) |
const mysql::binlog::event::Format_description_event & | format_description_event () const override |
Return a pointer the currently used Format_description_log_event. More... | |
my_off_t | event_start_pos () |
void | reset_error () |
Resets the error. More... | |
const char * | get_file_name () const |
Public Member Functions inherited from IBasic_binlog_file_reader | |
IBasic_binlog_file_reader ()=default | |
IBasic_binlog_file_reader (IBasic_binlog_file_reader &)=delete | |
IBasic_binlog_file_reader (IBasic_binlog_file_reader &&)=delete | |
IBasic_binlog_file_reader & | operator= (IBasic_binlog_file_reader &)=delete |
IBasic_binlog_file_reader & | operator= (IBasic_binlog_file_reader &&)=delete |
virtual | ~IBasic_binlog_file_reader ()=default |
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 |
mysql::binlog::event::Format_description_event | m_fde |
bool | m_verify_checksum = false |
const char * | m_file_name {""} |
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 |
|
delete |
|
inlineoverride |
|
inline |
|
inline |
Close the binlog file.
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Return a pointer the currently used Format_description_log_event.
The event is a member by this reader, so the caller must not use the returned reference after this reader has been deleted.
Implements IBasic_binlog_file_reader.
|
inlineoverridevirtual |
Return the error message of the error happened in the stream pipeline.
Implements IBasic_binlog_file_reader.
|
inlineoverridevirtual |
Return the error happened in the stream pipeline.
Implements IBasic_binlog_file_reader.
|
inline |
|
inlineoverridevirtual |
Return true if there was a previous error.
Implements IBasic_binlog_file_reader.
|
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 | Success |
true | Error |
|
delete |
|
delete |
|
inlineoverridevirtual |
Return the current position in bytes, relative to the beginning of the file.
Implements IBasic_binlog_file_reader.
|
inline |
Wrapper of EVENT_DATA_ISTREAM::read_event_data.
|
inlineoverridevirtual |
wrapper of EVENT_OBJECT_ISTREAM::read_event_object.
Implements IBasic_binlog_file_reader.
|
inlineprivate |
Read the Format_description_log_events before 'offset'.
[in] | offset | The position where the read should stop. |
|
inline |
Resets the error.
Sets it to Binlog_read_error::SUCCESS.
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |