MySQL 8.4.0
Source Code Documentation
partition.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 DD__PARTITION_INCLUDED
25#define DD__PARTITION_INCLUDED
26
27#include "my_inttypes.h"
28#include "sql/dd/sdi_fwd.h" // dd::Sdi_wcontext
29#include "sql/dd/types/entity_object.h" // dd::Entity_object
30#include "sql/dd/types/table.h" // Table::Partition_collection
31
32namespace dd {
33
34///////////////////////////////////////////////////////////////////////////
35
36class Index;
37class Partition_impl;
38class Partition_index;
39class Partition_value;
40class Properties;
41class Table;
42template <typename T>
43class Collection;
44
45namespace tables {
46class Table_partitions;
47}
48
49///////////////////////////////////////////////////////////////////////////
50
51class Partition : virtual public Entity_object {
52 public:
57
58 public:
59 ~Partition() override = default;
60
61 /////////////////////////////////////////////////////////////////////////
62 // Table.
63 /////////////////////////////////////////////////////////////////////////
64
65 virtual const Table &table() const = 0;
66
67 virtual Table &table() = 0;
68
69 /////////////////////////////////////////////////////////////////////////
70 // parent_partition_id.
71 /////////////////////////////////////////////////////////////////////////
72
73 virtual Object_id parent_partition_id() const = 0;
75
76 /////////////////////////////////////////////////////////////////////////
77 // number.
78 /////////////////////////////////////////////////////////////////////////
79
80 virtual uint number() const = 0;
81 virtual void set_number(uint number) = 0;
82
83 /////////////////////////////////////////////////////////////////////////
84 // description_utf8.
85 /////////////////////////////////////////////////////////////////////////
86
87 virtual const String_type &description_utf8() const = 0;
89
90 /////////////////////////////////////////////////////////////////////////
91 // engine.
92 /////////////////////////////////////////////////////////////////////////
93
94 virtual const String_type &engine() const = 0;
95 virtual void set_engine(const String_type &engine) = 0;
96
97 /////////////////////////////////////////////////////////////////////////
98 // Comment.
99 /////////////////////////////////////////////////////////////////////////
100
101 virtual const String_type &comment() const = 0;
102 virtual void set_comment(const String_type &comment) = 0;
103
104 /////////////////////////////////////////////////////////////////////////
105 // Options.
106 /////////////////////////////////////////////////////////////////////////
107
108 virtual const Properties &options() const = 0;
109
110 virtual Properties &options() = 0;
111 virtual bool set_options(const Properties &options) = 0;
112 virtual bool set_options(const String_type &options_raw) = 0;
113
114 /////////////////////////////////////////////////////////////////////////
115 // se_private_data.
116 /////////////////////////////////////////////////////////////////////////
117
118 virtual const Properties &se_private_data() const = 0;
119
121
122 virtual bool set_se_private_data(const String_type &se_private_data_raw) = 0;
123
125
126 /////////////////////////////////////////////////////////////////////////
127 // se_private_id.
128 /////////////////////////////////////////////////////////////////////////
129
130 virtual Object_id se_private_id() const = 0;
132
133 /////////////////////////////////////////////////////////////////////////
134 // Tablespace.
135 /////////////////////////////////////////////////////////////////////////
136
137 virtual Object_id tablespace_id() const = 0;
139
140 /////////////////////////////////////////////////////////////////////////
141 // Partition-value collection.
142 /////////////////////////////////////////////////////////////////////////
143
145
146 virtual const Partition_values &values() const = 0;
147
148 /////////////////////////////////////////////////////////////////////////
149 // Partition-index collection.
150 /////////////////////////////////////////////////////////////////////////
151
152 virtual Partition_index *add_index(Index *idx) = 0;
153
154 virtual const Partition_indexes &indexes() const = 0;
155
157
158 /////////////////////////////////////////////////////////////////////////
159 // Sub Partition collection.
160 /////////////////////////////////////////////////////////////////////////
161
162 /// Add a subpartition to a parent partition.
164
165 /// Return reference to const collection of sub partitions.
166 virtual const Table::Partition_collection &subpartitions() const = 0;
167
168 /// Return non-const point to collection of sub partitions.
170
171 /////////////////////////////////////////////////////////////////////////
172 // Parent partition for subpartitions (NULL otherwise).
173 /////////////////////////////////////////////////////////////////////////
174 virtual const Partition *parent() const = 0;
175 virtual void set_parent(const Partition *parent) = 0;
176
177 /**
178 Converts *this into json.
179
180 Converts all member variables that are to be included in the sdi
181 into json by transforming them appropriately and passing them to
182 the rapidjson writer provided.
183
184 @param wctx opaque context for data needed by serialization
185 @param w rapidjson writer which will perform conversion to json
186
187 */
188
189 virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const = 0;
190
191 /**
192 Re-establishes the state of *this by reading sdi information from
193 the rapidjson DOM subobject provided.
194
195 Cross-references encountered within this object are tracked in
196 sdictx, so that they can be updated when the entire object graph
197 has been established.
198
199 @param rctx stores book-keeping information for the
200 deserialization process
201 @param val subobject of rapidjson DOM containing json
202 representation of this object
203 */
204
205 virtual bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) = 0;
206};
207
208///////////////////////////////////////////////////////////////////////////
209
210} // namespace dd
211
212#endif // DD__PARTITION_INCLUDED
Definition: collection.h:44
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:48
Definition: index.h:51
Definition: partition_impl.h:60
Definition: partition_index.h:47
Definition: partition_value.h:45
Definition: partition.h:51
~Partition() override=default
virtual Properties & se_private_data()=0
virtual Partition * add_subpartition()=0
Add a subpartition to a parent partition.
virtual void set_se_private_id(Object_id se_private_id)=0
virtual void set_comment(const String_type &comment)=0
virtual void set_number(uint number)=0
virtual bool set_options(const String_type &options_raw)=0
virtual Table & table()=0
virtual Partition_index * add_index(Index *idx)=0
virtual bool set_options(const Properties &options)=0
virtual Object_id parent_partition_id() const =0
tables::Table_partitions DD_table
Definition: partition.h:56
virtual uint number() const =0
virtual bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val)=0
Re-establishes the state of *this by reading sdi information from the rapidjson DOM subobject provide...
virtual const Partition_values & values() const =0
virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const =0
Converts *this into json.
Collection< Partition_value * > Partition_values
Definition: partition.h:54
virtual Object_id se_private_id() const =0
virtual const String_type & description_utf8() const =0
virtual Partition_value * add_value()=0
virtual bool set_se_private_data(const String_type &se_private_data_raw)=0
Collection< Partition_index * > Partition_indexes
Definition: partition.h:53
virtual const Properties & options() const =0
virtual void set_parent_partition_id(Object_id parent_partition_id)=0
virtual void set_description_utf8(const String_type &description_utf8)=0
virtual Partition_indexes * indexes()=0
virtual const Table & table() const =0
virtual bool set_se_private_data(const Properties &se_private_data)=0
virtual Object_id tablespace_id() const =0
virtual const Table::Partition_collection & subpartitions() const =0
Return reference to const collection of sub partitions.
virtual Table::Partition_collection * subpartitions()=0
Return non-const point to collection of sub partitions.
virtual void set_engine(const String_type &engine)=0
virtual void set_parent(const Partition *parent)=0
virtual const String_type & engine() const =0
virtual Properties & options()=0
virtual const Properties & se_private_data() const =0
virtual const Partition * parent() const =0
Partition_impl Impl
Definition: partition.h:55
virtual const String_type & comment() const =0
virtual const Partition_indexes & indexes() const =0
virtual void set_tablespace_id(Object_id tablespace_id)=0
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:74
Opaque context which keeps reusable resoureces needed during deserialization.
Definition: sdi.cc:231
Opaque context which keeps reusable resources needed during serialization.
Definition: sdi.cc:129
Definition: table.h:47
Definition: table_partitions.h:44
Some integer typedefs for easier portability.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
RJ_Writer Sdi_writer
Alias for the rapidjson Writer type to use in serialization.
Definition: sdi_fwd.h:64
unsigned long long Object_id
Definition: object_id.h:31
rapidjson::GenericValue< RJ_Encoding, RJ_Allocator > RJ_Value
Definition: sdi_fwd.h:49
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:51
Definition: options.cc:57
This header provides Rapidjson Type Aliases.