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