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;
87 std::vector<ConnData> get_connections()
const;
90 int get_active_connections()
const;
91 int get_total_connections()
const;
93 std::vector<mysql_harness::TCPAddress> get_destinations()
const;
95 void start_accepting_connections();
96 void restart_accepting_connections();
98 bool is_accepting_connections()
const;
100 void stop_socket_acceptors();
105 std::shared_ptr<MySQLRoutingBase>
r_;
116 void register_route(
const std::string &
name,
117 std::shared_ptr<MySQLRoutingBase>
srv);
119 void erase(
const std::string &
name);
123 uint64_t current_total_connections();
128 std::vector<std::string> route_names()
const;
136 std::map<std::string, std::weak_ptr<MySQLRoutingBase>>
routes_;
138 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:105
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:108
MySQLRoutingComponent(MySQLRoutingComponent const &)=delete
std::map< std::string, std::weak_ptr< MySQLRoutingBase > > routes_
Definition: routing_component.h:136
uint64_t max_total_connections() const
Definition: routing_component.h:124
MySQLRoutingComponent()=default
void operator=(MySQLRoutingComponent const &)=delete
std::mutex routes_mu_
Definition: routing_component.h:135
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:71
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:78
time_point_type last_sent_to_server
Definition: routing_component.h:83
time_point_type connected_to_server
Definition: routing_component.h:82
std::string dst
Definition: routing_component.h:76
time_point_type started
Definition: routing_component.h:81
std::string src
Definition: routing_component.h:75
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:79
time_point_type last_received_from_server
Definition: routing_component.h:84
ulong get_max_connections(void)
Get max number of connections.
Definition: sql_thd_api.cc:314