MySQL 8.0.40
Source Code Documentation
partition_index_impl.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_INDEX_IMPL_INCLUDED
25#define DD__PARTITION_INDEX_IMPL_INCLUDED
26
27#include <stddef.h>
28#include <sys/types.h>
29#include <memory>
30#include <new>
31
33#include "sql/dd/impl/types/weak_object_impl.h" // dd::Weak_object_impl
34#include "sql/dd/object_id.h"
35#include "sql/dd/sdi_fwd.h"
36#include "sql/dd/string_type.h"
37#include "sql/dd/types/index.h"
38#include "sql/dd/types/partition_index.h" // dd::Partition_index
39
40namespace dd {
41
42///////////////////////////////////////////////////////////////////////////
43
44class Index;
45class Object_key;
46class Object_table;
47class Open_dictionary_tables_ctx;
48class Partition;
49class Partition_impl;
50class Raw_record;
51class Sdi_rcontext;
52class Sdi_wcontext;
53class Weak_object;
54
55///////////////////////////////////////////////////////////////////////////
56
58 public:
60
62
64 Index *index);
65
66 ~Partition_index_impl() override = default;
67
68 public:
69 const Object_table &object_table() const override;
70
71 bool validate() const override;
72
73 bool restore_attributes(const Raw_record &r) override;
74
75 bool store_attributes(Raw_record *r) override;
76
77 void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override;
78
79 bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override;
80
81 void debug_print(String_type &outb) const override;
82
84
85 virtual uint ordinal_position() const { return -1; }
86
87 public:
89
90 /////////////////////////////////////////////////////////////////////////
91 // Partition.
92 /////////////////////////////////////////////////////////////////////////
93
94 const Partition &partition() const override;
95
96 Partition &partition() override;
97
99
100 /////////////////////////////////////////////////////////////////////////
101 // Index.
102 /////////////////////////////////////////////////////////////////////////
103
104 const Index &index() const override;
105
106 Index &index() override;
107
108 /////////////////////////////////////////////////////////////////////////
109 // Options.
110 /////////////////////////////////////////////////////////////////////////
111
112 const Properties &options() const override { return m_options; }
113
114 Properties &options() override { return m_options; }
115
116 bool set_options(const Properties &options) override {
118 }
119
120 bool set_options(const String_type &options_raw) override {
121 return m_options.insert_values(options_raw);
122 }
123
124 /////////////////////////////////////////////////////////////////////////
125 // se_private_data.
126 /////////////////////////////////////////////////////////////////////////
127
128 const Properties &se_private_data() const override {
129 return m_se_private_data;
130 }
131
133
134 bool set_se_private_data(const String_type &se_private_data_raw) override {
135 return m_se_private_data.insert_values(se_private_data_raw);
136 }
137
140 }
141
142 /////////////////////////////////////////////////////////////////////////
143 // Tablespace.
144 /////////////////////////////////////////////////////////////////////////
145
146 Object_id tablespace_id() const override { return m_tablespace_id; }
147
150 }
151
152 public:
154 return new (std::nothrow) Partition_index_impl(partition, nullptr);
155 }
156
159
160 public:
161 Object_key *create_primary_key() const override;
162 bool has_new_primary_key() const override;
163
164 private:
165 // Fields.
166
169
170 // References to tightly-coupled objects.
171
174
175 // References to loosely-coupled objects.
176
178};
179
180///////////////////////////////////////////////////////////////////////////
181
182/**
183 Used to sort Partition_index objects for the same partition in
184 the same order as Index objects for the table.
185*/
186
189 const dd::Partition_index *pi2) const {
190 return pi1->index().ordinal_position() < pi2->index().ordinal_position();
191 }
192};
193
194///////////////////////////////////////////////////////////////////////////
195
196} // namespace dd
197
198#endif // DD__PARTITION_INDEX_IMPL_INCLUDED
Definition: index.h:51
virtual uint ordinal_position() const =0
Definition: object_key.h:38
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:72
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:76
Definition: partition_impl.h:60
Definition: partition_index_impl.h:57
Properties_impl m_options
Definition: partition_index_impl.h:167
bool set_options(const Properties &options) override
Definition: partition_index_impl.h:116
const Index & index() const override
Definition: partition_index_impl.cc:93
bool set_options(const String_type &options_raw) override
Definition: partition_index_impl.h:120
Partition_impl & partition_impl()
Definition: partition_index_impl.h:98
void set_ordinal_position(uint)
Definition: partition_index_impl.h:83
const Properties & options() const override
Definition: partition_index_impl.h:112
static Partition_index_impl * restore_item(Partition_impl *partition)
Definition: partition_index_impl.h:153
const Object_table & object_table() const override
Definition: partition_index_impl.cc:235
Partition_impl * m_partition
Definition: partition_index_impl.h:172
Object_key * create_primary_key() const override
Definition: partition_index_impl.cc:192
void debug_print(String_type &outb) const override
Definition: partition_index_impl.cc:176
Properties & options() override
Definition: partition_index_impl.h:114
virtual uint ordinal_position() const
Definition: partition_index_impl.h:85
bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val) override
Re-establishes the state of *this by reading sdi information from the rapidjson DOM subobject provide...
Definition: partition_index_impl.cc:164
const Partition & partition() const override
Definition: partition_index_impl.cc:85
Object_id m_tablespace_id
Definition: partition_index_impl.h:177
bool has_new_primary_key() const override
Indicates that object is guaranteed to have primary key value which doesn't exist in database (e....
Definition: partition_index_impl.cc:196
Properties & se_private_data() override
Definition: partition_index_impl.h:132
bool restore_attributes(const Raw_record &r) override
Definition: partition_index_impl.cc:117
const Properties & se_private_data() const override
Definition: partition_index_impl.h:128
Index * m_index
Definition: partition_index_impl.h:173
~Partition_index_impl() override=default
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: partition_index_impl.cc:241
Partition_index_impl()
Definition: partition_index_impl.cc:68
bool set_se_private_data(const Properties &se_private_data) override
Definition: partition_index_impl.h:138
bool set_se_private_data(const String_type &se_private_data_raw) override
Definition: partition_index_impl.h:134
bool validate() const override
Definition: partition_index_impl.cc:99
Properties_impl m_se_private_data
Definition: partition_index_impl.h:168
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: partition_index_impl.cc:151
Object_id tablespace_id() const override
Definition: partition_index_impl.h:146
static Partition_index_impl * clone(const Partition_index_impl &other, Partition_impl *partition)
Definition: partition_index_impl.cc:215
bool store_attributes(Raw_record *r) override
Definition: partition_index_impl.cc:138
void set_tablespace_id(Object_id tablespace_id) override
Definition: partition_index_impl.h:148
Definition: partition_index.h:47
virtual const Index & index() const =0
Definition: partition.h:51
The Properties_impl class implements the Properties interface.
Definition: properties_impl.h:77
bool insert_values(const Properties &properties) override
Insert key/value pairs from a different property object.
Definition: properties_impl.cc:104
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:74
Definition: raw_record.h:46
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: weak_object_impl.h:48
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:49
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
This header provides Rapidjson Type Aliases.
Used to sort Partition_index objects for the same partition in the same order as Index objects for th...
Definition: partition_index_impl.h:187
bool operator()(const dd::Partition_index *pi1, const dd::Partition_index *pi2) const
Definition: partition_index_impl.h:188
unsigned int uint
Definition: uca9-dump.cc:75