MySQL 8.0.40
Source Code Documentation
|
This is the base GCS plugin message. More...
#include <gcs_plugin_messages.h>
Public Types | |
enum | enum_cargo_type { CT_UNKNOWN = 0 , CT_CERTIFICATION_MESSAGE = 1 , CT_TRANSACTION_MESSAGE = 2 , CT_RECOVERY_MESSAGE = 3 , CT_MEMBER_INFO_MESSAGE = 4 , CT_MEMBER_INFO_MANAGER_MESSAGE = 5 , CT_PIPELINE_STATS_MEMBER_MESSAGE = 6 , CT_SINGLE_PRIMARY_MESSAGE = 7 , CT_GROUP_ACTION_MESSAGE = 8 , CT_GROUP_VALIDATION_MESSAGE = 9 , CT_SYNC_BEFORE_EXECUTION_MESSAGE = 10 , CT_TRANSACTION_WITH_GUARANTEE_MESSAGE = 11 , CT_TRANSACTION_PREPARED_MESSAGE = 12 , CT_MESSAGE_SERVICE_MESSAGE = 13 , CT_MAX = 14 } |
The different cargo type codes. More... | |
Public Member Functions | |
virtual | ~Plugin_gcs_message ()=default |
int | get_version () |
unsigned short | get_header_length () |
enum_cargo_type | get_cargo_type () const |
unsigned long long | get_msg_length () |
void | encode (std::vector< unsigned char > *buffer) const |
Encodes the contents of this instance into the buffer. More... | |
void | decode (const unsigned char *buffer, size_t length) |
Decodes the contents of the buffer and sets the field values according to the values decoded. More... | |
Static Public Member Functions | |
static enum_cargo_type | get_cargo_type (const unsigned char *buffer) |
Return the cargo type of a given message buffer, without decode the complete message. More... | |
static void | get_first_payload_item_raw_data (const unsigned char *buffer, const unsigned char **payload_item_data, size_t *payload_item_length) |
Return the raw data of the first payload item of a given message buffer, without decode the complete message. More... | |
Static Public Attributes | |
static const int | PLUGIN_GCS_MESSAGE_VERSION = 1 |
The protocol version number. More... | |
static const unsigned int | WIRE_VERSION_SIZE = 4 |
The protocol version number. More... | |
static const unsigned int | WIRE_HD_LEN_SIZE = 2 |
The on-the-wire size of the header length field. More... | |
static const unsigned int | WIRE_MSG_LEN_SIZE = 8 |
The on-the-wire size of the message size field. More... | |
static const unsigned int | WIRE_CARGO_TYPE_SIZE = 2 |
The on-the-wire size of the cargo type field. More... | |
static const unsigned int | WIRE_FIXED_HEADER_SIZE |
The on-the-wire size of the fixed header. More... | |
static const unsigned int | WIRE_PAYLOAD_ITEM_TYPE_SIZE = 2 |
The on-the-wire size of the each payload item type field. More... | |
static const unsigned int | WIRE_PAYLOAD_ITEM_LEN_SIZE = 8 |
The on-the-wire size of the each payload item size field. More... | |
static const unsigned int | WIRE_PAYLOAD_ITEM_HEADER_SIZE |
The on-the-wire size of the payload item header. More... | |
Protected Member Functions | |
Plugin_gcs_message (enum_cargo_type cargo_type) | |
Plugin_gcs_message constructor. More... | |
void | encode_header (std::vector< unsigned char > *buffer) const |
Encodes the header of this instance into the buffer. More... | |
void | decode_header (const unsigned char **slider) |
Decodes the header of the buffer into this instance. More... | |
virtual void | encode_payload (std::vector< unsigned char > *buffer) const =0 |
Encodes the contents of this instance payload into the buffer. More... | |
virtual void | decode_payload (const unsigned char *buffer, const unsigned char *end)=0 |
Decodes the contents of the buffer and sets the payload field values according to the values decoded. More... | |
void | encode_payload_item_type_and_length (std::vector< unsigned char > *buffer, uint16 payload_item_type, unsigned long long payload_item_length) const |
Encodes the given payload item type and length into the buffer. More... | |
void | encode_payload_item_char (std::vector< unsigned char > *buffer, uint16 type, unsigned char value) const |
Encodes the given payload item (type, length and value) into the buffer as a char (1 byte). More... | |
void | encode_payload_item_int2 (std::vector< unsigned char > *buffer, uint16 type, uint16 value) const |
Encodes the given payload item (type, length and value) into the buffer as a 2 bytes integer. More... | |
void | decode_payload_item_int2 (const unsigned char **buffer, uint16 *type, uint16 *value) |
Decodes the given payload item (type, length and value) from the buffer as a 2 bytes integer. More... | |
void | encode_payload_item_int4 (std::vector< unsigned char > *buffer, uint16 type, uint32 value) const |
Encodes the given payload item (type, length and value) into the buffer as a 4 bytes integer. More... | |
void | decode_payload_item_int4 (const unsigned char **buffer, uint16 *type, uint32 *value) |
Decodes the given payload item (type, length and value) from the buffer as a 4 bytes integer. More... | |
void | encode_payload_item_int8 (std::vector< unsigned char > *buffer, uint16 type, ulonglong value) const |
Encodes the given payload item (type, length and value) into the buffer as a 8 bytes integer. More... | |
void | decode_payload_item_int8 (const unsigned char **buffer, uint16 *type, uint64 *value) |
Decodes the given payload item (type, length and value) from the buffer as a 8 bytes integer. More... | |
void | encode_payload_item_string (std::vector< unsigned char > *buffer, uint16 type, const char *value, unsigned long long length) const |
Encodes the given payload item (type, length and value) into the buffer as a char array (variable size). More... | |
void | decode_payload_item_string (const unsigned char **buffer, uint16 *type, std::string *value, unsigned long long *length) |
Decodes the given payload item (type, length and value) from the buffer as a char array (variable size). More... | |
void | encode_payload_item_bytes (std::vector< unsigned char > *buffer, uint16 type, const unsigned char *value, unsigned long long length) const |
Encodes the given payload item (type, length and value) into the buffer as a byte buffer (variable size). More... | |
void | decode_payload_item_bytes (const unsigned char **buffer, uint16 *type, unsigned char *value, unsigned long long *length) |
Decodes the given payload item (type, length and value) from the buffer as a byte buffer (variable size). More... | |
Static Protected Member Functions | |
static void | decode_payload_item_type_and_length (const unsigned char **buffer, uint16 *payload_item_type, unsigned long long *payload_item_length) |
Decodes the given payload item type and length from the buffer. More... | |
static void | decode_payload_item_char (const unsigned char **buffer, uint16 *type, unsigned char *value) |
Decodes the given payload item (type, length and value) from the buffer as a char (1 byte). More... | |
Private Attributes | |
int | m_version |
This header instance protocol version. More... | |
unsigned short | m_fixed_header_len |
This header instance length. More... | |
unsigned long long | m_msg_len |
This is the message length field. More... | |
enum_cargo_type | m_cargo_type |
The cargo type code. More... | |
This is the base GCS plugin message.
It is composed by a fixed header and 1 or more payload items.
The on-the-wire layout looks like this:
+--------------------------------—+ | fixed header | payload | +--------------------------------—+
The on-the-wire representation of the message is:
+----------------—+--------—+-----------------------------------—+ | field | wire size | description | +===================+===========+======================================+ | version | 4 bytes | protocol version | | fixed_hdr_len | 2 bytes | length of the fixed header | | message_len | 8 bytes | length of the message | | cargo_type | 2 bytes | the cargo type in the payload | +----------------—+--------—+-----------------------------------—+ | payload_item_type | 2 bytes | the item type in the payload | | payload_item_len | 8 bytes | length of the payload item | | payload_item | X bytes | payload item | +----------------—+--------—+-----------------------------------—+
The last tree lines can occur one or more times.
The different cargo type codes.
NOTE: all type values must fit into WIRE_CARGO_TYPE_SIZE bytes storage.
|
virtualdefault |
|
explicitprotected |
Plugin_gcs_message constructor.
Only to be called by derivative classes
[in] | cargo_type | Message type to be sent |
void Plugin_gcs_message::decode | ( | const unsigned char * | buffer, |
size_t | length | ||
) |
Decodes the contents of the buffer and sets the field values according to the values decoded.
[in] | buffer | the buffer to decode from. |
[in] | length | the length of the buffer. |
|
protected |
Decodes the header of the buffer into this instance.
[out] | slider | before call decode_header : the start of the buffer after call decode_header : the position on which the header ends on the buffer. |
|
protectedpure virtual |
Decodes the contents of the buffer and sets the payload field values according to the values decoded.
[in] | buffer | the buffer to decode from. |
[in] | end | the end of the buffer. |
Implemented in Gtid_Executed_Message, Group_member_info, Group_service_message, Group_validation_message, Recovery_message, Transaction_message, Transaction_with_guarantee_message, Group_member_info_manager_message, Pipeline_stats_member_message, Group_action_message, Single_primary_message, Sync_before_execution_message, and Transaction_prepared_message.
|
protected |
Decodes the given payload item (type, length and value) from the buffer as a byte buffer (variable size).
[in] | buffer | the buffer to encode from |
[out] | type | the type of the payload item |
[out] | value | the value of the payload item |
[out] | length | the length of the payload item |
|
staticprotected |
Decodes the given payload item (type, length and value) from the buffer as a char (1 byte).
[in] | buffer | the buffer to encode from |
[out] | type | the type of the payload item |
[out] | value | the value of the payload item |
|
protected |
Decodes the given payload item (type, length and value) from the buffer as a 2 bytes integer.
[in] | buffer | the buffer to encode from |
[out] | type | the type of the payload item |
[out] | value | the value of the payload item |
|
protected |
Decodes the given payload item (type, length and value) from the buffer as a 4 bytes integer.
[in] | buffer | the buffer to encode from |
[out] | type | the type of the payload item |
[out] | value | the value of the payload item |
|
protected |
Decodes the given payload item (type, length and value) from the buffer as a 8 bytes integer.
[in] | buffer | the buffer to encode from |
[out] | type | the type of the payload item |
[out] | value | the value of the payload item |
|
protected |
Decodes the given payload item (type, length and value) from the buffer as a char array (variable size).
[in] | buffer | the buffer to encode from |
[out] | type | the type of the payload item |
[out] | value | the value of the payload item |
[out] | length | the length of the payload item |
|
staticprotected |
Decodes the given payload item type and length from the buffer.
[in] | buffer | the buffer to encode from |
[out] | payload_item_type | the type of the payload item |
[out] | payload_item_length | the length of the payload item |
void Plugin_gcs_message::encode | ( | std::vector< unsigned char > * | buffer | ) | const |
Encodes the contents of this instance into the buffer.
[out] | buffer | the buffer to encode to. |
|
protected |
Encodes the header of this instance into the buffer.
[out] | buffer | the buffer to encode to. |
|
protectedpure virtual |
Encodes the contents of this instance payload into the buffer.
[out] | buffer | the buffer to encode to. |
Implemented in Gtid_Executed_Message, Group_member_info, Group_member_info_manager_message, Pipeline_stats_member_message, Group_action_message, Group_service_message, Group_validation_message, Recovery_message, Single_primary_message, Sync_before_execution_message, Transaction_message, Transaction_prepared_message, and Transaction_with_guarantee_message.
|
protected |
Encodes the given payload item (type, length and value) into the buffer as a byte buffer (variable size).
[out] | buffer | the buffer to encode to |
[in] | type | the type of the payload item |
[in] | value | the value of the payload item |
[in] | length | the length of the payload item |
|
protected |
Encodes the given payload item (type, length and value) into the buffer as a char (1 byte).
[out] | buffer | the buffer to encode to |
[in] | type | the type of the payload item |
[in] | value | the value of the payload item |
|
protected |
Encodes the given payload item (type, length and value) into the buffer as a 2 bytes integer.
[out] | buffer | the buffer to encode to |
[in] | type | the type of the payload item |
[in] | value | the value of the payload item |
|
protected |
Encodes the given payload item (type, length and value) into the buffer as a 4 bytes integer.
[out] | buffer | the buffer to encode to |
[in] | type | the type of the payload item |
[in] | value | the value of the payload item |
|
protected |
Encodes the given payload item (type, length and value) into the buffer as a 8 bytes integer.
[out] | buffer | the buffer to encode to |
[in] | type | the type of the payload item |
[in] | value | the value of the payload item |
|
protected |
Encodes the given payload item (type, length and value) into the buffer as a char array (variable size).
[out] | buffer | the buffer to encode to |
[in] | type | the type of the payload item |
[in] | value | the value of the payload item |
[in] | length | the length of the payload item |
|
protected |
Encodes the given payload item type and length into the buffer.
[out] | buffer | the buffer to encode to |
[in] | payload_item_type | the type of the payload item |
[in] | payload_item_length | the length of the payload item |
|
inline |
|
static |
Return the cargo type of a given message buffer, without decode the complete message.
[in] | buffer | the buffer to decode from. |
|
static |
Return the raw data of the first payload item of a given message buffer, without decode the complete message.
[out] | buffer | the buffer to decode from. |
[out] | payload_item_data | the data. |
[out] | payload_item_length | the length of the data. |
|
inline |
|
inline |
|
inline |
|
private |
The cargo type code.
|
private |
This header instance length.
|
private |
This is the message length field.
|
private |
This header instance protocol version.
|
static |
The protocol version number.
|
static |
The on-the-wire size of the cargo type field.
|
static |
The on-the-wire size of the fixed header.
|
static |
The on-the-wire size of the header length field.
|
static |
The on-the-wire size of the message size field.
|
static |
The on-the-wire size of the payload item header.
|
static |
The on-the-wire size of the each payload item size field.
|
static |
The on-the-wire size of the each payload item type field.
|
static |
The protocol version number.