26#ifndef MYSQLROUTER_DESTINATION_INCLUDED
27#define MYSQLROUTER_DESTINATION_INCLUDED
33#include <system_error>
55 std::string
id()
const {
return id_; }
75 virtual bool good()
const {
return true; }
95 const std::string
id_;
111 using iterator =
typename container_type::iterator;
124 template <
class... Args>
126 return destinations_.emplace_back(std::forward<Args>(args)...);
Destination to forward client connections to.
Definition: destination.h:43
const std::string id_
Definition: destination.h:95
virtual ~Destination()=default
virtual void connect_status(std::error_code)
status of the last failed connect().
Definition: destination.h:83
Destination(std::string id, std::string hostname, uint16_t port)
Definition: destination.h:45
uint16_t port() const noexcept
TCP port to connect to.
Definition: destination.h:65
std::string hostname() const
hostname to connect to.
Definition: destination.h:60
const uint16_t port_
Definition: destination.h:97
virtual mysqlrouter::ServerMode server_mode() const
server-mode of the destination.
Definition: destination.h:90
std::string id() const
unique, opaque identifier of a destination.
Definition: destination.h:55
const std::string hostname_
Definition: destination.h:96
virtual bool good() const
check if the destination is "good".
Definition: destination.h:75
A forward iterable container of destinations.
Definition: destination.h:107
typename container_type::size_type size_type
Definition: destination.h:113
void clear()
clear all values.
Definition: destination.h:142
bool primary_already_used_
Definition: destination.h:182
bool is_primary_destination_
Definition: destination.h:183
container_type destinations_
Definition: destination.h:180
void set_is_primary_destination(const bool p)
Mark that the destinations are primary destinations.
Definition: destination.h:177
iterator begin()
Definition: destination.h:115
const_iterator begin() const
Definition: destination.h:116
size_type size() const
number of destinations.
Definition: destination.h:147
iterator end()
Definition: destination.h:117
const_iterator end() const
Definition: destination.h:118
typename container_type::const_iterator const_iterator
Definition: destination.h:112
void primary_already_used(const bool p)
Mark that the primary destinations are already used.
Definition: destination.h:162
bool empty() const
check if destination container is empty.
Definition: destination.h:137
bool primary_already_used() const
Check if we already used the primaries and don't want to fallback.
Definition: destination.h:155
bool is_primary_destination() const
Check if destinations are primary destinations.
Definition: destination.h:170
void push_back(value_type &&v)
Definition: destination.h:130
std::unique_ptr< Destination > value_type
Definition: destination.h:109
std::list< value_type > container_type
Definition: destination.h:110
typename container_type::iterator iterator
Definition: destination.h:111
auto emplace_back(Args &&... args)
emplace a Destination at the back of the container.
Definition: destination.h:125
const char * p
Definition: ctype-mb.cc:1225
ServerMode
Definition: datatypes.h:50
Definition: gcs_xcom_synode.h:64