MySQL 9.1.0
Source Code Documentation
Binlog_event_data_istream Class Reference

Binlog_event_data_istream fetches byte data from Basic_istream and divides them into event_data chunk according to the format. More...

#include <binlog_reader.h>

Public Member Functions

 Binlog_event_data_istream (Binlog_read_error *error, Basic_istream *istream, unsigned int max_event_size)
 
 Binlog_event_data_istream ()=delete
 
 Binlog_event_data_istream (const Binlog_event_data_istream &)=delete
 
Binlog_event_data_istreamoperator= (const Binlog_event_data_istream &)=delete
 
virtual ~Binlog_event_data_istream ()=default
 
template<class ALLOCATOR >
bool read_event_data (unsigned char **data, unsigned int *length, ALLOCATOR *allocator, bool verify_checksum, mysql::binlog::event::enum_binlog_checksum_alg checksum_alg)
 Read an event data from the stream and verify its checksum if verify_checksum is true. More...
 

Protected Member Functions

virtual bool read_event_header ()
 Read the event header from the Basic_istream. More...
 
bool check_event_header ()
 Check if it is a valid event header. More...
 
template<Binlog_read_error::Error_type ERROR_TYPE>
bool read_fixed_length (unsigned char *data, unsigned int length)
 Read fixed length of data from Basic_istream. More...
 

Protected Attributes

unsigned char m_header [LOG_EVENT_MINIMAL_HEADER_LEN]
 
Binlog_read_errorm_error
 It is convenient for caller to share a Binlog_read_error object between streams. More...
 

Private Member Functions

bool fill_event_data (unsigned char *event_data, bool verify_checksum, mysql::binlog::event::enum_binlog_checksum_alg checksum_alg)
 Fill the event data into the given buffer and verify checksum if 'verify_checksum' is true. More...
 

Private Attributes

Basic_istreamm_istream = nullptr
 
unsigned int m_max_event_size
 
unsigned int m_event_length = 0
 

Detailed Description

Binlog_event_data_istream fetches byte data from Basic_istream and divides them into event_data chunk according to the format.

Event_data is a serialized event object. It is a chunk of data in buffer.

Constructor & Destructor Documentation

◆ Binlog_event_data_istream() [1/3]

Binlog_event_data_istream::Binlog_event_data_istream ( Binlog_read_error error,
Basic_istream istream,
unsigned int  max_event_size 
)

◆ Binlog_event_data_istream() [2/3]

Binlog_event_data_istream::Binlog_event_data_istream ( )
delete

◆ Binlog_event_data_istream() [3/3]

Binlog_event_data_istream::Binlog_event_data_istream ( const Binlog_event_data_istream )
delete

◆ ~Binlog_event_data_istream()

virtual Binlog_event_data_istream::~Binlog_event_data_istream ( )
virtualdefault

Member Function Documentation

◆ check_event_header()

bool Binlog_event_data_istream::check_event_header ( )
protected

Check if it is a valid event header.

Return values
falseSuccess
trueError

◆ fill_event_data()

bool Binlog_event_data_istream::fill_event_data ( unsigned char *  event_data,
bool  verify_checksum,
mysql::binlog::event::enum_binlog_checksum_alg  checksum_alg 
)
private

Fill the event data into the given buffer and verify checksum if 'verify_checksum' is true.

Parameters
[in]event_dataThe buffer where the event data will be stored.
[in]verify_checksumVerify the event data's checksum if it is true.
[in]checksum_algChecksum algorithm for verifying the event data. It is used only when verify_checksum is true.
Return values
falseSuccess
trueError

◆ operator=()

Binlog_event_data_istream & Binlog_event_data_istream::operator= ( const Binlog_event_data_istream )
delete

◆ read_event_data()

template<class ALLOCATOR >
bool Binlog_event_data_istream::read_event_data ( unsigned char **  data,
unsigned int *  length,
ALLOCATOR *  allocator,
bool  verify_checksum,
mysql::binlog::event::enum_binlog_checksum_alg  checksum_alg 
)
inline

Read an event data from the stream and verify its checksum if verify_checksum is true.

Parameters
[out]dataThe pointer of the event data
[out]lengthThe length of the event data
[in]allocatorIt is used to allocate memory for the event data.
[in]verify_checksumVerify the event data's checksum if it is true.
[in]checksum_algChecksum algorithm for verifying the event data. It is used only when verify_checksum is true.
Return values
falseSuccess
trueError

◆ read_event_header()

bool Binlog_event_data_istream::read_event_header ( )
protectedvirtual

Read the event header from the Basic_istream.

Return values
falseSuccess
trueError

◆ read_fixed_length()

template<Binlog_read_error::Error_type ERROR_TYPE>
bool Binlog_event_data_istream::read_fixed_length ( unsigned char *  data,
unsigned int  length 
)
inlineprotected

Read fixed length of data from Basic_istream.

It sets error to

  • Binlog_read_error::SYTEM_IO if Basic_istream returns error.
  • Binlog_read_error::TRUNC_EVENT if less than length is read.
  • ERROR_TYPE if zero byte is read. ERROR_TYPE is either TRUNC_EVENT or READ_EOF.
Parameters
[in]dataThe buffer where the data stored.
[in]lengthBytes of the data to be read.
Return values
falseSuccess
trueError

Member Data Documentation

◆ m_error

Binlog_read_error* Binlog_event_data_istream::m_error
protected

It is convenient for caller to share a Binlog_read_error object between streams.

So Binlog_read_error pointer is defined here. It should be initialized in constructor by caller.

◆ m_event_length

unsigned int Binlog_event_data_istream::m_event_length = 0
private

◆ m_header

unsigned char Binlog_event_data_istream::m_header[LOG_EVENT_MINIMAL_HEADER_LEN]
protected

◆ m_istream

Basic_istream* Binlog_event_data_istream::m_istream = nullptr
private

◆ m_max_event_size

unsigned int Binlog_event_data_istream::m_max_event_size
private

The documentation for this class was generated from the following files: