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