MySQL 8.0.40
Source Code Documentation
recovery_message.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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 RECOVERY_MESSAGE_INCLUDED
25#define RECOVERY_MESSAGE_INCLUDED
26
27#include <set>
28#include <string>
29#include <vector>
30
31#include "my_inttypes.h"
33
35 public:
37 // This type should not be used anywhere.
39
40 // Length of the payload item: 2 bytes
42
43 // Length of the payload item: variable
45
46 // No valid type codes can appear after this one.
47 PIT_MAX = 3
48 };
49
50 /**
51 The several recovery type messages.
52 */
53 typedef enum {
54 /**This type should not be used anywhere.*/
56 /**Recovery ended, member is online.*/
58 /**Donor transmitted all data (for future use)*/
60 /**The end of the enum.*/
63
64 /**
65 Message constructor
66
67 @param[in] type the recovery message type
68 @param[in] member_uuid the origination member uuid
69 */
71
72 /**
73 Message destructor
74 */
76
77 /**
78 Message constructor for raw data
79
80 @param[in] buf raw data
81 @param[in] len raw length
82 */
83 Recovery_message(const uchar *buf, size_t len);
84
85 /** Returns this recovery message type */
88 }
89
90 /** Returns this message sender's uuid */
91 const std::string &get_member_uuid() { return member_uuid; }
92
93 protected:
94 /**
95 Encodes the message contents for transmission.
96
97 @param[out] buffer the message buffer to be written
98 */
99 void encode_payload(std::vector<unsigned char> *buffer) const override;
100
101 /**
102 Message decoding method
103
104 @param[in] buffer the received data
105 */
106 void decode_payload(const unsigned char *buffer,
107 const unsigned char *) override;
108
109 private:
110 /**The message type*/
112 /**The member uuid where the message originated*/
113 std::string member_uuid;
114};
115
116#endif /* RECOVERY_MESSAGE_INCLUDED */
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
Definition: recovery_message.h:34
std::string member_uuid
The member uuid where the message originated.
Definition: recovery_message.h:113
~Recovery_message() override
Message destructor.
Recovery_message_type get_recovery_message_type()
Returns this recovery message type.
Definition: recovery_message.h:86
const std::string & get_member_uuid()
Returns this message sender's uuid.
Definition: recovery_message.h:91
void decode_payload(const unsigned char *buffer, const unsigned char *) override
Message decoding method.
Definition: recovery_message.cc:41
Recovery_message(Recovery_message_type type, const std::string &member_uuid)
Message constructor.
Definition: recovery_message.cc:28
Recovery_message_type recovery_message_type
The message type.
Definition: recovery_message.h:111
enum_payload_item_type
Definition: recovery_message.h:36
@ PIT_MEMBER_UUID
Definition: recovery_message.h:44
@ PIT_MAX
Definition: recovery_message.h:47
@ PIT_UNKNOWN
Definition: recovery_message.h:38
@ PIT_RECOVERY_MESSAGE_TYPE
Definition: recovery_message.h:41
void encode_payload(std::vector< unsigned char > *buffer) const override
Encodes the message contents for transmission.
Definition: recovery_message.cc:57
Recovery_message_type
The several recovery type messages.
Definition: recovery_message.h:53
@ RECOVERY_END_MESSAGE
Recovery ended, member is online.
Definition: recovery_message.h:57
@ DONOR_FINISHED_MESSAGE
Donor transmitted all data (for future use)
Definition: recovery_message.h:59
@ RECOVERY_UNKNOWN
This type should not be used anywhere.
Definition: recovery_message.h:55
@ RECOVERY_MESSAGE_TYPE_END
The end of the enum.
Definition: recovery_message.h:61
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
required string type
Definition: replication_group_member_actions.proto:34