MySQL 9.0.0
Source Code Documentation
mysql::binlog::event::codecs::binary::Heartbeat Class Reference

Binary codec for the heartbeat log event. More...

#include <binary.h>

Inheritance diagram for mysql::binlog::event::codecs::binary::Heartbeat:
[legend]

Public Types

enum  fields { OTW_HB_HEADER_END_MARK = 0 , OTW_HB_LOG_FILENAME_FIELD = 1 , OTW_HB_LOG_POSITION_FIELD = 2 }
 The on-the-wire fields. More...
 

Public Member Functions

 Heartbeat ()
 
std::pair< std::size_t, bool > decode (const unsigned char *from, std::size_t size, Binary_log_event &to) const override
 This member function shall decode the contents of the buffer provided and fill in the event referenced. More...
 
std::pair< std::size_t, bool > encode (const Binary_log_event &from, unsigned char *to, std::size_t size) const override
 This member function shall encode the contents of the event referenced and store the result in the buffer provided. More...
 
- Public Member Functions inherited from mysql::binlog::event::codecs::binary::Base_codec
 Base_codec ()=default
 
 Base_codec (Base_codec &&) noexcept=default
 
Base_codecoperator= (Base_codec &&) noexcept=default
 
 Base_codec (const Base_codec &) noexcept=default
 
Base_codecoperator= (const Base_codec &)=default
 
 ~Base_codec () override=default
 
- Public Member Functions inherited from mysql::binlog::event::codecs::Codec
virtual ~Codec ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from mysql::binlog::event::codecs::binary::Base_codec
Event_readerreader ()
 
- Protected Attributes inherited from mysql::binlog::event::codecs::binary::Base_codec
Event_readerm_reader = nullptr
 

Detailed Description

Binary codec for the heartbeat log event.

Member Enumeration Documentation

◆ fields

The on-the-wire fields.

Enumerator
OTW_HB_HEADER_END_MARK 

Marks the end of the fields.

OTW_HB_LOG_FILENAME_FIELD 

The log file name.

OTW_HB_LOG_POSITION_FIELD 

The log position field.

Constructor & Destructor Documentation

◆ Heartbeat()

mysql::binlog::event::codecs::binary::Heartbeat::Heartbeat ( )
inline

Member Function Documentation

◆ decode()

std::pair< std::size_t, bool > mysql::binlog::event::codecs::binary::Heartbeat::decode ( const unsigned char *  from,
std::size_t  size,
Binary_log_event to 
) const
overridevirtual

This member function shall decode the contents of the buffer provided and fill in the event referenced.

This is the decoder member function for decoding heartbeats.

Note that the event provided needs to be of type HEARTBEAT_EVENT_V2.

Parameters
fromthe buffer to decode
sizethe size of the buffer to decode.
tothe event to store the decoded information into.
Returns
a pair containing the amount of bytes decoded and whether there was an error or not. False if no error, true otherwise.

Note that the log event must have the appropriate type code: HEARTBEAT_LOG_EVENT to be compatible with this specific decoder. If it is not, an error shall be returned

Parameters
fromthe buffer to decode from.
sizethe buffer size.
toThe log event to decode to.
Returns
a pair containing the number of bytes decoded and whether there was an error or not. False if no error, true otherwise.

Implements mysql::binlog::event::codecs::binary::Base_codec.

◆ encode()

std::pair< std::size_t, bool > mysql::binlog::event::codecs::binary::Heartbeat::encode ( const Binary_log_event from,
unsigned char *  to,
std::size_t  size 
) const
overridevirtual

This member function shall encode the contents of the event referenced and store the result in the buffer provided.

This is the encoder member function for the heartbeat event.

Note that the event referenced needs to be of type HEARTBEAT_EVENT_V2.

Parameters
fromthe event to encode.
tothe buffer where to store the encoded event.
sizethe size of the buffer.
Returns
a pair containing the amount of bytes encoded and whether there was an error or not.

Note that the log event must have the appropriate type code: HEARTBEAT_LOG_EVENT to be compatible with this specific enccoder. If it is not, an error shall be returned

Parameters
fromThe log event to decode to.
tothe buffer to decode from.
sizethe buffer size.
Returns
a pair containing the number of bytes decoded and whether there was an error or not. False if no error, true otherwise.

Implements mysql::binlog::event::codecs::binary::Base_codec.


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