26#ifndef MYSQLROUTER_ROUTING_COMPONENT_INCLUDED
27#define MYSQLROUTER_ROUTING_COMPONENT_INCLUDED
38#include "connection.h"
52 std::string get_bind_address()
const;
53 uint16_t get_bind_port()
const;
55 std::chrono::milliseconds get_client_connect_timeout()
const;
56 std::chrono::milliseconds get_destination_connect_timeout()
const;
57 std::string get_destination_cluster_name()
const;
58 std::string get_destination_replicaset_name()
const;
61 uint64_t get_max_connect_errors()
const;
63 std::string get_name()
const;
65 std::string get_protocol_name()
const;
69 explicit operator bool() const noexcept {
return r_.operator bool(); }
71 std::vector<std::string> get_blocked_client_hosts()
const;
78 ConnData(std::string src, std::string dst, std::size_t bytes_up,
83 : src(
std::move(src)),
86 bytes_down(bytes_down),
88 connected_to_server(connected_to_server),
89 last_sent_to_server(last_sent_to_server),
90 last_received_from_server(last_received_from_server) {}
104 std::vector<ConnData> get_connections()
const;
107 int get_active_connections()
const;
108 int get_total_connections()
const;
110 std::vector<mysql_harness::TCPAddress> get_destinations()
const;
112 void start_accepting_connections();
113 void restart_accepting_connections();
115 bool is_accepting_connections()
const;
117 void stop_socket_acceptors();
122 std::shared_ptr<MySQLRoutingBase>
r_;
133 void register_route(
const std::string &
name,
134 std::shared_ptr<MySQLRoutingBase>
srv);
136 void erase(
const std::string &
name);
140 uint64_t current_total_connections();
145 std::vector<std::string> route_names()
const;
153 std::map<std::string, std::weak_ptr<MySQLRoutingBase>>
routes_;
155 uint64_t max_total_connections_{0};
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:580
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:571
Definition: base_protocol.h:29
Definition: routing_component.h:45
std::shared_ptr< MySQLRoutingBase > r_
Definition: routing_component.h:122
MySQLRoutingAPI(std::shared_ptr< MySQLRoutingBase > r)
Definition: routing_component.h:49
MySQLRoutingAPI()=default
Facade to avoid a tight coupling between Routing component and actual routing endpoint implementation...
Definition: mysql_routing_base.h:41
Definition: routing_component.h:125
MySQLRoutingComponent(MySQLRoutingComponent const &)=delete
std::map< std::string, std::weak_ptr< MySQLRoutingBase > > routes_
Definition: routing_component.h:153
uint64_t max_total_connections() const
Definition: routing_component.h:141
MySQLRoutingComponent()=default
void operator=(MySQLRoutingComponent const &)=delete
std::mutex routes_mu_
Definition: routing_component.h:152
Definition: connection.h:44
Configuration.
Definition: config_parser.h:253
static int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share)
Definition: ha_federated.cc:608
net::ip::tcp::socket * get_socket(net::ip::tcp::socket *s)
Definition: connection.h:66
bool is_running(const PluginFuncEnv *env) noexcept
Definition: loader.cc:203
RoutingStrategy get_routing_strategy(const std::string &value)
Returns RoutingStrategy for its literal representation.
Definition: routing.cc:87
Definition: srv0dynamic_procedures.h:48
Definition: gcs_xcom_synode.h:64
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
#define ROUTING_EXPORT
Definition: routing_export.h:15
case opt name
Definition: sslopt-case.h:29
Definition: routing_component.h:73
std::size_t bytes_up
Definition: routing_component.h:95
time_point_type last_sent_to_server
Definition: routing_component.h:100
time_point_type connected_to_server
Definition: routing_component.h:99
std::string dst
Definition: routing_component.h:93
time_point_type started
Definition: routing_component.h:98
std::string src
Definition: routing_component.h:92
std::chrono::time_point< std::chrono::system_clock > time_point_type
Definition: routing_component.h:74
std::size_t bytes_down
Definition: routing_component.h:96
time_point_type last_received_from_server
Definition: routing_component.h:101
ConnData(std::string src, std::string dst, std::size_t bytes_up, std::size_t bytes_down, time_point_type started, time_point_type connected_to_server, time_point_type last_sent_to_server, time_point_type last_received_from_server)
Definition: routing_component.h:78
ulong get_max_connections(void)
Get max number of connections.
Definition: sql_thd_api.cc:302
static int started(pax_machine *p)
Definition: xcom_base.cc:757