MySQL 8.0.40
Source Code Documentation
mysql_routing_base.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 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 ROUTING_MYSQL_ROUTING_BASE_INCLUDED
27#define ROUTING_MYSQL_ROUTING_BASE_INCLUDED
28
29#include "context.h"
30#include "destination.h"
31#include "mysqlrouter/routing_component.h" // MySQLRoutingAPI
32
33/** @class MySQLRoutingBase
34 *
35 * @brief Facade to avoid a tight coupling between Routing component and
36 * actual routing endpoint implementation.
37 *
38 * Allows replacing the routing
39 * endpoint with an alternative implementation.
40 */
42 public:
43 MySQLRoutingBase() = default;
44
47
50
51 virtual ~MySQLRoutingBase() = default;
52
54 virtual int get_max_connections() const noexcept = 0;
55 virtual std::vector<mysql_harness::TCPAddress> get_destinations() const = 0;
56 virtual std::vector<MySQLRoutingAPI::ConnData> get_connections() = 0;
57 virtual MySQLRoutingConnectionBase *get_connection(const std::string &) = 0;
58 virtual bool is_accepting_connections() const = 0;
60 virtual routing::AccessMode get_mode() const = 0;
61 virtual stdx::expected<void, std::string> restart_accepting_connections() = 0;
62 virtual stdx::expected<void, std::string> start_accepting_connections() = 0;
63 virtual void stop_socket_acceptors() = 0;
64
65 virtual bool is_running() const = 0;
66};
67
68#endif // ROUTING_MYSQL_ROUTING_BASE_INCLUDED
Definition: routing_component.h:45
Facade to avoid a tight coupling between Routing component and actual routing endpoint implementation...
Definition: mysql_routing_base.h:41
MySQLRoutingBase & operator=(MySQLRoutingBase &&)=default
virtual ~MySQLRoutingBase()=default
virtual int get_max_connections() const noexcept=0
MySQLRoutingBase()=default
MySQLRoutingBase & operator=(const MySQLRoutingBase &)=default
MySQLRoutingBase(MySQLRoutingBase &&)=default
virtual MySQLRoutingContext & get_context()=0
MySQLRoutingBase(const MySQLRoutingBase &)=default
Definition: connection.h:43
MySQLRoutingContext holds data used by MySQLRouting (1 per plugin instances) and MySQLRoutingConnecti...
Definition: context.h:59
static int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share)
Definition: ha_federated.cc:605
Definition: common.h:42
bool is_running(const PluginFuncEnv *env) noexcept
Definition: loader.cc:202
Definition: routing.h:36
RoutingStrategy ROUTING_EXPORT get_routing_strategy(const std::string &value)
Returns RoutingStrategy for its literal representation.
Definition: routing.cc:91
AccessMode
Modes supported by Routing plugin.
Definition: routing.h:104
RoutingStrategy
Routing strategies supported by Routing plugin.
Definition: routing.h:111
Definition: gcs_xcom_synode.h:64
Definition: bit.h:34
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2875
#define ROUTING_EXPORT
Definition: routing_export.h:15