MySQL 9.1.0
Source Code Documentation
ConnectorBase Class Reference

#include <connection.h>

Inheritance diagram for ConnectorBase:
[legend]

Public Types

enum class  Function { kInitDestination , kConnectFinish }
 
using server_protocol_type = net::ip::tcp
 

Public Member Functions

 ConnectorBase (net::io_context &io_ctx, RouteDestination *route_destination, Destinations &destinations)
 
server_protocol_type::socketsocket ()
 
server_protocol_type::endpointendpoint ()
 
net::steady_timertimer ()
 
void connect_timed_out (bool v)
 
bool connect_timed_out () const
 
void destination_id (std::string id)
 
std::string destination_id () const
 
void on_connect_failure (std::function< void(std::string, uint16_t, std::error_code)> func)
 
void on_connect_success (std::function< void(std::string, uint16_t)> func)
 
void on_is_destination_good (std::function< bool(std::string, uint16_t)> func)
 
bool is_destination_good (const std::string &hostname, uint16_t port) const
 

Protected Member Functions

stdx::expected< void, std::error_code > resolve ()
 
stdx::expected< void, std::error_code > init_destination ()
 
stdx::expected< void, std::error_code > init_endpoint ()
 
stdx::expected< void, std::error_code > next_endpoint ()
 
stdx::expected< void, std::error_code > next_destination ()
 
stdx::expected< void, std::error_code > connect_init ()
 
stdx::expected< void, std::error_code > try_connect ()
 
stdx::expected< void, std::error_code > connect_finish ()
 
stdx::expected< void, std::error_code > connected ()
 
stdx::expected< void, std::error_code > connect_failed (std::error_code ec)
 

Protected Attributes

net::io_contextio_ctx_
 
net::ip::tcp::resolver resolver_ {io_ctx_}
 
server_protocol_type::socket server_sock_ {io_ctx_}
 
server_protocol_type::endpoint server_endpoint_
 
RouteDestinationroute_destination_
 
Destinationsdestinations_
 
Destinations::iterator destinations_it_
 
net::ip::tcp::resolver::results_type endpoints_
 
net::ip::tcp::resolver::results_type::iterator endpoints_it_
 
std::error_code last_ec_ {make_error_code(DestinationsErrc::kNotSet)}
 
Function func_ {Function::kInitDestination}
 
net::steady_timer connect_timer_ {io_ctx_}
 
bool connect_timed_out_ {false}
 
std::string destination_id_
 
std::function< void(std::string, uint16_t, std::error_code)> on_connect_failure_
 
std::function< void(std::string, uint16_t)> on_connect_success_
 
std::function< bool(std::string, uint16_t)> on_is_destination_good_
 

Member Typedef Documentation

◆ server_protocol_type

Member Enumeration Documentation

◆ Function

enum class ConnectorBase::Function
strong
Enumerator
kInitDestination 
kConnectFinish 

Constructor & Destructor Documentation

◆ ConnectorBase()

ConnectorBase::ConnectorBase ( net::io_context io_ctx,
RouteDestination route_destination,
Destinations destinations 
)
inline

Member Function Documentation

◆ connect_failed()

stdx::expected< void, std::error_code > ConnectorBase::connect_failed ( std::error_code  ec)
protected

◆ connect_finish()

stdx::expected< void, std::error_code > ConnectorBase::connect_finish ( )
protected

◆ connect_init()

stdx::expected< void, std::error_code > ConnectorBase::connect_init ( )
protected

◆ connect_timed_out() [1/2]

bool ConnectorBase::connect_timed_out ( ) const
inline

◆ connect_timed_out() [2/2]

void ConnectorBase::connect_timed_out ( bool  v)
inline

◆ connected()

stdx::expected< void, std::error_code > ConnectorBase::connected ( )
protected

◆ destination_id() [1/2]

std::string ConnectorBase::destination_id ( ) const
inline

◆ destination_id() [2/2]

void ConnectorBase::destination_id ( std::string  id)
inline

◆ endpoint()

server_protocol_type::endpoint & ConnectorBase::endpoint ( )
inline

◆ init_destination()

stdx::expected< void, std::error_code > ConnectorBase::init_destination ( )
protected

◆ init_endpoint()

stdx::expected< void, std::error_code > ConnectorBase::init_endpoint ( )
protected

◆ is_destination_good()

bool ConnectorBase::is_destination_good ( const std::string &  hostname,
uint16_t  port 
) const
inline

◆ next_destination()

stdx::expected< void, std::error_code > ConnectorBase::next_destination ( )
protected

◆ next_endpoint()

stdx::expected< void, std::error_code > ConnectorBase::next_endpoint ( )
protected

◆ on_connect_failure()

void ConnectorBase::on_connect_failure ( std::function< void(std::string, uint16_t, std::error_code)>  func)
inline

◆ on_connect_success()

void ConnectorBase::on_connect_success ( std::function< void(std::string, uint16_t)>  func)
inline

◆ on_is_destination_good()

void ConnectorBase::on_is_destination_good ( std::function< bool(std::string, uint16_t)>  func)
inline

◆ resolve()

stdx::expected< void, std::error_code > ConnectorBase::resolve ( )
protected

◆ socket()

server_protocol_type::socket & ConnectorBase::socket ( )
inline

◆ timer()

net::steady_timer & ConnectorBase::timer ( )
inline

◆ try_connect()

stdx::expected< void, std::error_code > ConnectorBase::try_connect ( )
protected

Member Data Documentation

◆ connect_timed_out_

bool ConnectorBase::connect_timed_out_ {false}
protected

◆ connect_timer_

net::steady_timer ConnectorBase::connect_timer_ {io_ctx_}
protected

◆ destination_id_

std::string ConnectorBase::destination_id_
protected

◆ destinations_

Destinations& ConnectorBase::destinations_
protected

◆ destinations_it_

Destinations::iterator ConnectorBase::destinations_it_
protected

◆ endpoints_

net::ip::tcp::resolver::results_type ConnectorBase::endpoints_
protected

◆ endpoints_it_

net::ip::tcp::resolver::results_type::iterator ConnectorBase::endpoints_it_
protected

◆ func_

Function ConnectorBase::func_ {Function::kInitDestination}
protected

◆ io_ctx_

net::io_context& ConnectorBase::io_ctx_
protected

◆ last_ec_

std::error_code ConnectorBase::last_ec_ {make_error_code(DestinationsErrc::kNotSet)}
protected

◆ on_connect_failure_

std::function<void(std::string, uint16_t, std::error_code)> ConnectorBase::on_connect_failure_
protected

◆ on_connect_success_

std::function<void(std::string, uint16_t)> ConnectorBase::on_connect_success_
protected

◆ on_is_destination_good_

std::function<bool(std::string, uint16_t)> ConnectorBase::on_is_destination_good_
protected

◆ resolver_

net::ip::tcp::resolver ConnectorBase::resolver_ {io_ctx_}
protected

◆ route_destination_

RouteDestination* ConnectorBase::route_destination_
protected

◆ server_endpoint_

server_protocol_type::endpoint ConnectorBase::server_endpoint_
protected

◆ server_sock_

server_protocol_type::socket ConnectorBase::server_sock_ {io_ctx_}
protected

The documentation for this class was generated from the following files: