MySQL 8.4.0
Source Code Documentation
routing Namespace Reference

Namespaces

namespace  impl
 

Typedefs

using Mode = RoutingMode
 

Enumerations

enum class  RoutingBootstrapSectionType {
  kClassicRw , kClassicRo , kXRw , kXRo ,
  kRwSplit
}
 
enum class  RoutingMode { kUndefined = 0 , kReadWrite = 1 , kReadOnly = 2 }
 Modes supported by Routing plugin. More...
 
enum class  AccessMode { kUndefined = 0 , kAuto = 1 }
 
enum class  RoutingStrategy {
  kUndefined = 0 , kFirstAvailable = 1 , kNextAvailable = 2 , kRoundRobin = 3 ,
  kRoundRobinWithFallback = 4
}
 Routing strategies supported by Routing plugin. More...
 

Functions

std::string get_access_mode_names ()
 Get comma separated list of all access mode names. More...
 
AccessMode get_access_mode (const std::string &value)
 Returns AccessMode for its literal representation. More...
 
std::string get_access_mode_name (AccessMode access_mode) noexcept
 Returns literal name of given access mode. More...
 
std::string get_routing_strategy_names (bool metadata_cache)
 Get comma separated list of all routing stategy names for a given routing type (metadata cache or static) More...
 
RoutingStrategy get_routing_strategy (const std::string &value)
 Returns RoutingStrategy for its literal representation. More...
 
std::string get_routing_strategy_name (RoutingStrategy routing_strategy) noexcept
 Returns literal name of given routing strategy. More...
 
RoutingBootstrapSectionType get_section_type_from_routing_name (const std::string &name)
 
BaseProtocol::Type get_default_protocol (RoutingBootstrapSectionType section_type)
 
uint16_t get_default_port (RoutingBootstrapSectionType section_type)
 
RoutingStrategy get_default_routing_strategy (RoutingBootstrapSectionType section_type)
 
std::string get_destinations_role (RoutingBootstrapSectionType section_type)
 
std::string get_default_routing_name (RoutingBootstrapSectionType section_type)
 
AccessMode get_default_access_mode (RoutingBootstrapSectionType section_type)
 
bool get_default_connection_sharing (RoutingBootstrapSectionType section_type)
 
bool get_default_router_require_enforce (RoutingBootstrapSectionType section_type)
 

Variables

constexpr int kDefaultWaitTimeout {0}
 Timeout for idling clients (in seconds). More...
 
constexpr int kDefaultMaxConnections {0}
 Max number of active routes for this routing instance. More...
 
constexpr std::chrono::seconds kDefaultDestinationConnectionTimeout
 Timeout connecting to destination (in seconds). More...
 
constexpr unsigned long long kDefaultMaxConnectErrors {100}
 Maximum connect or handshake errors per host. More...
 
constexpr std::string_view kDefaultBindAddress {"127.0.0.1"}
 Default bind address used when no bind address is configured. More...
 
constexpr std::string_view kDefaultBindAddressBootstrap {"0.0.0.0"}
 Default bind address written to the config file during bootstrap. More...
 
constexpr unsigned int kDefaultNetBufferLength {16384}
 Default net buffer length. More...
 
constexpr std::chrono::seconds kDefaultClientConnectTimeout {9}
 Timeout waiting for handshake response from client. More...
 
constexpr std::chrono::milliseconds kDefaultConnectionSharingDelay {1000}
 delay in milliseconds before an idling connection may be moved to the pool when connection sharing is allowed. More...
 
constexpr std::chrono::seconds kDefaultUnreachableDestinationRefreshInterval {1}
 The number of seconds that MySQL Router waits between checking for reachability of an unreachable destination. More...
 
constexpr bool kDefaultSslSessionCacheMode {true}
 Default SSL session cache mode. More...
 
constexpr unsigned int kDefaultSslSessionCacheSize {1024}
 Default SSL session cache size. More...
 
constexpr std::chrono::seconds kDefaultSslSessionCacheTimeout {300}
 Default SSL session cache timeout. More...
 
constexpr std::chrono::seconds kDefaultConnectRetryTimeout {7}
 Default Connect Retry timeout. More...
 
constexpr bool kDefaultWaitForMyWrites {true}
 Default Wait For My Writes timeout. More...
 
constexpr std::chrono::seconds kDefaultWaitForMyWritesTimeout {2}
 Default Wait For My Writes timeout. More...
 
constexpr std::string_view kDefaultClientSslMode {""}
 Default client SSL mode used when none is configured. More...
 
constexpr std::string_view kDefaultClientSslModeBootstrap {"PREFERRED"}
 Default client SSL mode written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultClientSslCipherBootstrap {""}
 Default client SSL cipher written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultClientSslCurvesBootstrap {""}
 Default client SSL curves written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultClientSslDhParamsBootstrap {""}
 Default client SSL DH params written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslMode {"AS_CLIENT"}
 Default server SSL mode used when none is configured. More...
 
constexpr std::string_view kDefaultServerSslModeBootstrap {"PREFERRED"}
 Default client SSL mode written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslVerify {"DISABLED"}
 Default server SSL verify. More...
 
constexpr std::string_view kDefaultServerSslCipherBootstrap {""}
 Default server SSL cipher written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslCurvesBootstrap {""}
 Default server SSL curves written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslCaBootstrap {""}
 Default server SSL CA written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslCaPathBootstrap {""}
 Default server SSL CA path written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslCrlFileBootstrap {""}
 Default server SSL CRL file written to the configuration file on bootstrap. More...
 
constexpr std::string_view kDefaultServerSslCrlPathBootstrap {""}
 Default server SSL CRL path written to the configuration file on bootstrap. More...
 
constexpr bool kDefaultConnectionSharing {false}
 Default connection sharing status. More...
 
constexpr uint64_t kDefaultMaxTotalConnections {512}
 Default maximum total connections handled by all the routing endpoints. More...
 
constexpr bool kDefaultRequireEnforce {true}
 Default for the configuration option determining if the Router enforces the router_require attribute of the user. More...
 
constexpr uint16_t kDefaultPortClassicRw {6446}
 
constexpr uint16_t kDefaultPortClassicRo {6447}
 
constexpr uint16_t kDefaultPortXRw {6448}
 
constexpr uint16_t kDefaultPortXRo {6449}
 
constexpr uint16_t kDefaultPortRwSplit {6450}
 
constexpr std::string_view kDefaultNamedSocket {""}
 
constexpr std::string_view kDefaultClassicRwSectionName {"bootstrap_rw"}
 
constexpr std::string_view kDefaultClassicRoSectionName {"bootstrap_ro"}
 
constexpr std::string_view kDefaultXRwSectionName {"bootstrap_x_rw"}
 
constexpr std::string_view kDefaultXRoSectionName {"bootstrap_x_ro"}
 
constexpr std::string_view kDefaultRwSplitSectionName {"bootstrap_rw_split"}
 
static const std::array< const char *, 2 > kAccessModeNames
 
static const std::array< const char *, 5 > kRoutingStrategyNames
 

Typedef Documentation

◆ Mode

using routing::Mode = typedef RoutingMode

Enumeration Type Documentation

◆ AccessMode

enum class routing::AccessMode
strong
Enumerator
kUndefined 
kAuto 

◆ RoutingBootstrapSectionType

Enumerator
kClassicRw 
kClassicRo 
kXRw 
kXRo 
kRwSplit 

◆ RoutingMode

enum class routing::RoutingMode
strong

Modes supported by Routing plugin.

Enumerator
kUndefined 
kReadWrite 
kReadOnly 

◆ RoutingStrategy

enum class routing::RoutingStrategy
strong

Routing strategies supported by Routing plugin.

Enumerator
kUndefined 
kFirstAvailable 
kNextAvailable 
kRoundRobin 
kRoundRobinWithFallback 

Function Documentation

◆ get_access_mode()

AccessMode routing::get_access_mode ( const std::string &  value)

Returns AccessMode for its literal representation.

If no AccessMode is found for given string, Mode::kUndefined is returned.

Parameters
valueliteral representation of the access mode
Returns
AccessMode for the given string or AccessMode::kUndefined

◆ get_access_mode_name()

std::string routing::get_access_mode_name ( AccessMode  access_mode)
noexcept

Returns literal name of given access mode.

Returns literal name of given access mode as a std:string. When the access mode is not found, empty string is returned.

Parameters
access_modeaccess_mode to look up
Returns
Name of access mode as std::string or empty string

◆ get_access_mode_names()

std::string routing::get_access_mode_names ( )

Get comma separated list of all access mode names.

◆ get_default_access_mode()

AccessMode routing::get_default_access_mode ( RoutingBootstrapSectionType  section_type)

◆ get_default_connection_sharing()

bool routing::get_default_connection_sharing ( RoutingBootstrapSectionType  section_type)

◆ get_default_port()

uint16_t routing::get_default_port ( RoutingBootstrapSectionType  section_type)

◆ get_default_protocol()

BaseProtocol::Type routing::get_default_protocol ( RoutingBootstrapSectionType  section_type)

◆ get_default_router_require_enforce()

bool routing::get_default_router_require_enforce ( RoutingBootstrapSectionType  section_type)

◆ get_default_routing_name()

std::string routing::get_default_routing_name ( RoutingBootstrapSectionType  section_type)

◆ get_default_routing_strategy()

RoutingStrategy routing::get_default_routing_strategy ( RoutingBootstrapSectionType  section_type)

◆ get_destinations_role()

std::string routing::get_destinations_role ( routing::RoutingBootstrapSectionType  section_type)

◆ get_routing_strategy()

RoutingStrategy routing::get_routing_strategy ( const std::string &  value)

Returns RoutingStrategy for its literal representation.

If no RoutingStrategy is found for given string, RoutingStrategy::kUndefined is returned.

Parameters
valueliteral representation of the access mode
Returns
RoutingStrategy for the given string or RoutingStrategy::kUndefined

◆ get_routing_strategy_name()

std::string routing::get_routing_strategy_name ( RoutingStrategy  routing_strategy)
noexcept

Returns literal name of given routing strategy.

Returns literal name of given routing strategy as a std:string. When the routing strategy is not found, empty string is returned.

Parameters
routing_strategyRouting strategy to look up
Returns
Name of routing strategy as std::string or empty string

◆ get_routing_strategy_names()

std::string routing::get_routing_strategy_names ( bool  metadata_cache)

Get comma separated list of all routing stategy names for a given routing type (metadata cache or static)

Parameters
metadata_cachebool flag indicating if the list should contain strategies supported for metadata_cache or static routing

◆ get_section_type_from_routing_name()

RoutingBootstrapSectionType routing::get_section_type_from_routing_name ( const std::string &  name)

Variable Documentation

◆ kAccessModeNames

const std::array<const char *, 2> routing::kAccessModeNames
static
Initial value:
{{
nullptr,
"auto",
}}

◆ kDefaultBindAddress

constexpr std::string_view routing::kDefaultBindAddress {"127.0.0.1"}
constexpr

Default bind address used when no bind address is configured.

◆ kDefaultBindAddressBootstrap

constexpr std::string_view routing::kDefaultBindAddressBootstrap {"0.0.0.0"}
constexpr

Default bind address written to the config file during bootstrap.

◆ kDefaultClassicRoSectionName

constexpr std::string_view routing::kDefaultClassicRoSectionName {"bootstrap_ro"}
constexpr

◆ kDefaultClassicRwSectionName

constexpr std::string_view routing::kDefaultClassicRwSectionName {"bootstrap_rw"}
constexpr

◆ kDefaultClientConnectTimeout

constexpr std::chrono::seconds routing::kDefaultClientConnectTimeout {9}
constexpr

Timeout waiting for handshake response from client.

The number of seconds that MySQL Router waits for a handshake response. The default value is 9 seconds (default MySQL Server minus 1).

◆ kDefaultClientSslCipherBootstrap

constexpr std::string_view routing::kDefaultClientSslCipherBootstrap {""}
constexpr

Default client SSL cipher written to the configuration file on bootstrap.

◆ kDefaultClientSslCurvesBootstrap

constexpr std::string_view routing::kDefaultClientSslCurvesBootstrap {""}
constexpr

Default client SSL curves written to the configuration file on bootstrap.

◆ kDefaultClientSslDhParamsBootstrap

constexpr std::string_view routing::kDefaultClientSslDhParamsBootstrap {""}
constexpr

Default client SSL DH params written to the configuration file on bootstrap.

◆ kDefaultClientSslMode

constexpr std::string_view routing::kDefaultClientSslMode {""}
constexpr

Default client SSL mode used when none is configured.

◆ kDefaultClientSslModeBootstrap

constexpr std::string_view routing::kDefaultClientSslModeBootstrap {"PREFERRED"}
constexpr

Default client SSL mode written to the configuration file on bootstrap.

◆ kDefaultConnectionSharing

constexpr bool routing::kDefaultConnectionSharing {false}
constexpr

Default connection sharing status.

◆ kDefaultConnectionSharingDelay

constexpr std::chrono::milliseconds routing::kDefaultConnectionSharingDelay {1000}
constexpr

delay in milliseconds before an idling connection may be moved to the pool when connection sharing is allowed.

◆ kDefaultConnectRetryTimeout

constexpr std::chrono::seconds routing::kDefaultConnectRetryTimeout {7}
constexpr

Default Connect Retry timeout.

◆ kDefaultDestinationConnectionTimeout

constexpr std::chrono::seconds routing::kDefaultDestinationConnectionTimeout
constexpr
Initial value:
{
static constexpr int kDefaultConnectTimeout
Definition: mysql_session.h:155

Timeout connecting to destination (in seconds).

Constant defining how long we wait to establish connection with the server before we give up.

◆ kDefaultMaxConnectErrors

constexpr unsigned long long routing::kDefaultMaxConnectErrors {100}
constexpr

Maximum connect or handshake errors per host.

Maximum connect or handshake errors after which a host will be blocked. Such errors can happen when the client does not reply the handshake, sends an incorrect packet, or garbage.

◆ kDefaultMaxConnections

constexpr int routing::kDefaultMaxConnections {0}
constexpr

Max number of active routes for this routing instance.

0 == no limit per route

◆ kDefaultMaxTotalConnections

constexpr uint64_t routing::kDefaultMaxTotalConnections {512}
constexpr

Default maximum total connections handled by all the routing endpoints.

◆ kDefaultNamedSocket

constexpr std::string_view routing::kDefaultNamedSocket {""}
constexpr

◆ kDefaultNetBufferLength

constexpr unsigned int routing::kDefaultNetBufferLength {16384}
constexpr

Default net buffer length.

Default network buffer length which can be set in the MySQL Server.

This should match the default of the latest MySQL Server.

◆ kDefaultPortClassicRo

constexpr uint16_t routing::kDefaultPortClassicRo {6447}
constexpr

◆ kDefaultPortClassicRw

constexpr uint16_t routing::kDefaultPortClassicRw {6446}
constexpr

◆ kDefaultPortRwSplit

constexpr uint16_t routing::kDefaultPortRwSplit {6450}
constexpr

◆ kDefaultPortXRo

constexpr uint16_t routing::kDefaultPortXRo {6449}
constexpr

◆ kDefaultPortXRw

constexpr uint16_t routing::kDefaultPortXRw {6448}
constexpr

◆ kDefaultRequireEnforce

constexpr bool routing::kDefaultRequireEnforce {true}
constexpr

Default for the configuration option determining if the Router enforces the router_require attribute of the user.

◆ kDefaultRwSplitSectionName

constexpr std::string_view routing::kDefaultRwSplitSectionName {"bootstrap_rw_split"}
constexpr

◆ kDefaultServerSslCaBootstrap

constexpr std::string_view routing::kDefaultServerSslCaBootstrap {""}
constexpr

Default server SSL CA written to the configuration file on bootstrap.

◆ kDefaultServerSslCaPathBootstrap

constexpr std::string_view routing::kDefaultServerSslCaPathBootstrap {""}
constexpr

Default server SSL CA path written to the configuration file on bootstrap.

◆ kDefaultServerSslCipherBootstrap

constexpr std::string_view routing::kDefaultServerSslCipherBootstrap {""}
constexpr

Default server SSL cipher written to the configuration file on bootstrap.

◆ kDefaultServerSslCrlFileBootstrap

constexpr std::string_view routing::kDefaultServerSslCrlFileBootstrap {""}
constexpr

Default server SSL CRL file written to the configuration file on bootstrap.

◆ kDefaultServerSslCrlPathBootstrap

constexpr std::string_view routing::kDefaultServerSslCrlPathBootstrap {""}
constexpr

Default server SSL CRL path written to the configuration file on bootstrap.

◆ kDefaultServerSslCurvesBootstrap

constexpr std::string_view routing::kDefaultServerSslCurvesBootstrap {""}
constexpr

Default server SSL curves written to the configuration file on bootstrap.

◆ kDefaultServerSslMode

constexpr std::string_view routing::kDefaultServerSslMode {"AS_CLIENT"}
constexpr

Default server SSL mode used when none is configured.

◆ kDefaultServerSslModeBootstrap

constexpr std::string_view routing::kDefaultServerSslModeBootstrap {"PREFERRED"}
constexpr

Default client SSL mode written to the configuration file on bootstrap.

◆ kDefaultServerSslVerify

constexpr std::string_view routing::kDefaultServerSslVerify {"DISABLED"}
constexpr

Default server SSL verify.

◆ kDefaultSslSessionCacheMode

constexpr bool routing::kDefaultSslSessionCacheMode {true}
constexpr

Default SSL session cache mode.

◆ kDefaultSslSessionCacheSize

constexpr unsigned int routing::kDefaultSslSessionCacheSize {1024}
constexpr

Default SSL session cache size.

◆ kDefaultSslSessionCacheTimeout

constexpr std::chrono::seconds routing::kDefaultSslSessionCacheTimeout {300}
constexpr

Default SSL session cache timeout.

◆ kDefaultUnreachableDestinationRefreshInterval

constexpr std::chrono::seconds routing::kDefaultUnreachableDestinationRefreshInterval {1}
constexpr

The number of seconds that MySQL Router waits between checking for reachability of an unreachable destination.

◆ kDefaultWaitForMyWrites

constexpr bool routing::kDefaultWaitForMyWrites {true}
constexpr

Default Wait For My Writes timeout.

◆ kDefaultWaitForMyWritesTimeout

constexpr std::chrono::seconds routing::kDefaultWaitForMyWritesTimeout {2}
constexpr

Default Wait For My Writes timeout.

◆ kDefaultWaitTimeout

constexpr int routing::kDefaultWaitTimeout {0}
constexpr

Timeout for idling clients (in seconds).

Constant defining how long (in seconds) a client can keep the connection idling. This is similar to the wait_timeout variable in the MySQL Server.

0 == no timeout used.

◆ kDefaultXRoSectionName

constexpr std::string_view routing::kDefaultXRoSectionName {"bootstrap_x_ro"}
constexpr

◆ kDefaultXRwSectionName

constexpr std::string_view routing::kDefaultXRwSectionName {"bootstrap_x_rw"}
constexpr

◆ kRoutingStrategyNames

const std::array<const char *, 5> routing::kRoutingStrategyNames
static
Initial value:
{{
nullptr,
"first-available",
"next-available",
"round-robin",
"round-robin-with-fallback",
}}