MySQL 9.1.0
Source Code Documentation
components.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef COMPONENTS_INCLUDED
27#define COMPONENTS_INCLUDED
28
29#include <mysql/components/minimal_chassis.h> /* Minimal chassis */
35
36#include "client/logger.h" /* Log */
37#include "options.h" /* Mysql_connection */
38namespace components {
43 SERVICE_TYPE_NO_CONST(keyring_keys_metadata_iterator);
45 SERVICE_TYPE_NO_CONST(keyring_reader_with_status);
47
51 SERVICE_TYPE(keyring_keys_metadata_iterator);
52using const_keyring_load_t = SERVICE_TYPE(keyring_load);
54 SERVICE_TYPE(keyring_reader_with_status);
55using const_keyring_writer_t = SERVICE_TYPE(keyring_writer);
56
59
61 public:
62 Keyring_component_load(const std::string &component_name, std::string type);
63
65
66 bool ok() const { return ok_; }
67
68 private:
70 std::string component_path_;
71 std::string type_;
72 bool ok_;
73};
74
76 public:
77 Keyring_services(const std::string &implementation_name,
78 const std::string &instance_path);
79
80 virtual ~Keyring_services();
81
82 bool ok() const { return ok_; }
83
84 protected:
88 bool ok_;
89};
90
92 public:
93 Source_keyring_services(const std::string &implementation_name,
94 const std::string &instance_path);
95
96 ~Source_keyring_services() override;
97
100 }
103 }
104
105 private:
109};
110
112 public:
113 Destination_keyring_services(const std::string &implementation_name,
114 const std::string &instance_path);
115
117
119
120 private:
122};
123
124class Keyring_migrate final {
125 public:
127 Destination_keyring_services &dst, bool online_migration);
128
129 bool migrate_keys();
130
132
133 bool lock_source_keyring();
135 bool ok() const { return ok_; }
136
137 private:
142 bool ok_{false};
143 const size_t maximum_size_{16384};
144};
145
146} // namespace components
147
148#endif // !COMPONENTS_INCLUDED
Definition: components.h:111
my_service< const_keyring_writer_t > keyring_writer_service_
Definition: components.h:121
~Destination_keyring_services() override
Definition: components.cc:175
const_keyring_writer_t * writer()
Definition: components.h:118
Destination_keyring_services(const std::string &implementation_name, const std::string &instance_path)
Definition: components.cc:159
Definition: components.h:60
bool ok_
Definition: components.h:72
std::string component_path_
Definition: components.h:70
bool ok() const
Definition: components.h:66
std::string type_
Definition: components.h:71
dynamic_loader_type_t * dynamic_loader_
Definition: components.h:69
~Keyring_component_load()
Definition: components.cc:81
Keyring_component_load(const std::string &component_name, std::string type)
Definition: components.cc:59
Definition: components.h:124
options::Mysql_connection mysql_connection_
Definition: components.h:141
bool ok_
Definition: components.h:142
const size_t maximum_size_
Definition: components.h:143
bool lock_source_keyring()
Definition: components.cc:200
my_h_keyring_keys_metadata_iterator iterator_
Definition: components.h:140
Keyring_migrate(Source_keyring_services &src, Destination_keyring_services &dst, bool online_migration)
Definition: components.cc:182
Source_keyring_services & src_
Definition: components.h:138
bool migrate_keys()
Definition: components.cc:213
bool ok() const
Definition: components.h:135
~Keyring_migrate()
Definition: components.cc:374
Destination_keyring_services & dst_
Definition: components.h:139
bool unlock_source_keyring()
Definition: components.cc:207
Definition: components.h:75
my_service< const_keyring_load_t > keyring_load_service_
Definition: components.h:87
std::string implementation_name_
Definition: components.h:86
virtual ~Keyring_services()
Definition: components.cc:123
registry_type_t * registry_
Definition: components.h:85
bool ok() const
Definition: components.h:82
Keyring_services(const std::string &implementation_name, const std::string &instance_path)
Definition: components.cc:96
bool ok_
Definition: components.h:88
Definition: components.h:91
Source_keyring_services(const std::string &implementation_name, const std::string &instance_path)
Definition: components.cc:131
const_keyring_reader_with_status_t * reader()
Definition: components.h:101
const_keyring_keys_metadata_iterator_t * metadata_iterator()
Definition: components.h:98
my_service< const_keyring_reader_with_status_t > keyring_reader_service_
Definition: components.h:108
~Source_keyring_services() override
Definition: components.cc:151
my_service< const_keyring_keys_metadata_iterator_t > keyring_keys_metadata_service_
Definition: components.h:107
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
Definition: options.h:93
struct my_h_keyring_keys_metadata_iterator_imp * my_h_keyring_keys_metadata_iterator
Definition: keyring_keys_metadata_iterator.h:29
Definition: components.cc:41
void deinit_components_subsystem()
Definition: components.cc:53
void init_components_subsystem()
Definition: components.cc:46
required string type
Definition: replication_group_member_actions.proto:34
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
#define SERVICE_TYPE_NO_CONST(name)
Generates the standard Service type name.
Definition: service.h:71
Service for managing the list of loaded Components.
Definition: dynamic_loader.h:41
Keyring keys metadata iterator service provides APIs to create and use iterator to access metadata as...
Definition: keyring_keys_metadata_iterator.h:76
Keyring load service provides way to initialize or reiniitalize keyring component.
Definition: keyring_load.h:52
Keyring reader with status service provides APIs to fetch sensitive data from keyring backend.
Definition: keyring_reader_with_status.h:128
Keyring writer service provides APIs to add/remove sensitive data to/from keyring backend.
Definition: keyring_writer.h:70
Service for acquiring and releasing references to all registered Service Implementations.
Definition: registry.h:48