MySQL 8.3.0
Source Code Documentation
routing Namespace Reference

Namespaces

namespace  impl
 

Typedefs

using Mode = RoutingMode
 

Enumerations

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 ROUTING_EXPORT get_mode_names ()
 Get comma separated list of all mode names. More...
 
Mode ROUTING_EXPORT get_mode (const std::string &value)
 Returns Mode for its literal representation. More...
 
std::string ROUTING_EXPORT get_mode_name (Mode mode) noexcept
 Returns literal name of given mode. More...
 
std::string ROUTING_EXPORT get_access_mode_names ()
 Get comma separated list of all access mode names. More...
 
AccessMode ROUTING_EXPORT get_access_mode (const std::string &value)
 Returns AccessMode for its literal representation. More...
 
std::string ROUTING_EXPORT get_access_mode_name (AccessMode access_mode) noexcept
 Returns literal name of given access mode. More...
 
std::string ROUTING_EXPORT 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 ROUTING_EXPORT get_routing_strategy (const std::string &value)
 Returns RoutingStrategy for its literal representation. More...
 
std::string ROUTING_EXPORT get_routing_strategy_name (RoutingStrategy routing_strategy) noexcept
 Returns literal name of given routing strategy. More...
 

Variables

constexpr const int kDefaultWaitTimeout {0}
 Timeout for idling clients (in seconds). More...
 
constexpr const int kDefaultMaxConnections {0}
 Max number of active routes for this routing instance. More...
 
constexpr const std::chrono::seconds kDefaultDestinationConnectionTimeout
 Timeout connecting to destination (in seconds). More...
 
constexpr const unsigned long long kDefaultMaxConnectErrors {100}
 Maximum connect or handshake errors per host. More...
 
constexpr const std::string_view kDefaultBindAddress {"127.0.0.1"}
 Default bind address. More...
 
constexpr const unsigned int kDefaultNetBufferLength {16384}
 Default net buffer length. More...
 
constexpr const std::chrono::seconds kDefaultClientConnectTimeout {9}
 Timeout waiting for handshake response from client. More...
 
constexpr const 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 const std::chrono::seconds kDefaultUnreachableDestinationRefreshInterval {1}
 The number of seconds that MySQL Router waits between checking for reachability of an unreachable destination. More...
 
constexpr const bool kDefaultSslSessionCacheMode {true}
 Default SSL session cache mode. More...
 
constexpr const unsigned int kDefaultSslSessionCacheSize {1024}
 Default SSL session cache size. More...
 
constexpr const std::chrono::seconds kDefaultSslSessionCacheTimeout {300}
 Default SSL session cache timeout. More...
 
constexpr const std::chrono::seconds kDefaultConnectRetryTimeout {7}
 Default Connect Retry timeout. More...
 
constexpr const bool kDefaultWaitForMyWrites {true}
 Default Wait For My Writes timeout. More...
 
constexpr const std::chrono::seconds kDefaultWaitForMyWritesTimeout {2}
 Default Wait For My Writes timeout. More...
 
static const std::array< const char *, 3 > kModeNames
 
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 

◆ 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()

ROUTING_EXPORT 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()

ROUTING_EXPORT 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()

ROUTING_EXPORT std::string routing::get_access_mode_names ( )

Get comma separated list of all access mode names.

◆ get_mode()

ROUTING_EXPORT Mode routing::get_mode ( const std::string &  value)

Returns Mode for its literal representation.

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

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

◆ get_mode_name()

ROUTING_EXPORT std::string routing::get_mode_name ( Mode  mode)
noexcept

Returns literal name of given mode.

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

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

◆ get_mode_names()

ROUTING_EXPORT std::string routing::get_mode_names ( )

Get comma separated list of all mode names.

◆ get_routing_strategy()

ROUTING_EXPORT 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()

ROUTING_EXPORT 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()

ROUTING_EXPORT 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

Variable Documentation

◆ kAccessModeNames

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

◆ kDefaultBindAddress

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

Default bind address.

◆ kDefaultClientConnectTimeout

constexpr const 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).

◆ kDefaultConnectionSharingDelay

constexpr const 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 const std::chrono::seconds routing::kDefaultConnectRetryTimeout {7}
constexpr

Default Connect Retry timeout.

◆ kDefaultDestinationConnectionTimeout

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

Timeout connecting to destination (in seconds).

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

◆ kDefaultMaxConnectErrors

constexpr const 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 const int routing::kDefaultMaxConnections {0}
constexpr

Max number of active routes for this routing instance.

0 == no limit per route

◆ kDefaultNetBufferLength

constexpr const 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.

◆ kDefaultSslSessionCacheMode

constexpr const bool routing::kDefaultSslSessionCacheMode {true}
constexpr

Default SSL session cache mode.

◆ kDefaultSslSessionCacheSize

constexpr const unsigned int routing::kDefaultSslSessionCacheSize {1024}
constexpr

Default SSL session cache size.

◆ kDefaultSslSessionCacheTimeout

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

Default SSL session cache timeout.

◆ kDefaultUnreachableDestinationRefreshInterval

constexpr const 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 const bool routing::kDefaultWaitForMyWrites {true}
constexpr

Default Wait For My Writes timeout.

◆ kDefaultWaitForMyWritesTimeout

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

Default Wait For My Writes timeout.

◆ kDefaultWaitTimeout

constexpr const 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.

◆ kModeNames

const std::array<const char *, 3> routing::kModeNames
static
Initial value:
{{
nullptr,
"read-write",
"read-only",
}}

◆ kRoutingStrategyNames

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