MySQL 8.4.2
Source Code Documentation
Group_action_message Class Reference

#include <group_action_message.h>

Inheritance diagram for Group_action_message:
[legend]

Public Types

enum  enum_payload_item_type {
  PIT_UNKNOWN = 0 , PIT_ACTION_TYPE = 1 , PIT_ACTION_PHASE = 2 , PIT_ACTION_RETURN_VALUE = 3 ,
  PIT_ACTION_PRIMARY_ELECTION_UUID = 4 , PIT_ACTION_SET_COMMUNICATION_PROTOCOL_VERSION = 5 , PIT_ACTION_TRANSACTION_MONITOR_TIMEOUT = 6 , PIT_ACTION_INITIATOR = 7 ,
  PIT_SENT_TIMESTAMP = 8 , PIT_MAX = 9
}
 
enum  enum_action_message_type {
  ACTION_UNKNOWN_MESSAGE = 0 , ACTION_MULTI_PRIMARY_MESSAGE = 1 , ACTION_PRIMARY_ELECTION_MESSAGE = 2 , ACTION_SET_COMMUNICATION_PROTOCOL_MESSAGE = 3 ,
  ACTION_MESSAGE_END = 4
}
 Enum for the types of message / actions. More...
 
enum  enum_action_message_phase {
  ACTION_UNKNOWN_PHASE = 0 , ACTION_START_PHASE = 1 , ACTION_END_PHASE = 2 , ACTION_ABORT_PHASE = 3 ,
  ACTION_PHASE_END = 4
}
 Enum for the phase of the action in the message. More...
 
enum  enum_action_initiator_and_action {
  ACTION_INITIATOR_UNKNOWN = 0 , ACTION_UDF_SWITCH_TO_MULTI_PRIMARY_MODE = 1 , ACTION_UDF_SET_PRIMARY = 2 , ACTION_UDF_SWITCH_TO_SINGLE_PRIMARY_MODE = 3 ,
  ACTION_UDF_SWITCH_TO_SINGLE_PRIMARY_MODE_UUID = 4 , ACTION_UDF_COMMUNICATION_PROTOCOL_MESSAGE = 5 , ACTION_INITIATOR_END = 6
}
 Enum to identify initiator and action. More...
 
- 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

 Group_action_message ()
 Message constructor. More...
 
 Group_action_message (enum_action_message_type type)
 Message constructor. More...
 
 Group_action_message (std::string &primary_uuid, int32 &transaction_monitor_timeout_arg)
 Message constructor for ACTION_PRIMARY_ELECTION_MESSAGE action type. More...
 
 Group_action_message (Gcs_protocol_version gcs_protocol)
 Message constructor for ACTION_SET_COMMUNICATION_PROTOCOL_MESSAGE action type. More...
 
 ~Group_action_message () override
 Message destructor. More...
 
 Group_action_message (const uchar *buf, size_t len)
 Message constructor for raw data. More...
 
enum_action_message_type get_group_action_message_type ()
 Returns this group action message type. More...
 
enum_action_message_phase get_group_action_message_phase ()
 Returns this group action message phase. More...
 
void set_group_action_message_phase (enum_action_message_phase phase)
 
void set_return_value (int return_value_arg)
 Set the return value for this message. More...
 
void set_action_initiator (const enum_action_initiator_and_action initiator)
 Set the action initiator. More...
 
const enum_action_initiator_and_actionget_action_initiator ()
 
int32 get_return_value ()
 
const std::string & get_primary_to_elect_uuid ()
 Returns this group action primary to be elected uuid. More...
 
Gcs_protocol_version const & get_gcs_protocol ()
 Returns the GCS protocol this group action wants the group to change to. More...
 
int32 get_transaction_monitor_timeout ()
 Returns the running_transactions_timeout. More...
 
- 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...
 

Static Public Member Functions

static enum_action_message_type get_action_type (const uchar *buf)
 Check what is the action that this message encodes from a buffer. 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 message contents for transmission. More...
 
void decode_payload (const unsigned char *buffer, const unsigned char *end) override
 Message decoding method. 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

enum_action_message_type group_action_type
 The action type for this message. More...
 
enum_action_message_phase group_action_phase
 If it is a start, stop or other message. More...
 
int32 return_value
 Is there any return value associated to this action. More...
 
std::string primary_election_uuid
 The uuid for election, can be empty if not defined. More...
 
Gcs_protocol_version gcs_protocol
 The GCS protocol version to change to. More...
 
int32 m_transaction_monitor_timeout {-1}
 The number of seconds to wait before setting the kill flag for the transactions that did not reach commit stage. More...
 
enum_action_initiator_and_action m_action_initiator
 Group action identifier. More...
 

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_action_initiator_and_action

Enum to identify initiator and action.

Enumerator
ACTION_INITIATOR_UNKNOWN 
ACTION_UDF_SWITCH_TO_MULTI_PRIMARY_MODE 
ACTION_UDF_SET_PRIMARY 
ACTION_UDF_SWITCH_TO_SINGLE_PRIMARY_MODE 
ACTION_UDF_SWITCH_TO_SINGLE_PRIMARY_MODE_UUID 
ACTION_UDF_COMMUNICATION_PROTOCOL_MESSAGE 
ACTION_INITIATOR_END 

◆ enum_action_message_phase

Enum for the phase of the action in the message.

Enumerator
ACTION_UNKNOWN_PHASE 
ACTION_START_PHASE 
ACTION_END_PHASE 
ACTION_ABORT_PHASE 
ACTION_PHASE_END 

◆ enum_action_message_type

Enum for the types of message / actions.

Enumerator
ACTION_UNKNOWN_MESSAGE 
ACTION_MULTI_PRIMARY_MESSAGE 
ACTION_PRIMARY_ELECTION_MESSAGE 
ACTION_SET_COMMUNICATION_PROTOCOL_MESSAGE 
ACTION_MESSAGE_END 

◆ enum_payload_item_type

Enumerator
PIT_UNKNOWN 
PIT_ACTION_TYPE 
PIT_ACTION_PHASE 
PIT_ACTION_RETURN_VALUE 
PIT_ACTION_PRIMARY_ELECTION_UUID 
PIT_ACTION_SET_COMMUNICATION_PROTOCOL_VERSION 
PIT_ACTION_TRANSACTION_MONITOR_TIMEOUT 
PIT_ACTION_INITIATOR 
PIT_SENT_TIMESTAMP 
PIT_MAX 

Constructor & Destructor Documentation

◆ Group_action_message() [1/5]

Group_action_message::Group_action_message ( )

Message constructor.

◆ Group_action_message() [2/5]

Group_action_message::Group_action_message ( enum_action_message_type  type)

Message constructor.

Parameters
[in]typethe action message type

◆ Group_action_message() [3/5]

Group_action_message::Group_action_message ( std::string &  primary_uuid,
int32 transaction_monitor_timeout_arg 
)

Message constructor for ACTION_PRIMARY_ELECTION_MESSAGE action type.

Parameters
[in]primary_uuidthe primary uuid to elect
[in]transaction_monitor_timeout_argThe number of seconds to wait before setting the kill flag for the transactions that did not reach commit stage

◆ Group_action_message() [4/5]

Group_action_message::Group_action_message ( Gcs_protocol_version  gcs_protocol)
explicit

Message constructor for ACTION_SET_COMMUNICATION_PROTOCOL_MESSAGE action type.

Parameters
[in]gcs_protocolthe GCS protocol to change to

◆ ~Group_action_message()

Group_action_message::~Group_action_message ( )
overridedefault

Message destructor.

◆ Group_action_message() [5/5]

Group_action_message::Group_action_message ( const uchar buf,
size_t  len 
)

Message constructor for raw data.

Parameters
[in]bufraw data
[in]lenraw length

Member Function Documentation

◆ decode_payload()

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

Message decoding method.

Parameters
[in]bufferthe received data
[in]endthe end of the buffer.

Implements Plugin_gcs_message.

◆ encode_payload()

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

Encodes the message contents for transmission.

Parameters
[out]bufferthe message buffer to be written

Implements Plugin_gcs_message.

◆ get_action_initiator()

const enum_action_initiator_and_action & Group_action_message::get_action_initiator ( )
inline
Returns
Identifier for Group action initiator

◆ get_action_type()

Group_action_message::enum_action_message_type Group_action_message::get_action_type ( const uchar buf)
static

Check what is the action that this message encodes from a buffer.

Parameters
bufthe raw data buffer
Returns
If the message is a primary election action or other

◆ get_gcs_protocol()

const Gcs_protocol_version & Group_action_message::get_gcs_protocol ( )

Returns the GCS protocol this group action wants the group to change to.

Returns
the GCS protocol version

◆ get_group_action_message_phase()

enum_action_message_phase Group_action_message::get_group_action_message_phase ( )
inline

Returns this group action message phase.

◆ get_group_action_message_type()

enum_action_message_type Group_action_message::get_group_action_message_type ( )
inline

Returns this group action message type.

◆ get_primary_to_elect_uuid()

const std::string & Group_action_message::get_primary_to_elect_uuid ( )

Returns this group action primary to be elected uuid.

Returns
the primary to be elected uuid, which can be empty

◆ get_return_value()

int32 Group_action_message::get_return_value ( )
inline
Returns
The return value associated to this message.

◆ get_sent_timestamp()

uint64_t Group_action_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.

◆ get_transaction_monitor_timeout()

int32 Group_action_message::get_transaction_monitor_timeout ( )

Returns the running_transactions_timeout.

Returns
the running_transactions_timeout value

◆ set_action_initiator()

void Group_action_message::set_action_initiator ( const enum_action_initiator_and_action  initiator)
inline

Set the action initiator.

Parameters
initiatorIdentifier for Group action initiator

◆ set_group_action_message_phase()

void Group_action_message::set_group_action_message_phase ( enum_action_message_phase  phase)
inline

◆ set_return_value()

void Group_action_message::set_return_value ( int  return_value_arg)
inline

Set the return value for this message.

Parameters
return_value_argthe value to set

Member Data Documentation

◆ gcs_protocol

Gcs_protocol_version Group_action_message::gcs_protocol
private

The GCS protocol version to change to.

◆ group_action_phase

enum_action_message_phase Group_action_message::group_action_phase
private

If it is a start, stop or other message.

◆ group_action_type

enum_action_message_type Group_action_message::group_action_type
private

The action type for this message.

◆ m_action_initiator

enum_action_initiator_and_action Group_action_message::m_action_initiator
private

Group action identifier.

◆ m_transaction_monitor_timeout

int32 Group_action_message::m_transaction_monitor_timeout {-1}
private

The number of seconds to wait before setting the kill flag for the transactions that did not reach commit stage.

◆ primary_election_uuid

std::string Group_action_message::primary_election_uuid
private

The uuid for election, can be empty if not defined.

◆ return_value

int32 Group_action_message::return_value
private

Is there any return value associated to this action.


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