MySQL 8.3.0
Source Code Documentation
Transaction_with_guarantee_message Class Reference

#include <transaction_with_guarantee_message.h>

Inheritance diagram for Transaction_with_guarantee_message:
[legend]

Public Types

enum  enum_payload_item_type {
  PIT_UNKNOWN = 0 , PIT_TRANSACTION_DATA = 1 , PIT_TRANSACTION_CONSISTENCY_LEVEL = 2 , PIT_SENT_TIMESTAMP = 3 ,
  PIT_MAX = 4
}
 
- Public Types inherited from Plugin_gcs_message
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_RECOVERY_METADATA_MESSAGE = 14 , CT_MAX = 15
}
 The different cargo type codes. More...
 

Public Member Functions

 Transaction_with_guarantee_message (uint64_t payload_capacity, enum_group_replication_consistency_level consistency_level)
 Constructor. More...
 
 ~Transaction_with_guarantee_message () override
 
bool write (const unsigned char *buffer, my_off_t length) override
 Overrides Basic_ostream::write(). More...
 
uint64_t length () override
 Length of the message. More...
 
Gcs_message_dataget_message_data_and_reset () override
 Get the Gcs_message_data object, which contains the serialized transaction data. More...
 
- Public Member Functions inherited from Transaction_message_interface
 Transaction_message_interface (enum_cargo_type cargo_type)
 
 ~Transaction_message_interface () override=default
 
- Public Member Functions inherited from Plugin_gcs_message
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...
 
- Public Member Functions inherited from Basic_ostream
virtual ~Basic_ostream ()=default
 

Static Public Member Functions

static enum_group_replication_consistency_level decode_and_get_consistency_level (const unsigned char *buffer, size_t)
 Decode transaction consistency without unmarshal transaction data. More...
 
static uint64_t get_sent_timestamp (const unsigned char *buffer, size_t length)
 Return the time at which the message contained in the buffer was sent. More...
 
- Static Public Member Functions inherited from Plugin_gcs_message
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 bool get_payload_item_type_raw_data (const unsigned char *buffer, const unsigned char *end, uint16 payload_item_type, const unsigned char **payload_item_data, unsigned long long *payload_item_length)
 Return the raw data of the payload item of a given payload type of a given message buffer. More...
 

Protected Member Functions

void encode_payload (std::vector< unsigned char > *buffer) const override
 Encodes the contents of this instance payload into the buffer. More...
 
void decode_payload (const unsigned char *buffer, const unsigned char *) override
 Decodes the contents of the buffer and sets the payload field values according to the values decoded. More...
 
- Protected Member Functions inherited from Plugin_gcs_message
 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...
 
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 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...
 

Private Attributes

Gcs_message_datam_gcs_message_data {nullptr}
 
enum_group_replication_consistency_level m_consistency_level
 

Static Private Attributes

static const uint64_t s_consistency_level_pit_size
 
static const uint64_t s_sent_timestamp_pit_size
 

Additional Inherited Members

- Static Public Attributes inherited from Plugin_gcs_message
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...
 
- Static Protected Member Functions inherited from Plugin_gcs_message
static int64_t get_sent_timestamp (const unsigned char *buffer, size_t length, const uint16 timestamp_payload_item_type)
 Return the time at which the message contained in the buffer was sent. More...
 
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...
 
static 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...
 

Member Enumeration Documentation

◆ enum_payload_item_type

Enumerator
PIT_UNKNOWN 
PIT_TRANSACTION_DATA 
PIT_TRANSACTION_CONSISTENCY_LEVEL 
PIT_SENT_TIMESTAMP 
PIT_MAX 

Constructor & Destructor Documentation

◆ Transaction_with_guarantee_message()

Transaction_with_guarantee_message::Transaction_with_guarantee_message ( uint64_t  payload_capacity,
enum_group_replication_consistency_level  consistency_level 
)

Constructor.

Parameters
[in]payload_capacityThe transaction data size
[in]consistency_levelThe transaction consistency level

◆ ~Transaction_with_guarantee_message()

Transaction_with_guarantee_message::~Transaction_with_guarantee_message ( )
override

Member Function Documentation

◆ decode_and_get_consistency_level()

enum_group_replication_consistency_level Transaction_with_guarantee_message::decode_and_get_consistency_level ( const unsigned char *  buffer,
size_t   
)
static

Decode transaction consistency without unmarshal transaction data.

Returns
the transaction consistency

◆ decode_payload()

void Transaction_with_guarantee_message::decode_payload ( const unsigned char *  buffer,
const unsigned char *  end 
)
overrideprotectedvirtual

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

Parameters
[in]bufferthe buffer to decode from.
[in]endthe end of the buffer.

Implements Plugin_gcs_message.

◆ encode_payload()

void Transaction_with_guarantee_message::encode_payload ( std::vector< unsigned char > *  buffer) const
overrideprotectedvirtual

Encodes the contents of this instance payload into the buffer.

Parameters
[out]bufferthe buffer to encode to.

Implements Plugin_gcs_message.

◆ get_message_data_and_reset()

Gcs_message_data * Transaction_with_guarantee_message::get_message_data_and_reset ( )
overridevirtual

Get the Gcs_message_data object, which contains the serialized transaction data.

The internal Gcs_message_data is nullified, to avoid further usage of this Transaction object and the caller receives a pointer to the previously internal Gcs_message_data, which whom it is now responsible.

Returns
the serialized transaction data in a Gcs_message_data object

Implements Transaction_message_interface.

◆ get_sent_timestamp()

uint64_t Transaction_with_guarantee_message::get_sent_timestamp ( const unsigned char *  buffer,
size_t  length 
)
static

Return the time at which the message contained in the buffer was sent.

See also
Metrics_handler::get_current_time()
Parameters
[in]bufferthe buffer to decode from.
[in]lengththe buffer length
Returns
the time on which the message was sent.

◆ length()

uint64_t Transaction_with_guarantee_message::length ( )
overridevirtual

Length of the message.

Returns
message length

Implements Transaction_message_interface.

◆ write()

bool Transaction_with_guarantee_message::write ( const unsigned char *  buffer,
my_off_t  length 
)
overridevirtual

Overrides Basic_ostream::write().

Transaction_with_guarantee_message is a Basic_ostream, which appends data into the a Gcs_message_data.

Parameters
[in]bufferwhere the data will be read
[in]lengththe length of the data to write
Returns
returns false if succeeds, otherwise true is returned.

Implements Basic_ostream.

Member Data Documentation

◆ m_consistency_level

enum_group_replication_consistency_level Transaction_with_guarantee_message::m_consistency_level
private

◆ m_gcs_message_data

Gcs_message_data* Transaction_with_guarantee_message::m_gcs_message_data {nullptr}
private

◆ s_consistency_level_pit_size

const uint64_t Transaction_with_guarantee_message::s_consistency_level_pit_size
staticprivate
Initial value:
=
static const unsigned int WIRE_PAYLOAD_ITEM_HEADER_SIZE
The on-the-wire size of the payload item header.
Definition: gcs_plugin_messages.h:108

◆ s_sent_timestamp_pit_size

const uint64_t Transaction_with_guarantee_message::s_sent_timestamp_pit_size
staticprivate

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