MySQL 8.0.40
Source Code Documentation
routing Namespace Reference

Namespaces

namespace  impl
 

Enumerations

enum class  AccessMode { kUndefined = 0 , kReadWrite = 1 , kReadOnly = 2 }
 Modes supported by Routing plugin. More...
 
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_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...
 
static const std::array< const char *, 3 > kAccessModeNames
 
static const std::array< const char *, 5 > kRoutingStrategyNames
 

Enumeration Type Documentation

◆ AccessMode

enum class routing::AccessMode
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, AccessMode::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_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 *, 3> routing::kAccessModeNames
static
Initial value:
{{
nullptr,
"read-write",
"read-only",
}}

◆ 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.

◆ kDefaultDestinationConnectionTimeout

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

◆ 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.

◆ 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.

◆ kRoutingStrategyNames

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