MySQL 9.1.0
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 // Length of the payload item: 8 bytes
48
49 // No valid type codes can appear after this one.
50 PIT_MAX = 4
51 };
52
53 /**
54 The several recovery type messages.
55 */
56 typedef enum {
57 /**This type should not be used anywhere.*/
59 /**Recovery ended, member is online.*/
61 /**Donor transmitted all data (for future use)*/
63 /**The end of the enum.*/
66
67 /**
68 Message constructor
69
70 @param[in] type the recovery message type
71 @param[in] member_uuid the origination member uuid
72 */
74
75 /**
76 Message destructor
77 */
79
80 /**
81 Message constructor for raw data
82
83 @param[in] buf raw data
84 @param[in] len raw length
85 */
86 Recovery_message(const uchar *buf, size_t len);
87
88 /** Returns this recovery message type */
91 }
92
93 /** Returns this message sender's uuid */
94 const std::string &get_member_uuid() { return member_uuid; }
95
96 /**
97 Return the time at which the message contained in the buffer was sent.
98 @see Metrics_handler::get_current_time()
99
100 @param[in] buffer the buffer to decode from.
101 @param[in] length the buffer length
102
103 @return the time on which the message was sent.
104 */
105 static uint64_t get_sent_timestamp(const unsigned char *buffer,
106 size_t length);
107
108 protected:
109 /**
110 Encodes the message contents for transmission.
111
112 @param[out] buffer the message buffer to be written
113 */
114 void encode_payload(std::vector<unsigned char> *buffer) const override;
115
116 /**
117 Message decoding method
118
119 @param[in] buffer the received data
120 */
121 void decode_payload(const unsigned char *buffer,
122 const unsigned char *) override;
123
124 private:
125 /**The message type*/
127 /**The member uuid where the message originated*/
128 std::string member_uuid;
129};
130
131#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:128
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.
Definition: recovery_message.cc:73
~Recovery_message() override
Message destructor.
Recovery_message_type get_recovery_message_type()
Returns this recovery message type.
Definition: recovery_message.h:89
const std::string & get_member_uuid()
Returns this message sender's uuid.
Definition: recovery_message.h:94
void decode_payload(const unsigned char *buffer, const unsigned char *) override
Message decoding method.
Definition: recovery_message.cc:42
Recovery_message(Recovery_message_type type, const std::string &member_uuid)
Message constructor.
Definition: recovery_message.cc:29
Recovery_message_type recovery_message_type
The message type.
Definition: recovery_message.h:126
enum_payload_item_type
Definition: recovery_message.h:36
@ PIT_MEMBER_UUID
Definition: recovery_message.h:44
@ PIT_MAX
Definition: recovery_message.h:50
@ PIT_UNKNOWN
Definition: recovery_message.h:38
@ PIT_SENT_TIMESTAMP
Definition: recovery_message.h:47
@ 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:58
Recovery_message_type
The several recovery type messages.
Definition: recovery_message.h:56
@ RECOVERY_END_MESSAGE
Recovery ended, member is online.
Definition: recovery_message.h:60
@ DONOR_FINISHED_MESSAGE
Donor transmitted all data (for future use)
Definition: recovery_message.h:62
@ RECOVERY_UNKNOWN
This type should not be used anywhere.
Definition: recovery_message.h:58
@ RECOVERY_MESSAGE_TYPE_END
The end of the enum.
Definition: recovery_message.h:64
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
Definition: buf0block_hint.cc:30
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
required string type
Definition: replication_group_member_actions.proto:34