MySQL 8.0.30
Source Code Documentation
tablespace_impl.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2022, 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__TABLESPACE_IMPL_INCLUDED
24#define DD__TABLESPACE_IMPL_INCLUDED
25
26#include <memory> // std::unique_ptr
27#include <new>
28#include <string>
29
32#include "sql/dd/impl/types/entity_object_impl.h" // dd::Entity_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/tablespace.h" // dd::Tablespace
38#include "sql/dd/types/tablespace_file.h" // dd::Tablespace_file
39#include "sql/strfunc.h"
40
41class THD;
42
43namespace dd {
44
45///////////////////////////////////////////////////////////////////////////
46
47class Object_table;
48class Open_dictionary_tables_ctx;
49class Properties;
50class Sdi_rcontext;
51class Sdi_wcontext;
52class Tablespace_file;
53class Weak_object;
54class Object_table;
55
57 public:
59
60 ~Tablespace_impl() override;
61
62 public:
63 const Object_table &object_table() const override;
64
65 bool validate() const override;
66
68
70
71 bool drop_children(Open_dictionary_tables_ctx *otx) const override;
72
73 bool store_attributes(Raw_record *r) override;
74
75 bool restore_attributes(const 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
83 bool is_empty(THD *thd, bool *empty) const override;
84
85 public:
87
88 /////////////////////////////////////////////////////////////////////////
89 // comment.
90 /////////////////////////////////////////////////////////////////////////
91
92 const String_type &comment() const override { return m_comment; }
93
94 void set_comment(const String_type &comment) override { m_comment = comment; }
95
96 /////////////////////////////////////////////////////////////////////////
97 // options.
98 /////////////////////////////////////////////////////////////////////////
99
100 const Properties &options() const override { return m_options; }
101
102 Properties &options() override { return m_options; }
103
104 bool set_options(const String_type &options_raw) override {
105 return m_options.insert_values(options_raw);
106 }
107
108 /////////////////////////////////////////////////////////////////////////
109 // se_private_data.
110 /////////////////////////////////////////////////////////////////////////
111
112 const Properties &se_private_data() const override {
113 return m_se_private_data;
114 }
115
117
118 bool set_se_private_data(const String_type &se_private_data_raw) override {
119 return m_se_private_data.insert_values(se_private_data_raw);
120 }
121
122 /////////////////////////////////////////////////////////////////////////
123 // m_engine.
124 /////////////////////////////////////////////////////////////////////////
125
126 const String_type &engine() const override { return m_engine; }
127
128 void set_engine(const String_type &engine) override { m_engine = engine; }
129
130 LEX_CSTRING engine_attribute() const override {
132 }
134 m_engine_attribute.assign(a.str, a.length);
135 }
136
137 /////////////////////////////////////////////////////////////////////////
138 // Tablespace file collection.
139 /////////////////////////////////////////////////////////////////////////
140
141 Tablespace_file *add_file() override;
142
143 bool remove_file(String_type data_file) override;
144
145 const Tablespace_file_collection &files() const override { return m_files; }
146
147 // Fix "inherits ... via dominance" warnings
149 const Entity_object_impl *impl() const override {
151 }
152 Object_id id() const override { return Entity_object_impl::id(); }
153 bool is_persistent() const override {
155 }
156 const String_type &name() const override {
158 }
159 void set_name(const String_type &name) override {
161 }
162
163 private:
164 // Fields
165
171
172 // Collections.
173
175
177
178 Tablespace *clone() const override { return new Tablespace_impl(*this); }
179
181 Tablespace_impl *placeholder = new Tablespace_impl();
182 placeholder->set_id(id());
183 placeholder->set_name(name());
184 return placeholder;
185 }
186};
187
188///////////////////////////////////////////////////////////////////////////
189
190} // namespace dd
191
192#endif // DD__TABLESPACE_IMPL_INCLUDED
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:922
Definition: collection.h:43
Definition: entity_object_impl.h:43
void set_name(const String_type &name) override
Definition: entity_object_impl.h:61
void set_id(Object_id id)
Definition: entity_object_impl.h:50
Object_id id() const override
The unique dictionary object id.
Definition: entity_object_impl.h:48
const String_type & name() const override
Definition: entity_object_impl.h:59
Entity_object_impl * impl() override
Definition: entity_object_impl.h:67
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: entity_object_impl.h:56
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:75
The Properties_impl class implements the Properties interface.
Definition: properties_impl.h:76
bool insert_values(const Properties &properties) override
Insert key/value pairs from a different property object.
Definition: properties_impl.cc:103
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:73
Definition: raw_record.h:45
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: tablespace_file.h:44
Definition: tablespace_impl.h:56
Properties & se_private_data() override
Definition: tablespace_impl.h:116
Tablespace * clone_dropped_object_placeholder() const override
Allocate a new object which can serve as a placeholder for the original object in the Dictionary_clie...
Definition: tablespace_impl.h:180
bool remove_file(String_type data_file) override
Definition: tablespace_impl.cc:314
Tablespace * clone() const override
Allocate a new object graph and invoke the copy constructor for each object.
Definition: tablespace_impl.h:178
const String_type & engine() const override
Definition: tablespace_impl.h:126
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const override
Converts *this into json.
Definition: tablespace_impl.cc:214
const String_type & name() const override
Definition: tablespace_impl.h:156
Tablespace_file_collection m_files
Definition: tablespace_impl.h:174
const String_type & comment() const override
Definition: tablespace_impl.h:92
bool restore_attributes(const Raw_record &r) override
Definition: tablespace_impl.cc:157
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: tablespace_impl.cc:333
const Properties & options() const override
Definition: tablespace_impl.h:100
~Tablespace_impl() override
const Tablespace_file_collection & files() const override
Definition: tablespace_impl.h:145
const Entity_object_impl * impl() const override
Definition: tablespace_impl.h:149
Tablespace_file * add_file() override
Definition: tablespace_impl.cc:306
bool store_children(Open_dictionary_tables_ctx *otx) override
Definition: tablespace_impl.cc:133
LEX_CSTRING engine_attribute() const override
Definition: tablespace_impl.h:130
bool set_se_private_data(const String_type &se_private_data_raw) override
Definition: tablespace_impl.h:118
bool validate() const override
Definition: tablespace_impl.cc:107
Properties_impl m_options
Definition: tablespace_impl.h:167
Object_id id() const override
The unique dictionary object id.
Definition: tablespace_impl.h:152
Tablespace_impl()
Definition: tablespace_impl.cc:98
bool is_persistent() const override
Is dictionary object persistent in dictionary tables ?
Definition: tablespace_impl.h:153
Properties & options() override
Definition: tablespace_impl.h:102
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: tablespace_impl.cc:228
void set_comment(const String_type &comment) override
Definition: tablespace_impl.h:94
bool restore_children(Open_dictionary_tables_ctx *otx) override
Definition: tablespace_impl.cc:125
String_type m_engine_attribute
Definition: tablespace_impl.h:170
void debug_print(String_type &outb) const override
Definition: tablespace_impl.cc:281
Entity_object_impl * impl() override
Definition: tablespace_impl.h:148
bool set_options(const String_type &options_raw) override
Definition: tablespace_impl.h:104
String_type m_comment
Definition: tablespace_impl.h:166
const Object_table & object_table() const override
Definition: tablespace_impl.cc:327
bool drop_children(Open_dictionary_tables_ctx *otx) const override
Definition: tablespace_impl.cc:149
bool is_empty(THD *thd, bool *empty) const override
Check if the tablespace is empty, i.e., whether it has any tables.
Definition: tablespace_impl.cc:256
void set_engine_attribute(LEX_CSTRING a) override
Definition: tablespace_impl.h:133
const Properties & se_private_data() const override
Definition: tablespace_impl.h:112
Properties_impl m_se_private_data
Definition: tablespace_impl.h:168
void set_name(const String_type &name) override
Definition: tablespace_impl.h:159
void set_engine(const String_type &engine) override
Definition: tablespace_impl.h:128
String_type m_engine
Definition: tablespace_impl.h:169
bool store_attributes(Raw_record *r) override
Definition: tablespace_impl.cc:180
Definition: tablespace.h:54
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
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
This header provides Rapidjson Type Aliases.
MYSQL_LEX_CSTRING lex_cstring_handle(const STDSTRINGLIKE_TYPE &s)
Return a LEX_CSTRING handle to a std::string like (meaning something which has the c_str() and length...
Definition: strfunc.h:83
Definition: mysql_lex_string.h:39
const char * str
Definition: mysql_lex_string.h:40
size_t length
Definition: mysql_lex_string.h:41