26#ifndef ROUTING_CONTEXT_INCLUDED
27#define ROUTING_CONTEXT_INCLUDED
58 std::shared_ptr<TlsServerContext> client_ssl_ctx,
60 std::shared_ptr<routing_guidelines::Routing_guidelines_engine>
97 auto pos =
name_.find(
':');
99 if (pos ==
name_.npos)
return {};
101 return name_.substr(pos + 1);
162 std::shared_ptr<TlsClientContext>
dest_ssl_ctx(
const std::string &dest_id,
163 const std::string &hostname) {
206 std::shared_ptr<routing_guidelines::Routing_guidelines_engine>
242 std::shared_ptr<routing_guidelines::Routing_guidelines_engine>
Type
supported protocols
Definition: base_protocol.h:32
Definition: blocked_endpoints.h:34
uint64_t max_connect_errors() const
Definition: blocked_endpoints.h:39
TlsClientContext per destination.
Definition: destination_ssl_context.h:42
std::shared_ptr< TlsClientContext > get(const std::string &dest_id, const std::string &hostname)
get a TlsClientContent for a destination.
Definition: destination_ssl_context.cc:93
MySQLRoutingContext holds data used by MySQLRouting (1 per plugin instances) and MySQLRoutingConnecti...
Definition: context.h:54
const std::string & get_name() const
Definition: context.h:89
std::string dest_ssl_key() const
Definition: context.h:199
const SharedQuarantineHandler & shared_quarantine() const
Definition: context.h:173
std::string get_id() const
identifier part of the name.
Definition: context.h:96
bool router_require_enforce() const
Definition: context.h:202
std::mutex source_ssl_contexts_mtx_
Definition: context.h:234
void connection_sharing(const std::optional< bool > &is_enabled)
Definition: context.h:179
std::chrono::milliseconds get_client_connect_timeout() const
Definition: context.h:112
std::atomic< uint64_t > info_handled_routes_
Number of handled routes, not used at the moment.
Definition: context.h:264
std::mutex router_info_mtx_
Definition: context.h:245
const mysql_harness::Path & get_bind_named_socket() const
Definition: context.h:125
const BlockedEndpoints & blocked_endpoints() const
Definition: context.h:73
routing_guidelines::Router_info get_router_info() const
Definition: context.h:218
size_t thread_stack_size_
memory in kilobytes allocated for thread's stack
Definition: context.h:232
uint64_t get_handled_routes()
Definition: context.h:82
void increase_info_handled_routes()
Definition: context.cc:36
SharedQuarantineHandler shared_quarantine_handler_
Callbacks for communicating with quarantined destination candidates instance.
Definition: context.h:256
void replace_source_ssl_ctx(std::shared_ptr< TlsServerContext > tls_context)
Definition: context.h:144
SharedQuarantineHandler & shared_quarantine()
Definition: context.h:169
std::atomic< bool > connection_sharing_
Definition: context.h:250
bool connection_sharing() const
Definition: context.h:177
routing_guidelines::Router_info router_info_
Definition: context.h:246
std::shared_ptr< TlsServerContext > client_ssl_ctx_
Definition: context.h:235
unsigned int get_net_buffer_length() const
Definition: context.h:104
routing::AccessMode access_mode() const
Definition: context.h:189
uint64_t get_max_connect_errors() const
Definition: context.h:83
std::atomic< uint16_t > info_active_routes_
Number of active routes.
Definition: context.h:262
MySQLRoutingContext(const RoutingConfig &routing_config, std::string name, std::shared_ptr< TlsServerContext > client_ssl_ctx, DestinationTlsContext *dest_tls_context, std::shared_ptr< routing_guidelines::Routing_guidelines_engine > routing_guidelines)
Definition: context.h:56
BaseProtocol::Type get_protocol() const
Definition: context.h:87
std::shared_ptr< routing_guidelines::Routing_guidelines_engine > get_routing_guidelines() const
Definition: context.h:207
BlockedEndpoints blocked_endpoints_
Definition: context.h:258
std::shared_ptr< TlsServerContext > source_ssl_ctx() const
get the SSL context for the client side of the route.
Definition: context.h:139
const mysql_harness::TcpDestination & get_bind_address() const
Definition: context.h:121
std::chrono::seconds wait_for_my_writes_timeout() const
Definition: context.h:195
SslMode source_ssl_mode() const noexcept
Definition: context.h:129
std::chrono::milliseconds get_destination_connect_timeout() const
Definition: context.h:108
BlockedEndpoints & blocked_endpoints()
Definition: context.h:72
DestinationTlsContext * destination_tls_context_
Definition: context.h:237
std::chrono::milliseconds connect_retry_timeout() const
Definition: context.h:117
std::mutex mutex_conn_errors_
Definition: context.h:229
const RoutingConfig routing_config_
Definition: context.h:224
std::string dest_ssl_cert() const
Definition: context.h:200
void increase_info_active_routes()
Definition: context.cc:28
void set_router_info(routing_guidelines::Router_info router_info)
Definition: context.h:211
std::shared_ptr< TlsClientContext > dest_ssl_ctx(const std::string &dest_id, const std::string &hostname)
get the SSL context for the server side of the route.
Definition: context.h:162
SslMode dest_ssl_mode() const noexcept
Definition: context.h:132
std::shared_ptr< routing_guidelines::Routing_guidelines_engine > routing_guidelines_
Routing guidelines engine used for the routing.
Definition: context.h:243
std::chrono::milliseconds connection_sharing_delay() const
Definition: context.h:185
uint16_t get_active_routes()
Definition: context.h:81
DestinationTlsContext * destination_ssl_config() const
Definition: context.h:149
bool wait_for_my_writes() const
Definition: context.h:193
void decrease_info_active_routes()
Definition: context.cc:32
const std::string name_
Descriptive name of the connection routing.
Definition: context.h:227
route specific configuration.
Definition: routing_config.h:40
std::chrono::seconds wait_for_my_writes_timeout
how long to wait for writes to be applied before reads.
Definition: routing_config.h:107
mysql_harness::Path named_socket
unix domain socket path to bind to
Definition: routing_config.h:47
bool wait_for_my_writes
Definition: routing_config.h:105
bool router_require_enforce
Definition: routing_config.h:117
SslMode dest_ssl_mode
SslMode of the server side connection.
Definition: routing_config.h:71
mysql_harness::TcpDestination bind_address
IP address to bind to.
Definition: routing_config.h:46
unsigned int client_connect_timeout
client connect timeout in seconds
Definition: routing_config.h:53
SslMode source_ssl_mode
SslMode of the client side connection.
Definition: routing_config.h:57
int connect_timeout
connect-timeout in seconds
Definition: routing_config.h:48
Protocol::Type protocol
protocol (classic, x)
Definition: routing_config.h:42
std::string dest_ssl_cert
Cert file.
Definition: routing_config.h:72
routing::AccessMode access_mode
read_write,read_only,auto
Definition: routing_config.h:102
unsigned int net_buffer_length
Size of buffer to receive packets.
Definition: routing_config.h:54
bool connection_sharing
if connection sharing is allowed.
Definition: routing_config.h:85
std::chrono::milliseconds connect_retry_timeout
timeout of retrying after a transient connect-failure.
Definition: routing_config.h:100
std::string dest_ssl_key
Key file.
Definition: routing_config.h:73
std::chrono::milliseconds connection_sharing_delay
delay before an idling connection is moved to the pool and connection sharing is allowed.
Definition: routing_config.h:87
Definition: shared_quarantine_handler.h:35
Class representing a path in a file system.
Definition: filesystem.h:63
Definition: destination.h:40
const std::string & hostname() const
Definition: destination.h:57
ulong max_connect_errors
Definition: mysqld.cc:1413
bool is_enabled()
Check if doublewrite is enabled.
Definition: buf0dblwr.h:391
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
std::chrono::seconds seconds
Definition: authorize_manager.cc:71
std::chrono::milliseconds milliseconds
Definition: authorize_manager.cc:70
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
static const size_t kDefaultStackSizeInKiloBytes
Definition: mysql_router_thread.h:44
Definition: routing_guidelines_datatypes.h:31
AccessMode
Definition: routing.h:265
Define std::hash<Gtid>.
Definition: gtid.h:355
SslMode
Definition: ssl_mode.h:29
case opt name
Definition: sslopt-case.h:29
Information about this Router instance.
Definition: routing_guidelines.h:59
std::string bind_address
address on which router is listening
Definition: routing_guidelines.h:71
std::string route_name
name of the plugin which handles the connection
Definition: routing_guidelines.h:74