26#ifndef ROUTING_DESTINATION_INCLUDED
27#define ROUTING_DESTINATION_INCLUDED
59 const std::string &)>;
65 AllowedNodesChangeCallbacksList::iterator;
68 std::function<stdx::expected<void, std::string>()>;
86 using DestVector = std::vector<mysql_harness::Destination>;
Manage destinations for a Connection Routing.
Definition: destination.h:84
std::error_code last_ec_
Definition: destination.h:196
virtual bool has_read_write() const =0
Check if there are read-write destinations that could be used.
DestinationManager & operator=(DestinationManager &&other)=delete
virtual void start(const mysql_harness::PluginFuncEnv *env)=0
Start the destination manager.
routing_guidelines::Router_info get_router_info() const
Get information about this given Router instance.
Definition: destination.h:174
net::io_context & io_ctx_
Definition: destination.h:193
std::mutex state_mtx_
Definition: destination.h:195
DestinationManager(net::io_context &io_ctx, MySQLRoutingContext &routing_ctx)
Default constructor.
Definition: destination.h:93
virtual bool refresh_destinations(const routing_guidelines::Session_info &)=0
refresh destinations.
virtual std::vector< mysql_harness::Destination > get_destination_candidates() const =0
Get addresses of all nodes that are a possible destination candidates.
virtual void connect_status(std::error_code ec)=0
DestinationManager & operator=(const DestinationManager &other)=delete
virtual mysqlrouter::ServerMode purpose() const
Definition: destination.h:120
std::vector< mysql_harness::Destination > DestVector
Definition: destination.h:86
DestinationManager(DestinationManager &&other)=delete
bool routing_guidelines_session_rand_used() const
Check if routing guidelines uses $.session.rand as a match criterion.
Definition: destination.h:166
virtual void handle_sockets_acceptors()=0
Trigger listening socket acceptors state handler based on the destination type.
const MySQLRoutingContext & get_routing_context() const
Definition: destination.h:189
virtual stdx::expected< void, std::error_code > init_destinations(const routing_guidelines::Session_info &session_info)=0
Set up destination manager, prepare the destinations.
virtual std::unique_ptr< Destination > get_last_used_destination() const =0
Get destination that was selected as a destination candidate.
virtual ~DestinationManager()=default
Destructor.
virtual std::unique_ptr< Destination > get_next_destination(const routing_guidelines::Session_info &)=0
Get destination that should be used for connection attempt.
MySQLRoutingContext & routing_ctx_
Definition: destination.h:194
DestinationManager(const DestinationManager &other)=delete
virtual bool has_read_only() const =0
Check if there are read-only destinations that could be used.
Allows the obervers to register for notifications on the change in the state of the destination nodes...
Definition: destination_nodes_state_notifier.h:71
MySQLRoutingContext holds data used by MySQLRouting (1 per plugin instances) and MySQLRoutingConnecti...
Definition: context.h:54
routing_guidelines::Router_info get_router_info() const
Definition: context.h:209
std::shared_ptr< routing_guidelines::Routing_guidelines_engine > get_routing_guidelines() const
Definition: context.h:198
PluginFuncEnv object.
Definition: loader.h:675
Definition: io_context.h:61
Definition: expected.h:286
std::function< void()> StopSocketAcceptorCallback
Definition: destination_nodes_state_notifier.h:55
std::function< stdx::expected< void, std::string >()> StartSocketAcceptorCallback
Definition: destination_nodes_state_notifier.h:54
std::function< void(const AllowedNodes &, const AllowedNodes &, const bool, const std::string &)> AllowedNodesChangedCallback
Definition: destination_nodes_state_notifier.h:45
AllowedNodesChangeCallbacksList::iterator AllowedNodesChangeCallbacksListIterator
Definition: destination_nodes_state_notifier.h:51
std::list< AllowedNodesChangedCallback > AllowedNodesChangeCallbacksList
Definition: destination_nodes_state_notifier.h:49
std::function< void(const bool, const AllowedNodes &)> MetadataRefreshCallback
Definition: destination_nodes_state_notifier.h:60
std::vector< AvailableDestination > AllowedNodes
Definition: destination_status_types.h:62
Header for compiler-dependent features.
ServerMode
Definition: datatypes.h:50
Information about this Router instance.
Definition: routing_guidelines.h:59
Information about incoming session.
Definition: routing_guidelines.h:103