MySQL 9.0.0
Source Code Documentation
Gcs_split_header_v2 Class Reference

This class is responsible for controlling message fragmentation and bundling and produces messages with the following format: More...

#include <gcs_message_stage_split.h>

Inheritance diagram for Gcs_split_header_v2:
[legend]

Public Member Functions

 Gcs_split_header_v2 ()=default
 
 Gcs_split_header_v2 (const Gcs_sender_id &sender_id, Gcs_message_id message_id, unsigned int num_messages, unsigned int message_part_id, unsigned long long payload_length) noexcept
 
std::unique_ptr< Gcs_stage_metadataclone () override
 Creates a deep copy of this object. More...
 
void set_sender_id (const Gcs_sender_id &sender_id)
 Set the sender identifier. More...
 
const Gcs_sender_idget_sender_id () const
 Return the sender identifier. More...
 
void set_message_id (Gcs_message_id message_id)
 Set the message identifier. More...
 
Gcs_message_id get_message_id () const
 Return the message identifier. More...
 
void set_num_messages (unsigned int num_messages)
 Set the number of messages bundled together. More...
 
unsigned int get_num_messages () const
 Return the number of messages bundled together. More...
 
void set_message_part_id (unsigned int message_part_id)
 Set the part that identifies this message. More...
 
unsigned int get_message_part_id () const
 Return the part that identifies this message. More...
 
void set_payload_length (unsigned long long payload_length)
 Set the payload length. More...
 
unsigned long long get_payload_length () const
 Return the payload length. More...
 
unsigned long long decode (const unsigned char *buffer) override
 Decodes the contents of the buffer and sets the field values according to the values decoded. More...
 
unsigned long long encode (unsigned char *buffer) const override
 Encode the contents of this instance into the buffer. More...
 
unsigned long long calculate_encode_length () const override
 Calculate the length used to store the stage header information. More...
 
void dump (std::ostringstream &output) const override
 Create a string representation of the header to be logged. More...
 

Static Public Attributes

static const unsigned short WIRE_HD_NUM_MESSAGES_SIZE = 4
 On-the-wire field size for the number of messages. More...
 
static const unsigned short WIRE_HD_SENDER_ID_SIZE = 8
 On-the-wire field size for the sender identification size. More...
 
static const unsigned short WIRE_HD_MESSAGE_ID_SIZE = 8
 On-the-wire field size for the message sequence (i.e. More...
 
static const unsigned short WIRE_HD_MESSAGE_PART_ID_SIZE = 4
 On-the-wire field size for the message part sequence (i.e. More...
 
static const unsigned short WIRE_HD_PAYLOAD_SIZE = 8
 On-the-wire field size for payload length. More...
 

Static Private Member Functions

static unsigned long long fixed_encode_length ()
 Helper method to calculate the length used to store the stage header information. More...
 

Private Attributes

Gcs_sender_id m_sender_id
 Uniquely identify the sender which the message belongs to. More...
 
Gcs_message_id m_message_id {0}
 Uniquely identify the message so that we can reassemble split messages. More...
 
unsigned int m_num_messages {1}
 Determine the number of original messages that are included here. More...
 
unsigned int m_message_part_id {0}
 Determine the part in the original message that the current payload corresponds to. More...
 
unsigned long long m_payload_length {0}
 Size of the current payload which is a full message or part of a message. More...
 

Detailed Description

This class is responsible for controlling message fragmentation and bundling and produces messages with the following format:


| Sender Id | Message Id | Part Id | Num Msg | Size | Payload |

. Sender Id - Member Identifier (i.e. incarnation UUID) that is used to uniquely identify the original sender.

. Message Id - Message Identifier (i.e. transaction counter) that is used to uniquely identify the original message.

. Part Id - Fragment of the original message that the payload corresponds to.

. Num Msg - The total number of messages that together compose the original message.

. Size - The payload size that is being carried on by this message.

. Payload - Payload that corresponds to the part of the original message that it is carrying on.

Constructor & Destructor Documentation

◆ Gcs_split_header_v2() [1/2]

Gcs_split_header_v2::Gcs_split_header_v2 ( )
explicitdefault

◆ Gcs_split_header_v2() [2/2]

Gcs_split_header_v2::Gcs_split_header_v2 ( const Gcs_sender_id sender_id,
Gcs_message_id  message_id,
unsigned int  num_messages,
unsigned int  message_part_id,
unsigned long long  payload_length 
)
inlineexplicitnoexcept

Member Function Documentation

◆ calculate_encode_length()

unsigned long long Gcs_split_header_v2::calculate_encode_length ( ) const
inlineoverridevirtual

Calculate the length used to store the stage header information.

Implements Gcs_stage_metadata.

◆ clone()

std::unique_ptr< Gcs_stage_metadata > Gcs_split_header_v2::clone ( )
inlineoverridevirtual

Creates a deep copy of this object.

Returns
a deep copy of this object.

Implements Gcs_stage_metadata.

◆ decode()

unsigned long long Gcs_split_header_v2::decode ( const unsigned char *  buffer)
overridevirtual

Decodes the contents of the buffer and sets the field values according to the values decoded.

The buffer MUST be encoded in little endian format.

Parameters
bufferThe buffer to decode from.
Returns
Length of the encoded information.

Implements Gcs_stage_metadata.

◆ dump()

void Gcs_split_header_v2::dump ( std::ostringstream &  output) const
overridevirtual

Create a string representation of the header to be logged.

Parameters
outputReference to the output stream where the string will be created.

Implements Gcs_stage_metadata.

◆ encode()

unsigned long long Gcs_split_header_v2::encode ( unsigned char *  buffer) const
overridevirtual

Encode the contents of this instance into the buffer.

The encoding SHALL be done in little endian format.

Parameters
bufferThe buffer to encode to.
Returns
Length of the encoded information.

Implements Gcs_stage_metadata.

◆ fixed_encode_length()

static unsigned long long Gcs_split_header_v2::fixed_encode_length ( )
inlinestaticprivate

Helper method to calculate the length used to store the stage header information.

◆ get_message_id()

Gcs_message_id Gcs_split_header_v2::get_message_id ( ) const
inline

Return the message identifier.

◆ get_message_part_id()

unsigned int Gcs_split_header_v2::get_message_part_id ( ) const
inline

Return the part that identifies this message.

◆ get_num_messages()

unsigned int Gcs_split_header_v2::get_num_messages ( ) const
inline

Return the number of messages bundled together.

◆ get_payload_length()

unsigned long long Gcs_split_header_v2::get_payload_length ( ) const
inline

Return the payload length.

◆ get_sender_id()

const Gcs_sender_id & Gcs_split_header_v2::get_sender_id ( ) const
inline

Return the sender identifier.

◆ set_message_id()

void Gcs_split_header_v2::set_message_id ( Gcs_message_id  message_id)
inline

Set the message identifier.

Parameters
message_idMessage identification.

◆ set_message_part_id()

void Gcs_split_header_v2::set_message_part_id ( unsigned int  message_part_id)
inline

Set the part that identifies this message.

Parameters
message_part_idPart that identifies this message.

◆ set_num_messages()

void Gcs_split_header_v2::set_num_messages ( unsigned int  num_messages)
inline

Set the number of messages bundled together.

Parameters
num_messagesNumber of messages bundled together.

◆ set_payload_length()

void Gcs_split_header_v2::set_payload_length ( unsigned long long  payload_length)
inline

Set the payload length.

Parameters
payload_lengthPayload buffer length.

◆ set_sender_id()

void Gcs_split_header_v2::set_sender_id ( const Gcs_sender_id sender_id)
inline

Set the sender identifier.

Parameters
sender_idSender identification.

Member Data Documentation

◆ m_message_id

Gcs_message_id Gcs_split_header_v2::m_message_id {0}
private

Uniquely identify the message so that we can reassemble split messages.

◆ m_message_part_id

unsigned int Gcs_split_header_v2::m_message_part_id {0}
private

Determine the part in the original message that the current payload corresponds to.

Note that the value starts at 0.

◆ m_num_messages

unsigned int Gcs_split_header_v2::m_num_messages {1}
private

Determine the number of original messages that are included here.

◆ m_payload_length

unsigned long long Gcs_split_header_v2::m_payload_length {0}
private

Size of the current payload which is a full message or part of a message.

◆ m_sender_id

Gcs_sender_id Gcs_split_header_v2::m_sender_id
private

Uniquely identify the sender which the message belongs to.

◆ WIRE_HD_MESSAGE_ID_SIZE

const unsigned short Gcs_split_header_v2::WIRE_HD_MESSAGE_ID_SIZE = 8
static

On-the-wire field size for the message sequence (i.e.

identification).

◆ WIRE_HD_MESSAGE_PART_ID_SIZE

const unsigned short Gcs_split_header_v2::WIRE_HD_MESSAGE_PART_ID_SIZE = 4
static

On-the-wire field size for the message part sequence (i.e.

identification).

◆ WIRE_HD_NUM_MESSAGES_SIZE

const unsigned short Gcs_split_header_v2::WIRE_HD_NUM_MESSAGES_SIZE = 4
static

On-the-wire field size for the number of messages.

◆ WIRE_HD_PAYLOAD_SIZE

const unsigned short Gcs_split_header_v2::WIRE_HD_PAYLOAD_SIZE = 8
static

On-the-wire field size for payload length.

◆ WIRE_HD_SENDER_ID_SIZE

const unsigned short Gcs_split_header_v2::WIRE_HD_SENDER_ID_SIZE = 8
static

On-the-wire field size for the sender identification size.


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