26#ifndef MYSQLROUTER_DESTINATION_INCLUDED
27#define MYSQLROUTER_DESTINATION_INCLUDED
33#include <system_error>
54 std::string
id()
const {
return id_; }
74 virtual bool good()
const {
return true; }
85 const std::string
id_;
101 using iterator =
typename container_type::iterator;
113 template <
class... Args>
115 return destinations_.emplace_back(std::forward<Args>(args)...);
Destination to forward client connections to.
Definition: destination.h:42
const std::string id_
Definition: destination.h:85
virtual ~Destination()=default
virtual void connect_status(std::error_code)
status of the last failed connect().
Definition: destination.h:82
Destination(std::string id, std::string hostname, uint16_t port)
Definition: destination.h:44
uint16_t port() const noexcept
TCP port to connect to.
Definition: destination.h:64
std::string hostname() const
hostname to connect to.
Definition: destination.h:59
const uint16_t port_
Definition: destination.h:87
std::string id() const
unique, opaque identifier of a destination.
Definition: destination.h:54
const std::string hostname_
Definition: destination.h:86
virtual bool good() const
check if the destination is "good".
Definition: destination.h:74
A forward iterable container of destinations.
Definition: destination.h:97
typename container_type::size_type size_type
Definition: destination.h:103
void clear()
clear all values.
Definition: destination.h:130
bool primary_already_used_
Definition: destination.h:170
bool is_primary_destination_
Definition: destination.h:171
container_type destinations_
Definition: destination.h:168
void set_is_primary_destination(const bool p)
Mark that the destinations are primary destinations.
Definition: destination.h:165
iterator begin()
Definition: destination.h:105
const_iterator begin() const
Definition: destination.h:106
size_type size() const
number of destinations.
Definition: destination.h:135
iterator end()
Definition: destination.h:107
const_iterator end() const
Definition: destination.h:108
typename container_type::const_iterator const_iterator
Definition: destination.h:102
void primary_already_used(const bool p)
Mark that the primary destinations are already used.
Definition: destination.h:150
bool empty() const
check if destination container is empty.
Definition: destination.h:125
auto emplace_back(Args &&...args)
emplace a Destination at the back of the container.
Definition: destination.h:114
bool primary_already_used() const
Check if we already used the primaries and don't want to fallback.
Definition: destination.h:143
bool is_primary_destination() const
Check if destinations are primary destinations.
Definition: destination.h:158
void push_back(value_type &&v)
Definition: destination.h:118
std::unique_ptr< Destination > value_type
Definition: destination.h:99
std::list< value_type > container_type
Definition: destination.h:100
typename container_type::iterator iterator
Definition: destination.h:101
const char * p
Definition: ctype-mb.cc:1237
Definition: gcs_xcom_synode.h:64