MySQL 9.4.0
Source Code Documentation
db_service_endpoint.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2024, 2025, 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 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 ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_ENDPOINT_DB_SERVICE_ENDPOINT_H_
27#define ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_ENDPOINT_DB_SERVICE_ENDPOINT_H_
28
29#include <memory>
30#include <shared_mutex>
31#include <string>
32#include <unordered_map>
33
34#ifdef HAVE_JIT_EXECUTOR_PLUGIN
35#include <mutex>
36#endif
37
41
42#ifdef HAVE_JIT_EXECUTOR_PLUGIN
45#endif
46
47namespace mrs {
48
49namespace file_system {
51}
52namespace endpoint {
53
54class UrlHostEndpoint;
55
57 public:
60 using DbServicePtr = std::shared_ptr<DbService>;
61 using HandlerFactoryPtr = std::shared_ptr<mrs::interface::HandlerFactory>;
63
64 public:
67 HandlerFactoryPtr factory);
68
69 ~DbServiceEndpoint() override;
70
71 UniversalId get_id() const override;
72 UniversalId get_parent_id() const override;
73 Uri get_url() const override;
74 std::optional<std::string> get_options() const override;
75
76 const DbServicePtr get() const;
77 void set(const DbService &entry, EndpointBasePtr parent);
78
79 void set_debug_enabled(bool value);
80 bool is_debug_enabled() const;
82
83#ifdef HAVE_JIT_EXECUTOR_PLUGIN
84 std::shared_ptr<jit_executor::IContextHandle> get_scripting_context();
85 std::string get_content_set_path(const std::string &module_class_name);
86#endif
87
88 private:
89 void update() override;
90 void activate_public() override;
91 void deactivate() override;
92 std::string get_extra_update_data() override;
94 std::string get_my_url_path_part() const override;
95 std::string get_my_url_part() const override;
96 bool does_this_node_require_authentication() const override;
97
98#ifdef HAVE_JIT_EXECUTOR_PLUGIN
99 void update_content_set_data();
100#endif
101
103 std::vector<HandlerPtr> url_handlers_;
104 bool debug_enabled_ = false;
105
106#ifdef HAVE_JIT_EXECUTOR_PLUGIN
107 jit_executor::ServiceHandlerConfig jit_executor_config_;
108 bool updated_jit_executor_config_ = false;
109 std::unordered_map<std::string, std::string> content_set_paths_;
110 std::shared_mutex content_set_path_mutex_;
111 std::mutex m_scripting_context_mutex;
112#endif
113};
114
115} // namespace endpoint
116} // namespace mrs
117
118#endif // ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_ENDPOINT_DB_SERVICE_ENDPOINT_H_
Definition: uri.h:40
Definition: db_service_endpoint.h:56
DbServiceEndpoint(const DbService &entry, EndpointConfigurationPtr configuration, HandlerFactoryPtr factory)
Definition: db_service_endpoint.cc:52
bool debug_enabled_
Definition: db_service_endpoint.h:104
bool is_debug_enabled() const
Definition: db_service_endpoint.cc:91
UniversalId get_parent_id() const override
Definition: db_service_endpoint.cc:72
std::shared_ptr< DbService > DbServicePtr
Definition: db_service_endpoint.h:60
Uri get_url() const override
Definition: db_service_endpoint.cc:226
void update() override
Definition: db_service_endpoint.cc:185
UniversalId get_id() const override
Definition: db_service_endpoint.cc:70
std::string get_extra_update_data() override
Definition: db_service_endpoint.cc:254
void set(const DbService &entry, EndpointBasePtr parent)
Definition: db_service_endpoint.cc:93
~DbServiceEndpoint() override
Definition: db_service_endpoint.cc:63
mrs::database::entry::DbService DbService
Definition: db_service_endpoint.h:59
EnabledType get_this_node_enabled_level() const override
Definition: db_service_endpoint.cc:214
const DbServicePtr get() const
Definition: db_service_endpoint.cc:76
void set_debug_enabled(bool value)
Definition: db_service_endpoint.cc:78
void deactivate() override
Definition: db_service_endpoint.cc:212
bool does_this_node_require_authentication() const override
Definition: db_service_endpoint.cc:246
std::string get_my_url_part() const override
Definition: db_service_endpoint.cc:222
std::optional< std::string > get_options() const override
Definition: db_service_endpoint.cc:250
DbService DataType
Definition: db_service_endpoint.h:62
void on_updated_content_set()
Definition: db_service_endpoint.cc:100
std::vector< HandlerPtr > url_handlers_
Definition: db_service_endpoint.h:103
DbServicePtr entry_
Definition: db_service_endpoint.h:102
std::shared_ptr< mrs::interface::HandlerFactory > HandlerFactoryPtr
Definition: db_service_endpoint.h:61
std::string get_my_url_path_part() const override
Definition: db_service_endpoint.cc:218
void activate_public() override
Definition: db_service_endpoint.cc:194
Definition: option_endpoint.h:39
OptionEndpoint(UniversalId service_id, EndpointConfigurationPtr configuration, HandlerFactoryPtr factory)
Definition: option_endpoint.cc:37
Definition: db_service_file_system.h:49
mrs::database::entry::EnabledType EnabledType
Definition: endpoint_base.h:59
std::shared_ptr< EndpointBase > EndpointBasePtr
Definition: endpoint_base.h:60
mrs::database::entry::UniversalId UniversalId
Definition: endpoint_base.h:61
std::shared_ptr< EndpointConfiguration > EndpointConfigurationPtr
Definition: endpoint_base.h:64
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
DbServiceEndpoint::DbService DbService
Definition: db_service_endpoint.cc:46
Definition: authorize_manager.h:48
required string configuration
Definition: replication_asynchronous_connection_failover.proto:49
Definition: completion_hash.h:35
Definition: jit_executor_component.h:59