MySQL  8.0.21
Source Code Documentation
Single_primary_message Class Reference

#include <single_primary_message.h>

Inheritance diagram for Single_primary_message:
Plugin_gcs_message

Public Types

enum  enum_payload_item_type {
  PIT_UNKNOWN = 0, PIT_SINGLE_PRIMARY_MESSAGE_TYPE = 1, PIT_SINGLE_PRIMARY_SERVER_UUID = 2, PIT_SINGLE_PRIMARY_ELECTION_MODE = 3,
  PIT_MAX = 4
}
 
enum  Single_primary_message_type {
  SINGLE_PRIMARY_UNKNOWN = 0, SINGLE_PRIMARY_NEW_PRIMARY_MESSAGE = 1, SINGLE_PRIMARY_QUEUE_APPLIED_MESSAGE = 2, SINGLE_PRIMARY_NO_RESTRICTED_TRANSACTIONS = 3,
  SINGLE_PRIMARY_PRIMARY_ELECTION = 4, SINGLE_PRIMARY_PRIMARY_READY = 5, SINGLE_PRIMARY_READ_MODE_SET = 6, SINGLE_PRIMARY_MESSAGE_TYPE_END = 7
}
 The several single primary type messages. 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_MAX = 14
}
 The different cargo type codes. More...
 

Public Member Functions

 Single_primary_message (Single_primary_message_type type)
 Message constructor. More...
 
 Single_primary_message (std::string &primary_uuid, enum_primary_election_mode election_mode)
 Message constructor for primary election invocations. More...
 
virtual ~Single_primary_message ()
 Message destructor. More...
 
 Single_primary_message (const uchar *buf, size_t len)
 Message constructor for raw data. More...
 
Single_primary_message_type get_single_primary_message_type () const
 Returns this single primary message type. More...
 
std::string & get_primary_uuid ()
 
enum_primary_election_mode get_election_mode ()
 
- Public Member Functions inherited from Plugin_gcs_message
virtual ~Plugin_gcs_message ()
 
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...
 

Protected Member Functions

void encode_payload (std::vector< unsigned char > *buffer) const
 Encodes the message contents for transmission. More...
 
void decode_payload (const unsigned char *buffer, const unsigned char *end)
 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_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...
 

Private Attributes

Single_primary_message_type single_primary_message_type
 The message type. More...
 
std::string primary_uuid
 The uuid for the primary member. More...
 
enum_primary_election_mode election_mode
 The mode for election requests. More...
 

Additional Inherited Members

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

Member Enumeration Documentation

◆ enum_payload_item_type

Enumerator
PIT_UNKNOWN 
PIT_SINGLE_PRIMARY_MESSAGE_TYPE 
PIT_SINGLE_PRIMARY_SERVER_UUID 
PIT_SINGLE_PRIMARY_ELECTION_MODE 
PIT_MAX 

◆ Single_primary_message_type

The several single primary type messages.

Enumerator
SINGLE_PRIMARY_UNKNOWN 

This type should not be used anywhere.

SINGLE_PRIMARY_NEW_PRIMARY_MESSAGE 

A new primary was elected.

SINGLE_PRIMARY_QUEUE_APPLIED_MESSAGE 

Primary did apply queue after election.

SINGLE_PRIMARY_NO_RESTRICTED_TRANSACTIONS 

No more forbidden transactions on multi master remain.

SINGLE_PRIMARY_PRIMARY_ELECTION 

Invoke a new election.

SINGLE_PRIMARY_PRIMARY_READY 

The primary is now ready, processed all the backlog.

SINGLE_PRIMARY_READ_MODE_SET 

The member as set the read on the election context.

SINGLE_PRIMARY_MESSAGE_TYPE_END 

The end of the enum.

Constructor & Destructor Documentation

◆ Single_primary_message() [1/3]

Single_primary_message::Single_primary_message ( Single_primary_message_type  type)

Message constructor.

Parameters
[in]typethe single primary message type

◆ Single_primary_message() [2/3]

Single_primary_message::Single_primary_message ( std::string &  primary_uuid,
enum_primary_election_mode  election_mode 
)

Message constructor for primary election invocations.

Note
this message will use type SINGLE_PRIMARY_PRIMARY_ELECTION
Parameters
primary_uuidThe primary uuid to elect
election_modeThe election mode to perform

◆ ~Single_primary_message()

Single_primary_message::~Single_primary_message ( )
virtual

Message destructor.

◆ Single_primary_message() [3/3]

Single_primary_message::Single_primary_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 Single_primary_message::decode_payload ( const unsigned char *  buffer,
const unsigned char *  end 
)
protectedvirtual

Message decoding method.

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

Implements Plugin_gcs_message.

◆ encode_payload()

void Single_primary_message::encode_payload ( std::vector< unsigned char > *  buffer) const
protectedvirtual

Encodes the message contents for transmission.

Parameters
[out]bufferthe message buffer to be written

Implements Plugin_gcs_message.

◆ get_election_mode()

enum_primary_election_mode Single_primary_message::get_election_mode ( )
Note
This method should only be used with type SINGLE_PRIMARY_PRIMARY_ELECTION
Returns
the election mode associated to this message

◆ get_primary_uuid()

std::string & Single_primary_message::get_primary_uuid ( )
Note
This method should only be used with type SINGLE_PRIMARY_PRIMARY_ELECTION
Returns
the primary uuid associated to this message

◆ get_single_primary_message_type()

Single_primary_message_type Single_primary_message::get_single_primary_message_type ( ) const
inline

Returns this single primary message type.

Member Data Documentation

◆ election_mode

enum_primary_election_mode Single_primary_message::election_mode
private

The mode for election requests.

◆ primary_uuid

std::string Single_primary_message::primary_uuid
private

The uuid for the primary member.

◆ single_primary_message_type

Single_primary_message_type Single_primary_message::single_primary_message_type
private

The message type.


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