![]() |
MySQL 9.3.0
Source Code Documentation
|
#include <dest_static.h>
Public Member Functions | |
StaticDestinationsManager (routing::RoutingStrategy strategy, net::io_context &io_ctx, MySQLRoutingContext &routing_ctx) | |
void | add (const mysql_harness::Destination &dest) |
Adds a destination. More... | |
void | start (const mysql_harness::PluginFuncEnv *) override |
Start the destination manager. More... | |
std::vector< mysql_harness::Destination > | get_destination_candidates () const override |
Get addresses of all nodes that are a possible destination candidates. More... | |
bool | refresh_destinations (const routing_guidelines::Session_info &) override |
refresh destinations. More... | |
void | handle_sockets_acceptors () override |
Trigger listening socket acceptors state handler based on the destination type. More... | |
std::unique_ptr< Destination > | get_next_destination (const routing_guidelines::Session_info &) override |
Get destination that should be used for connection attempt. More... | |
std::unique_ptr< Destination > | get_last_used_destination () const override |
Get destination that was selected as a destination candidate. More... | |
stdx::expected< void, std::error_code > | init_destinations (const routing_guidelines::Session_info &) override |
Set up destination manager, prepare the destinations. More... | |
void | connect_status (std::error_code ec) override |
bool | has_read_write () const override |
Check if there are read-write destinations that could be used. More... | |
bool | has_read_only () const override |
Check if there are read-only destinations that could be used. More... | |
![]() | |
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 mysqlrouter::ServerMode | purpose () const |
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 | ~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 () |
Private Attributes | |
std::unique_ptr< StrategyHandler > | strategy_handler_ |
Get destination index based on routing strategy for static routes. More... | |
DestVector | destinations_ |
List of destinations. More... | |
Destination | last_destination_ |
Protocol::Type | protocol_ |
Protocol for the endpoint. More... | |
Additional Inherited Members | |
![]() | |
using | DestVector = std::vector< mysql_harness::Destination > |
![]() | |
const MySQLRoutingContext & | get_routing_context () const |
![]() | |
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_ |
StaticDestinationsManager::StaticDestinationsManager | ( | routing::RoutingStrategy | strategy, |
net::io_context & | io_ctx, | ||
MySQLRoutingContext & | routing_ctx | ||
) |
void StaticDestinationsManager::add | ( | const mysql_harness::Destination & | dest | ) |
Adds a destination.
Adds a destination using the given address and port number.
dest | destination address |
|
overridevirtual |
Implements DestinationManager.
|
inlineoverridevirtual |
Get addresses of all nodes that are a possible destination candidates.
Implements DestinationManager.
|
inlineoverridevirtual |
Get destination that was selected as a destination candidate.
Implements DestinationManager.
|
overridevirtual |
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.
Implements DestinationManager.
|
inlineoverridevirtual |
Trigger listening socket acceptors state handler based on the destination type.
Implements DestinationManager.
|
inlineoverridevirtual |
Check if there are read-only destinations that could be used.
Implements DestinationManager.
|
inlineoverridevirtual |
Check if there are read-write destinations that could be used.
Implements DestinationManager.
|
inlineoverridevirtual |
Set up destination manager, prepare the destinations.
Implements DestinationManager.
|
inlineoverridevirtual |
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. |
Implements DestinationManager.
|
overridevirtual |
Start the destination manager.
env | pointer to the PluginFuncEnv object |
Implements DestinationManager.
|
private |
List of destinations.
|
private |
|
private |
Protocol for the endpoint.
|
private |
Get destination index based on routing strategy for static routes.