MySQL  8.0.19
Source Code Documentation
partition.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
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 
31 namespace dd {
32 
33 ///////////////////////////////////////////////////////////////////////////
34 
35 class Index;
36 class Partition_impl;
37 class Partition_index;
38 class Partition_value;
39 class Properties;
40 class Table;
41 template <typename T>
42 class Collection;
43 
44 namespace tables {
45 class Table_partitions;
46 }
47 
48 ///////////////////////////////////////////////////////////////////////////
49 
50 class Partition : virtual public Entity_object {
51  public:
56 
57  public:
58  virtual ~Partition() {}
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;
87  virtual void set_description_utf8(const String_type &description_utf8) = 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 
119  virtual Properties &se_private_data() = 0;
120 
121  virtual bool set_se_private_data(const String_type &se_private_data_raw) = 0;
122 
123  virtual bool set_se_private_data(const Properties &se_private_data) = 0;
124 
125  /////////////////////////////////////////////////////////////////////////
126  // se_private_id.
127  /////////////////////////////////////////////////////////////////////////
128 
129  virtual Object_id se_private_id() const = 0;
130  virtual void set_se_private_id(Object_id se_private_id) = 0;
131 
132  /////////////////////////////////////////////////////////////////////////
133  // Tablespace.
134  /////////////////////////////////////////////////////////////////////////
135 
136  virtual Object_id tablespace_id() const = 0;
137  virtual void set_tablespace_id(Object_id tablespace_id) = 0;
138 
139  /////////////////////////////////////////////////////////////////////////
140  // Partition-value collection.
141  /////////////////////////////////////////////////////////////////////////
142 
143  virtual Partition_value *add_value() = 0;
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 
155  virtual Partition_indexes *indexes() = 0;
156 
157  /////////////////////////////////////////////////////////////////////////
158  // Sub Partition collection.
159  /////////////////////////////////////////////////////////////////////////
160 
161  /// Add a subpartition to a parent partition.
162  virtual Partition *add_subpartition() = 0;
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
dd::Partition::engine
virtual const String_type & engine() const =0
dd::Partition::set_parent
virtual void set_parent(const Partition *parent)=0
dd::Properties
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:73
dd::Partition::description_utf8
virtual const String_type & description_utf8() const =0
dd::Entity_object
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:47
dd::Partition_impl
Definition: partition_impl.h:59
dd::Partition::Partition_values
Collection< Partition_value * > Partition_values
Definition: partition.h:53
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
dd::Partition::set_tablespace_id
virtual void set_tablespace_id(Object_id tablespace_id)=0
dd::Partition_index
Definition: partition_index.h:46
dd::Partition::serialize
virtual void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const =0
Converts *this into json.
dd::Partition::values
virtual const Partition_values & values() const =0
dd::RJ_Value
rapidjson::GenericValue< RJ_Encoding, RJ_Allocator > RJ_Value
Definition: sdi_fwd.h:48
dd::Partition_value
Definition: partition_value.h:44
dd::Partition::set_options
virtual bool set_options(const Properties &options)=0
dd::Collection
Definition: collection.h:45
dd::Partition::set_comment
virtual void set_comment(const String_type &comment)=0
dd::Partition::number
virtual uint number() const =0
dd::Partition::DD_table
tables::Table_partitions DD_table
Definition: partition.h:55
dd::Partition::set_se_private_id
virtual void set_se_private_id(Object_id se_private_id)=0
dd::Sdi_rcontext
Opaque context which keeps reusable resoureces needed during deserialization.
Definition: sdi.cc:229
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
dd::Partition::set_engine
virtual void set_engine(const String_type &engine)=0
dd::Partition::Impl
Partition_impl Impl
Definition: partition.h:54
dd::Partition::set_parent_partition_id
virtual void set_parent_partition_id(Object_id parent_partition_id)=0
dd::Partition::set_description_utf8
virtual void set_description_utf8(const String_type &description_utf8)=0
Table
Definition: test_sql_stmt.cc:150
dd::Partition::parent_partition_id
virtual Object_id parent_partition_id() const =0
dd::Partition::options
virtual const Properties & options() const =0
my_inttypes.h
dd::Partition::deserialize
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...
uint
unsigned int uint
Definition: uca-dump.cc:29
dd::Sdi_writer
RJ_Writer Sdi_writer
Alias for the rapidjson Writer type to use in serialization.
Definition: sdi_fwd.h:63
dd::Partition::parent
virtual const Partition * parent() const =0
table.h
dd::tables::Table_partitions
Definition: table_partitions.h:41
dd::Table
Definition: table.h:45
dd::Sdi_wcontext
Opaque context which keeps reusable resources needed during serialization.
Definition: sdi.cc:126
dd::Partition::comment
virtual const String_type & comment() const =0
dd::Partition::add_subpartition
virtual Partition * add_subpartition()=0
Add a subpartition to a parent partition.
dd::Object_id
unsigned long long Object_id
Definition: object_id.h:30
sdi_fwd.h
dd::Partition::subpartitions
virtual const Table::Partition_collection & subpartitions() const =0
Return reference to const collection of sub partitions.
dd::Partition::se_private_data
virtual const Properties & se_private_data() const =0
dd::Partition::Partition_indexes
Collection< Partition_index * > Partition_indexes
Definition: partition.h:52
dd::Index
Definition: index.h:49
dd::Partition::set_se_private_data
virtual bool set_se_private_data(const String_type &se_private_data_raw)=0
dd::Partition::table
virtual const Table & table() const =0
entity_object.h
dd::Partition::set_number
virtual void set_number(uint number)=0
dd::Partition::se_private_id
virtual Object_id se_private_id() const =0
dd::Partition
Definition: partition.h:50
dd::Partition::add_index
virtual Partition_index * add_index(Index *idx)=0
dd::Partition::~Partition
virtual ~Partition()
Definition: partition.h:58
dd::Partition::indexes
virtual const Partition_indexes & indexes() const =0
dd::Partition::add_value
virtual Partition_value * add_value()=0
dd::Partition::tablespace_id
virtual Object_id tablespace_id() const =0