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