26#ifndef ROUTING_DESTINATION_INCLUDED 
   27#define ROUTING_DESTINATION_INCLUDED 
   35#include <system_error> 
   59                       const std::string &)>;
 
   65    AllowedNodesChangeCallbacksList::iterator;
 
   68    std::function<stdx::expected<void, std::string>()>;
 
  224  virtual void add(
const std::string &address, uint16_t 
port);
 
  233  virtual void remove(
const std::string &address, uint16_t 
port);
 
  257  virtual void clear();
 
  265  size_t size() noexcept;
 
Type
supported protocols
Definition: base_protocol.h:32
 
Allows the obervers to register for notifications on the change in the state of the destination nodes...
Definition: destination.h:85
 
StartSocketAcceptorCallback start_router_socket_acceptor_callback_
Definition: destination.h:168
 
MetadataRefreshCallback md_refresh_callback_
Definition: destination.h:167
 
StopSocketAcceptorCallback stop_router_socket_acceptor_callback_
Definition: destination.h:169
 
void unregister_query_quarantined_destinations()
Unregisters the callback registered with register_query_quarantined_destinations().
Definition: destination.cc:96
 
std::mutex socket_acceptor_handle_callbacks_mtx
Definition: destination.h:173
 
void register_query_quarantined_destinations(const QueryQuarantinedDestinationsCallback &clb)
Registers a callback that could be used for checking if the provided destination candidate is current...
Definition: destination.cc:88
 
QueryQuarantinedDestinationsCallback query_quarantined_destinations_callback_
Definition: destination.h:170
 
AllowedNodesChangeCallbacksList allowed_nodes_change_callbacks_
Definition: destination.h:166
 
std::mutex md_refresh_callback_mtx_
Definition: destination.h:172
 
std::mutex allowed_nodes_change_callbacks_mtx_
Definition: destination.h:171
 
void unregister_md_refresh_callback()
Unregisters the callback registered with register_md_refresh_callback().
Definition: destination.cc:83
 
std::mutex query_quarantined_destinations_callback_mtx_
Definition: destination.h:174
 
void register_md_refresh_callback(const MetadataRefreshCallback &callback)
Registers a callback that is going to be used on metadata refresh.
Definition: destination.cc:77
 
void register_start_router_socket_acceptor(const StartSocketAcceptorCallback &clb)
Registers the callback for notification that the routing socket acceptor should accept new connection...
Definition: destination.cc:55
 
void unregister_allowed_nodes_change_callback(const AllowedNodesChangeCallbacksListIterator &it)
Unregisters the callback registered with register_allowed_nodes_change_callback().
Definition: destination.cc:49
 
void unregister_stop_router_socket_acceptor()
Unregisters the callback registered with register_stop_router_socket_acceptor().
Definition: destination.cc:72
 
void unregister_start_router_socket_acceptor()
Unregisters the callback registered with register_start_router_socket_acceptor().
Definition: destination.cc:61
 
void register_stop_router_socket_acceptor(const StopSocketAcceptorCallback &clb)
Registers the callback for notification that the routing socket acceptor should stop accepting new co...
Definition: destination.cc:66
 
AllowedNodesChangeCallbacksListIterator register_allowed_nodes_change_callback(const AllowedNodesChangedCallback &clb)
Registers the callback for notification on the change in the state if the destination nodes.
Definition: destination.cc:42
 
A forward iterable container of destinations.
Definition: destination.h:107
 
static Type get_default()
Definition: protocol.h:37
 
Manage destinations for a Connection Routing.
Definition: destination.h:189
 
virtual ~RouteDestination()=default
Destructor.
 
RouteDestination(const RouteDestination &other)=delete
 
AddrVector destinations_
List of destinations.
Definition: destination.h:320
 
virtual AddrVector get_destinations() const
Definition: destination.cc:151
 
virtual Destinations destinations()=0
get destinations to connect() to.
 
virtual void remove(const std::string &address, uint16_t port)
Removes a destination.
Definition: destination.cc:119
 
AddrVector::const_iterator begin() const
Definition: destination.h:281
 
virtual void handle_sockets_acceptors()
Trigger listening socket acceptors state handler based on the destination type.
Definition: destination.h:316
 
RouteDestination & operator=(const RouteDestination &other)=delete
 
net::io_context & io_ctx_
Definition: destination.h:325
 
RouteDestination(net::io_context &io_ctx, Protocol::Type protocol=Protocol::get_default())
Default constructor.
Definition: destination.h:199
 
virtual std::optional< Destinations > refresh_destinations(const Destinations &dests)
refresh destinations.
Definition: destination.cc:158
 
virtual routing::RoutingStrategy get_strategy()=0
Return our routing strategy.
 
AddrVector::const_iterator end() const
Definition: destination.h:285
 
std::vector< mysql_harness::TCPAddress > AddrVector
Definition: destination.h:191
 
Protocol::Type protocol_
Protocol for the destination.
Definition: destination.h:328
 
RouteDestination(RouteDestination &&other)=delete
 
std::mutex mutex_update_
Mutex for updating destinations and iterator.
Definition: destination.h:323
 
virtual bool empty() const noexcept
Returns whether there are destinations.
Definition: destination.h:271
 
RouteDestination & operator=(RouteDestination &&other)=delete
 
AddrVector::iterator end()
Definition: destination.h:283
 
virtual void add(const mysql_harness::TCPAddress dest)
Adds a destination.
Definition: destination.cc:104
 
virtual void clear()
Removes all destinations.
Definition: destination.cc:143
 
size_t size() noexcept
Gets the number of destinations.
Definition: destination.cc:141
 
AddrVector::iterator begin()
Definition: destination.h:279
 
virtual mysql_harness::TCPAddress get(const std::string &address, uint16_t port)
Gets destination based on address and port.
Definition: destination.cc:131
 
virtual void start(const mysql_harness::PluginFuncEnv *env)
Start the destination threads (if any)
Definition: destination.cc:156
 
virtual mysqlrouter::ServerMode purpose() const
Definition: destination.h:296
 
PluginFuncEnv object.
Definition: loader.h:673
 
Defines an IP address with port number
Definition: tcp_address.h:40
 
Definition: io_context.h:61
 
std::vector< AvailableDestination > AllowedNodes
Definition: destination_status_types.h:62
 
Header for compiler-dependent features.
 
ServerMode
Definition: datatypes.h:50
 
RoutingStrategy
Routing strategies supported by Routing plugin.
Definition: routing.h:265
 
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
 
std::function< void()> StopSocketAcceptorCallback
Definition: destination.h:69
 
std::function< stdx::expected< void, std::string >()> StartSocketAcceptorCallback
Definition: destination.h:68
 
std::function< void(const AllowedNodes &, const AllowedNodes &, const bool, const std::string &)> AllowedNodesChangedCallback
Definition: destination.h:59
 
AllowedNodesChangeCallbacksList::iterator AllowedNodesChangeCallbacksListIterator
Definition: destination.h:65
 
std::list< AllowedNodesChangedCallback > AllowedNodesChangeCallbacksList
Definition: destination.h:63
 
std::function< void(const bool, const AllowedNodes &)> MetadataRefreshCallback
Definition: destination.h:74
 
std::function< bool(const mysql_harness::TCPAddress &)> QueryQuarantinedDestinationsCallback
Definition: destination.h:78