MySQL 8.0.40
Source Code Documentation
group_validation_message.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef GROUP_VALIDATION_MESSAGE_INCLUDED
25#define GROUP_VALIDATION_MESSAGE_INCLUDED
26
27#include "my_inttypes.h"
29
30/** The base message for group validation messages */
32 public:
33 /** Enum for message payload */
35 PIT_UNKNOWN = 0, // Not used
36 PIT_VALIDATION_TYPE = 1, // The validation type, length: 2 bytes
37 PIT_VALIDATION_CHANNEL = 2, // The member has channel flag, length: 1 bytes
38 PIT_MEMBER_WEIGHT = 3, // The member weight, length: 2 bytes
39 PIT_MAX // No valid type codes can appear after this one
40 };
41
42 /** Enum for the types of validation action **/
45 ELECTION_VALIDATION_MESSAGE = 1, // Member info for elections
46 GROUP_VALIDATION_MESSAGE_END = 2 // Enum end value
47 };
48
49 /**
50 Class constructor
51 @param has_channels This member has running slave channels?
52 @param member_weight_arg The election weight of this member
53 */
54 Group_validation_message(bool has_channels, uint member_weight_arg);
55
56 /**
57 Message constructor for raw data
58
59 @param[in] buf raw data
60 @param[in] len raw length
61 */
62 Group_validation_message(const uchar *buf, size_t len);
63
64 /** Class destructor */
66
67 /**
68 Does the member has running channels
69 @return true if yes, false otherwise
70 */
71 bool has_slave_channels() const;
72
73 /**
74 The election weight of this member
75 @return The member weight
76 */
77 uint get_member_weight() const;
78
79 protected:
80 /**
81 Encodes the message contents for transmission.
82
83 @param[out] buffer the message buffer to be written
84 */
85 void encode_payload(std::vector<unsigned char> *buffer) const override;
86
87 /**
88 Message decoding method
89
90 @param[in] buffer the received data
91 */
92 void decode_payload(const unsigned char *buffer,
93 const unsigned char *) override;
94
95 private:
96 /**The message type*/
98
99 /** Does the member has channels? */
101
102 /** The member election weight */
104};
105
106#endif /* GROUP_VALIDATION_MESSAGE_INCLUDED */
The base message for group validation messages.
Definition: group_validation_message.h:31
uint member_weight
The member election weight.
Definition: group_validation_message.h:103
bool has_slave_channels() const
Does the member has running channels.
Definition: group_validation_message.cc:41
enum_payload_item_type
Enum for message payload.
Definition: group_validation_message.h:34
@ PIT_VALIDATION_CHANNEL
Definition: group_validation_message.h:37
@ PIT_VALIDATION_TYPE
Definition: group_validation_message.h:36
@ PIT_MAX
Definition: group_validation_message.h:39
@ PIT_UNKNOWN
Definition: group_validation_message.h:35
@ PIT_MEMBER_WEIGHT
Definition: group_validation_message.h:38
Group_validation_message(bool has_channels, uint member_weight_arg)
Class constructor.
Definition: group_validation_message.cc:27
enum_validation_message_type group_validation_message_type
The message type.
Definition: group_validation_message.h:97
void decode_payload(const unsigned char *buffer, const unsigned char *) override
Message decoding method.
Definition: group_validation_message.cc:49
void encode_payload(std::vector< unsigned char > *buffer) const override
Encodes the message contents for transmission.
Definition: group_validation_message.cc:70
uint get_member_weight() const
The election weight of this member.
Definition: group_validation_message.cc:45
~Group_validation_message() override
Class destructor.
enum_validation_message_type
Enum for the types of validation action.
Definition: group_validation_message.h:43
@ GROUP_VALIDATION_MESSAGE_END
Definition: group_validation_message.h:46
@ GROUP_VALIDATION_UNKNOWN_MESSAGE
Definition: group_validation_message.h:44
@ ELECTION_VALIDATION_MESSAGE
Definition: group_validation_message.h:45
bool has_channels
Does the member has channels?
Definition: group_validation_message.h:100
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
Definition: buf0block_hint.cc:30
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
unsigned int uint
Definition: uca9-dump.cc:75