MySQL 9.1.0
Source Code Documentation
recovery_metadata_message_compressed_parts.h
Go to the documentation of this file.
1/* Copyright (c) 2023, 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_METADATA_MESSAGE_COMPRESSED_PARTS_INCLUDED
25#define RECOVERY_METADATA_MESSAGE_COMPRESSED_PARTS_INCLUDED
26
27#include "my_inttypes.h"
30
31/**
32 This class contains custom iterator written to decode compressed
33 certification info of Recovery Metadata Message.
34*/
36 public:
37 /**
38 Recovery_metadata_message_compressed_parts constructor.
39
40 @param[in] recovery_metadata_message pointer to Recovery_metadata_message.
41 @param[in] count Number of packets of Compressed
42 certification info.
43 */
45 Recovery_metadata_message *recovery_metadata_message, uint count);
46
47 struct Iterator {
48 using iterator_category = std::forward_iterator_tag;
49 using difference_type = std::ptrdiff_t;
50
51 /**
52 Iterator constructor.
53
54 @param[in] recovery_metadata_message pointer to
55 Recovery_metadata_message.
56 @param[in] packet_count Number of packets of Compressed
57 certification info.
58 */
59 Iterator(Recovery_metadata_message *recovery_metadata_message,
60 uint packet_count);
61
62 /**
63 The Recovery Metadata payload may contain multiple packets of compressed
64 data. The dereference operator will return tuple of compressed payload,
65 compressed payload length and length of payload before it was compressed
66 i.e. uncompressed payload length for one of the packet.
67
68 @return the tuple of compressed payload, compressed payload length and
69 uncompressed payload length.
70 */
71 std::tuple<const unsigned char *, unsigned long long, unsigned long long>
72 operator*();
73
74 /**
75 The Recovery Metadata payload may contain multiple packets of compressed
76 data. The prefix increment operator will increment pointer to compressed
77 payload position so that it can point to next Recovery Metadata
78 compressed data packet.
79
80 @return a reference to Iterator object.
81 */
83
84 /**
85 The Recovery Metadata payload may contain multiple packets of compressed
86 data. The postfix increment operator will increment pointer to
87 compressed payload position so that it can point to next Recovery
88 Metadata compressed data packet.
89
90 @return a copy of Iterator before increment.
91 */
93
94 /**
95 The Recovery Metadata payload may contain multiple packets of compressed
96 data. The comparsion operator compare packets.
97
98 @retval false If m_count or packet number of packets is not equal.
99 @retval true If m_count or packet number of packets is equal.
100 */
101 bool operator==(Iterator &b);
102
103 /**
104 The Recovery Metadata payload may contain multiple packets of compressed
105 data. The comparsion operator compare packets.
106
107 @retval false If m_count or packet number of packets is equal.
108 @retval true If m_count or packet number of packets is not equal.
109 */
110 bool operator!=(Iterator &b);
111
112 private:
113 /* Compressed payload position */
114 const unsigned char *m_payload_pos;
115
116 /* Compressed payload length */
117 unsigned long long m_payload_length{0};
118
119 /* Compressed payload uncompressed length */
120 unsigned long long m_payload_uncompressed_length{0};
121
122 /* Compressed payload packet number */
123 uint m_count{0};
124
125 /* Recovery_metadata_message pointer */
127 };
128
129 /**
130 The Recovery Metadata payload may contain multiple packets of compressed
131 data. This will return a pointer to the first compressed data packet.
132
133 @return a pointer to Iterator front or first compressed data packet.
134 */
135 Iterator begin() noexcept;
136
137 /**
138 The Recovery Metadata payload may contain multiple packets of compressed
139 data. This will return a pointer to the last compressed data packet.
140
141 @return a pointer to Iterator back or last compressed data packet.
142 */
143 Iterator end() noexcept;
144
145 private:
146 /* Compressed payload position */
147 const unsigned char *m_payload_start;
148
149 /* Compressed payload packet count */
151
152 /* Recovery_metadata_message pointer */
154};
155
156#endif /* RECOVERY_METADATA_MESSAGE_COMPRESSED_PARTS_INCLUDED */
This class contains custom iterator written to decode compressed certification info of Recovery Metad...
Definition: recovery_metadata_message_compressed_parts.h:35
uint m_payload_packet_count
Definition: recovery_metadata_message_compressed_parts.h:150
Iterator begin() noexcept
The Recovery Metadata payload may contain multiple packets of compressed data.
Definition: recovery_metadata_message_compressed_parts.cc:41
Iterator end() noexcept
The Recovery Metadata payload may contain multiple packets of compressed data.
Definition: recovery_metadata_message_compressed_parts.cc:46
Recovery_metadata_message * m_recovery_metadata_message
Definition: recovery_metadata_message_compressed_parts.h:153
const unsigned char * m_payload_start
Definition: recovery_metadata_message_compressed_parts.h:147
Recovery_metadata_message_compressed_parts(Recovery_metadata_message *recovery_metadata_message, uint count)
Recovery_metadata_message_compressed_parts constructor.
Definition: recovery_metadata_message_compressed_parts.cc:34
Definition: recovery_metadata_message.h:36
Some integer typedefs for easier portability.
static int count
Definition: myisam_ftdump.cc:45
Definition: recovery_metadata_message_compressed_parts.h:47
bool operator!=(Iterator &b)
The Recovery Metadata payload may contain multiple packets of compressed data.
Definition: recovery_metadata_message_compressed_parts.cc:143
Iterator(Recovery_metadata_message *recovery_metadata_message, uint packet_count)
Iterator constructor.
Definition: recovery_metadata_message_compressed_parts.cc:52
const unsigned char * m_payload_pos
Definition: recovery_metadata_message_compressed_parts.h:114
Recovery_metadata_message * m_recovery_metadata_message
Definition: recovery_metadata_message_compressed_parts.h:126
unsigned long long m_payload_length
Definition: recovery_metadata_message_compressed_parts.h:117
unsigned long long m_payload_uncompressed_length
Definition: recovery_metadata_message_compressed_parts.h:120
bool operator==(Iterator &b)
The Recovery Metadata payload may contain multiple packets of compressed data.
Definition: recovery_metadata_message_compressed_parts.cc:139
std::tuple< const unsigned char *, unsigned long long, unsigned long long > operator*()
The Recovery Metadata payload may contain multiple packets of compressed data.
Definition: recovery_metadata_message_compressed_parts.cc:60
std::forward_iterator_tag iterator_category
Definition: recovery_metadata_message_compressed_parts.h:48
Iterator & operator++()
The Recovery Metadata payload may contain multiple packets of compressed data.
Definition: recovery_metadata_message_compressed_parts.cc:112
uint m_count
Definition: recovery_metadata_message_compressed_parts.h:123
std::ptrdiff_t difference_type
Definition: recovery_metadata_message_compressed_parts.h:49