MySQL  8.0.19
Source Code Documentation
tablespace_file_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__TABLESPACE_FILES_IMPL_INCLUDED
24 #define DD__TABLESPACE_FILES_IMPL_INCLUDED
25 
26 #include <sys/types.h>
27 #include <memory> // std::unique_ptr
28 #include <new>
29 
32 #include "sql/dd/impl/types/weak_object_impl.h" // dd::Weak_object_impl
33 #include "sql/dd/sdi_fwd.h"
34 #include "sql/dd/string_type.h"
35 #include "sql/dd/types/tablespace_file.h" // dd::Tablespace_file
36 
37 namespace dd {
38 
39 ///////////////////////////////////////////////////////////////////////////
40 
41 class Object_key;
42 class Object_table;
43 class Open_dictionary_tables_ctx;
44 class Sdi_rcontext;
45 class Sdi_wcontext;
46 class Tablespace;
47 class Tablespace_impl;
48 class Weak_object;
49 
50 ///////////////////////////////////////////////////////////////////////////
51 
53  public:
55 
57 
59  Tablespace_impl *parent);
60 
61  virtual ~Tablespace_file_impl() {}
62 
63  public:
64  virtual const Object_table &object_table() const;
65 
66  virtual bool store(Open_dictionary_tables_ctx *otx);
67 
68  virtual bool validate() const;
69 
70  virtual bool store_attributes(Raw_record *r);
71 
72  virtual bool restore_attributes(const Raw_record &r);
73 
74  void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const;
75 
76  bool deserialize(Sdi_rcontext *rctx, const RJ_Value &val);
77 
78  virtual void debug_print(String_type &outb) const;
79 
82  }
83 
84  public:
86 
87  /////////////////////////////////////////////////////////////////////////
88  // ordinal_position.
89  /////////////////////////////////////////////////////////////////////////
90 
91  virtual uint ordinal_position() const { return m_ordinal_position; }
92 
93  /////////////////////////////////////////////////////////////////////////
94  // filename.
95  /////////////////////////////////////////////////////////////////////////
96 
97  virtual const String_type &filename() const { return m_filename; }
98 
99  virtual void set_filename(const String_type &filename) {
101  }
102 
103  /////////////////////////////////////////////////////////////////////////
104  // se_private_data.
105  /////////////////////////////////////////////////////////////////////////
106 
107  virtual const Properties &se_private_data() const {
108  return m_se_private_data;
109  }
110 
112 
113  virtual bool set_se_private_data(const String_type &se_private_data_raw) {
114  return m_se_private_data.insert_values(se_private_data_raw);
115  }
116 
117  /////////////////////////////////////////////////////////////////////////
118  // tablespace.
119  /////////////////////////////////////////////////////////////////////////
120 
121  virtual const Tablespace &tablespace() const;
122 
123  virtual Tablespace &tablespace();
124 
125  public:
127  return new (std::nothrow) Tablespace_file_impl(ts);
128  }
129 
131  Tablespace_impl *ts) {
132  return new (std::nothrow) Tablespace_file_impl(other, ts);
133  }
134 
135  public:
136  virtual Object_key *create_primary_key() const;
137  virtual bool has_new_primary_key() const;
138 
139  private:
140  // Fields
142 
145 
146  // References to other objects
148 };
149 
150 ///////////////////////////////////////////////////////////////////////////
151 
152 } // namespace dd
153 
154 #endif // DD__TABLESPACE_FILES_IMPL_INCLUDED
dd::Tablespace_file_impl::restore_item
static Tablespace_file_impl * restore_item(Tablespace_impl *ts)
Definition: tablespace_file_impl.h:126
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::Tablespace_file_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: tablespace_file_impl.cc:160
dd::Tablespace_file_impl::set_filename
virtual void set_filename(const String_type &filename)
Definition: tablespace_file_impl.h:99
dd::Tablespace
Definition: tablespace.h:54
dd::Weak_object_impl
Definition: weak_object_impl.h:43
dd::Tablespace_file_impl::se_private_data
virtual const Properties & se_private_data() const
Definition: tablespace_file_impl.h:107
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
properties_impl.h
dd::Tablespace_file_impl::debug_print
virtual void debug_print(String_type &outb) const
Definition: tablespace_file_impl.cc:169
Tablespace
Data structure that contains the information about shared tablespaces.
Definition: fsp0space.h:46
dd::Tablespace_file_impl::set_se_private_data
virtual bool set_se_private_data(const String_type &se_private_data_raw)
Definition: tablespace_file_impl.h:113
dd::Tablespace_file_impl::clone
static Tablespace_file_impl * clone(const Tablespace_file_impl &other, Tablespace_impl *ts)
Definition: tablespace_file_impl.h:130
dd::RJ_Value
rapidjson::GenericValue< RJ_Encoding, RJ_Allocator > RJ_Value
Definition: sdi_fwd.h:48
dd::Tablespace_file_impl::validate
virtual bool validate() const
Definition: tablespace_file_impl.cc:110
dd::Tablespace_file_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: tablespace_file_impl.cc:187
raw_record.h
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::Tablespace_file_impl::object_table
virtual const Object_table & object_table() const
Definition: tablespace_file_impl.cc:203
dd::Tablespace_file_impl::se_private_data
virtual Properties & se_private_data()
Definition: tablespace_file_impl.h:111
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::Tablespace_file_impl::Tablespace_file_impl
Tablespace_file_impl()
Definition: tablespace_file_impl.cc:62
dd::Open_dictionary_tables_ctx
Auxiliary class for opening dictionary tables.
Definition: transaction_impl.h:75
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::Tablespace_file_impl::serialize
void serialize(Sdi_wcontext *wctx, Sdi_writer *w) const
Converts *this into json.
Definition: tablespace_file_impl.cc:150
dd::Tablespace_file_impl::m_tablespace
Tablespace_impl * m_tablespace
Definition: tablespace_file_impl.h:147
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::Tablespace_file_impl::set_ordinal_position
void set_ordinal_position(uint ordinal_position)
Definition: tablespace_file_impl.h:80
dd::Tablespace_file_impl::tablespace
virtual const Tablespace & tablespace() const
Definition: tablespace_file_impl.cc:70
string_type.h
dd::Tablespace_file_impl::register_tables
static void register_tables(Open_dictionary_tables_ctx *otx)
Definition: tablespace_file_impl.cc:209
dd::Tablespace_file
Definition: tablespace_file.h:44
dd::Tablespace_file_impl::m_se_private_data
Properties_impl m_se_private_data
Definition: tablespace_file_impl.h:144
tablespace_file.h
weak_object_impl.h
dd::Sdi_wcontext
Opaque context which keeps reusable resources needed during serialization.
Definition: sdi.cc:126
dd::Tablespace_file_impl::store
virtual bool store(Open_dictionary_tables_ctx *otx)
Store the DD object into DD table.
Definition: tablespace_file_impl.cc:95
dd::Tablespace_file_impl::~Tablespace_file_impl
virtual ~Tablespace_file_impl()
Definition: tablespace_file_impl.h:61
sdi_fwd.h
dd::Tablespace_impl
Definition: tablespace_impl.h:55
dd::Tablespace_file_impl::ordinal_position
virtual uint ordinal_position() const
Definition: tablespace_file_impl.h:91
dd::Object_key
Definition: object_key.h:37
dd::Tablespace_file_impl::create_primary_key
virtual Object_key * create_primary_key() const
Definition: tablespace_file_impl.cc:182
dd::Tablespace_file_impl::restore_attributes
virtual bool restore_attributes(const Raw_record &r)
Definition: tablespace_file_impl.cc:122
dd::Object_table
This class represents all data dictionary table like mysql.tables, mysql.columns and more.
Definition: object_table.h:71
dd::Tablespace_file_impl::store_attributes
virtual bool store_attributes(Raw_record *r)
Definition: tablespace_file_impl.cc:137
dd::Tablespace_file_impl::filename
virtual const String_type & filename() const
Definition: tablespace_file_impl.h:97
dd::Tablespace_file_impl::m_ordinal_position
uint m_ordinal_position
Definition: tablespace_file_impl.h:141
dd::Tablespace_file_impl::m_filename
String_type m_filename
Definition: tablespace_file_impl.h:143
dd::Tablespace_file_impl
Definition: tablespace_file_impl.h:52