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