![]() |
MySQL 9.3.0
Source Code Documentation
|
Manage destinations for a Connection Routing. More...
#include <destination.h>
Public Types | |
using | DestVector = std::vector< mysql_harness::Destination > |
Public Member Functions | |
DestinationManager (net::io_context &io_ctx, MySQLRoutingContext &routing_ctx) | |
Default constructor. More... | |
virtual | ~DestinationManager ()=default |
Destructor. More... | |
DestinationManager (const DestinationManager &other)=delete | |
DestinationManager (DestinationManager &&other)=delete | |
DestinationManager & | operator= (const DestinationManager &other)=delete |
DestinationManager & | operator= (DestinationManager &&other)=delete |
virtual void | connect_status (std::error_code ec)=0 |
virtual void | start (const mysql_harness::PluginFuncEnv *env)=0 |
Start the destination manager. More... | |
virtual stdx::expected< void, std::error_code > | init_destinations (const routing_guidelines::Session_info &session_info)=0 |
Set up destination manager, prepare the destinations. More... | |
virtual mysqlrouter::ServerMode | purpose () const |
virtual bool | refresh_destinations (const routing_guidelines::Session_info &)=0 |
refresh destinations. More... | |
virtual void | handle_sockets_acceptors ()=0 |
Trigger listening socket acceptors state handler based on the destination type. More... | |
virtual std::unique_ptr< Destination > | get_next_destination (const routing_guidelines::Session_info &)=0 |
Get destination that should be used for connection attempt. More... | |
virtual std::unique_ptr< Destination > | get_last_used_destination () const =0 |
Get destination that was selected as a destination candidate. More... | |
virtual std::vector< mysql_harness::Destination > | get_destination_candidates () const =0 |
Get addresses of all nodes that are a possible destination candidates. More... | |
bool | routing_guidelines_session_rand_used () const |
Check if routing guidelines uses $.session.rand as a match criterion. More... | |
routing_guidelines::Router_info | get_router_info () const |
Get information about this given Router instance. More... | |
virtual bool | has_read_write () const =0 |
Check if there are read-write destinations that could be used. More... | |
virtual bool | has_read_only () const =0 |
Check if there are read-only destinations that could be used. More... | |
![]() | |
virtual | ~DestinationNodesStateNotifier ()=default |
AllowedNodesChangeCallbacksListIterator | register_allowed_nodes_change_callback (const AllowedNodesChangedCallback &clb) |
Registers the callback for notification on the change in the state if the destination nodes. More... | |
void | unregister_allowed_nodes_change_callback (const AllowedNodesChangeCallbacksListIterator &it) |
Unregisters the callback registered with register_allowed_nodes_change_callback(). More... | |
void | register_start_router_socket_acceptor (const StartSocketAcceptorCallback &clb) |
Registers the callback for notification that the routing socket acceptor should accept new connections. More... | |
void | unregister_start_router_socket_acceptor () |
Unregisters the callback registered with register_start_router_socket_acceptor(). More... | |
void | register_stop_router_socket_acceptor (const StopSocketAcceptorCallback &clb) |
Registers the callback for notification that the routing socket acceptor should stop accepting new connections. More... | |
void | unregister_stop_router_socket_acceptor () |
Unregisters the callback registered with register_stop_router_socket_acceptor(). More... | |
void | register_md_refresh_callback (const MetadataRefreshCallback &callback) |
Registers a callback that is going to be used on metadata refresh. More... | |
void | unregister_md_refresh_callback () |
Unregisters the callback registered with register_md_refresh_callback(). More... | |
void | register_query_quarantined_destinations (const QueryQuarantinedDestinationsCallback &clb) |
Registers a callback that could be used for checking if the provided destination candidate is currently quarantined. More... | |
void | unregister_query_quarantined_destinations () |
Unregisters the callback registered with register_query_quarantined_destinations(). More... | |
virtual bool | is_dynamic () |
Specifies if the destination addresses can be added/removed from the set. More... | |
virtual std::string | get_dynamic_plugin_name () |
Protected Member Functions | |
const MySQLRoutingContext & | get_routing_context () const |
Protected Attributes | |
net::io_context & | io_ctx_ |
MySQLRoutingContext & | routing_ctx_ |
std::mutex | state_mtx_ |
std::error_code | last_ec_ |
![]() | |
AllowedNodesChangeCallbacksList | allowed_nodes_change_callbacks_ |
MetadataRefreshCallback | md_refresh_callback_ |
StartSocketAcceptorCallback | start_router_socket_acceptor_callback_ |
StopSocketAcceptorCallback | stop_router_socket_acceptor_callback_ |
QueryQuarantinedDestinationsCallback | query_quarantined_destinations_callback_ |
std::mutex | allowed_nodes_change_callbacks_mtx_ |
std::mutex | md_refresh_callback_mtx_ |
std::mutex | socket_acceptor_handle_callbacks_mtx |
std::mutex | query_quarantined_destinations_callback_mtx_ |
Manage destinations for a Connection Routing.
This class manages destinations which are used in Connection Routing. A destination is usually a MySQL Server and is stored using the IP or hostname together with the TCP port (defaulting to 3306 for classic protocol or to 33060 for x protocol).
using DestinationManager::DestVector = std::vector<mysql_harness::Destination> |
|
inline |
Default constructor.
io_ctx | IO context |
routing_ctx | Routing context |
|
virtualdefault |
Destructor.
|
delete |
|
delete |
|
pure virtual |
Implemented in DestMetadataCacheManager, and StaticDestinationsManager.
|
pure virtual |
Get addresses of all nodes that are a possible destination candidates.
Implemented in DestMetadataCacheManager, and StaticDestinationsManager.
|
pure virtual |
Get destination that was selected as a destination candidate.
Implemented in DestMetadataCacheManager, and StaticDestinationsManager.
|
pure virtual |
Get destination that should be used for connection attempt.
It uses routing strategies and internal information (last used indexes, failed attempt information) for destination selection.
Implemented in StaticDestinationsManager, and DestMetadataCacheManager.
|
inline |
Get information about this given Router instance.
|
inlineprotected |
|
pure virtual |
Trigger listening socket acceptors state handler based on the destination type.
Implemented in DestMetadataCacheManager, and StaticDestinationsManager.
|
pure virtual |
Check if there are read-only destinations that could be used.
Implemented in DestMetadataCacheManager, and StaticDestinationsManager.
|
pure virtual |
Check if there are read-write destinations that could be used.
Implemented in DestMetadataCacheManager, and StaticDestinationsManager.
|
pure virtual |
Set up destination manager, prepare the destinations.
Implemented in StaticDestinationsManager, and DestMetadataCacheManager.
|
delete |
|
delete |
|
inlinevirtual |
Reimplemented in DestMetadataCacheManager.
|
pure virtual |
refresh destinations.
should be called after connecting to all destinations failed.
true | refresh suceeded, there are destinations that could be used. |
false | refresh failed, there are no destinations that could be used. |
Implemented in StaticDestinationsManager, and DestMetadataCacheManager.
|
inline |
Check if routing guidelines uses $.session.rand as a match criterion.
|
pure virtual |
Start the destination manager.
env | pointer to the PluginFuncEnv object |
Implemented in StaticDestinationsManager, and DestMetadataCacheManager.
|
protected |
|
protected |
|
protected |
|
protected |