MySQL 9.1.0
Source Code Documentation
ConnectProcessor Class Reference

#include <classic_connect.h>

Inheritance diagram for ConnectProcessor:
[legend]

Public Types

enum class  Stage {
  InitDestination , Resolve , InitEndpoint , NextEndpoint ,
  NextDestination , InitConnect , FromPool , Connect ,
  ConnectFinish , Connected , Error , Done
}
 
using server_protocol_type = net::ip::tcp
 
- Public Types inherited from BasicProcessor
enum class  Result {
  Again , RecvFromClient , SendToClient , RecvFromServer ,
  RecvFromBoth , SendToServer , SendableToServer , Suspend ,
  Done , Void
}
 

Public Member Functions

 ConnectProcessor (MysqlRoutingClassicConnectionBase *conn, std::function< void(const classic_protocol::message::server::Error &err)> on_error, TraceEvent *parent_event)
 
stdx::expected< Processor::Result, std::error_code > process () override
 
void stage (Stage stage)
 
Stage stage () const
 
bool is_destination_good (const std::string &hostname, uint16_t port) const
 
- Public Member Functions inherited from Processor
 BasicProcessor (MysqlRoutingClassicConnectionBase *conn)
 
- Public Member Functions inherited from BasicProcessor
 BasicProcessor (MysqlRoutingClassicConnectionBase *conn)
 
virtual ~BasicProcessor ()=default
 
const MysqlRoutingClassicConnectionBaseconnection () const
 
MysqlRoutingClassicConnectionBaseconnection ()
 

Private Member Functions

stdx::expected< Processor::Result, std::error_code > init_destination ()
 
stdx::expected< Processor::Result, std::error_code > resolve ()
 
stdx::expected< Processor::Result, std::error_code > init_endpoint ()
 
stdx::expected< Processor::Result, std::error_code > next_endpoint ()
 
stdx::expected< Processor::Result, std::error_code > next_destination ()
 
stdx::expected< Processor::Result, std::error_code > init_connect ()
 
stdx::expected< Processor::Result, std::error_code > from_pool ()
 
stdx::expected< Processor::Result, std::error_code > connect ()
 
stdx::expected< Processor::Result, std::error_code > connect_finish ()
 
stdx::expected< Processor::Result, std::error_code > connected ()
 
stdx::expected< Processor::Result, std::error_code > error ()
 
void assign_server_side_connection_after_pool (ConnectionPool::ServerSideConnection server_conn)
 

Private Attributes

Stage stage_ {Stage::InitDestination}
 
net::io_contextio_ctx_
 
net::ip::tcp::resolver resolver_ {io_ctx_}
 
server_protocol_type::endpoint server_endpoint_
 
Destinationsdestinations_
 
Destinations::iterator destinations_it_
 
net::ip::tcp::resolver::results_type endpoints_
 
net::ip::tcp::resolver::results_type::iterator endpoints_it_
 
bool all_quarantined_ {false}
 
std::error_code destination_ec_
 
std::vector< std::pair< std::string, std::error_code > > connect_errors_
 
std::function< void(const classic_protocol::message::server::Error &err)> on_error_
 
std::chrono::steady_clock::time_point connect_started_
 
TraceEventparent_event_
 
TraceEventtrace_event_connect_ {nullptr}
 
TraceEventtrace_event_socket_connect_ {nullptr}
 
TraceEventtrace_event_socket_from_pool_ {nullptr}
 

Additional Inherited Members

- Protected Member Functions inherited from Processor
stdx::expected< Result, std::error_code > send_server_failed (std::error_code ec)
 
stdx::expected< Result, std::error_code > recv_server_failed (std::error_code ec)
 
stdx::expected< Result, std::error_code > send_client_failed (std::error_code ec)
 
stdx::expected< Result, std::error_code > recv_client_failed (std::error_code ec)
 
stdx::expected< Result, std::error_code > server_socket_failed (std::error_code ec)
 
stdx::expected< Result, std::error_code > client_socket_failed (std::error_code ec)
 
stdx::expected< void, std::error_code > discard_current_msg (Channel &src_channel, ClassicProtocolState &src_protocol)
 discard to current message. More...
 
template<class Proto >
stdx::expected< void, std::error_code > discard_current_msg (TlsSwitchableConnection< Proto > &conn)
 
void trace (Tracer::Event e)
 
Tracertracer ()
 
TraceEventtrace_span (TraceEvent *parent_span, const std::string_view &prefix)
 start a span. More...
 
void trace_span_end (TraceEvent *event, TraceEvent::StatusCode status_code=TraceEvent::StatusCode::kUnset)
 end a span and set a status-code. More...
 
TraceEventtrace_command (const std::string_view &prefix)
 start a command span. More...
 
TraceEventtrace_connect_and_forward_command (TraceEvent *parent_span)
 start a connect-and-forward span. More...
 
TraceEventtrace_connect (TraceEvent *parent_span)
 start a connect span. More...
 
void trace_set_connection_attributes (TraceEvent *ev)
 start a connect span. More...
 
TraceEventtrace_forward_command (TraceEvent *parent_span)
 start a forward span. More...
 
void trace_command_end (TraceEvent *event, TraceEvent::StatusCode status_code=TraceEvent::StatusCode::kUnset)
 end a command span and set a status-code. More...
 
- Static Protected Member Functions inherited from Processor
static void log_fatal_error_code (const char *msg, std::error_code ec)
 log a message with error-code as error. More...
 

Member Typedef Documentation

◆ server_protocol_type

Member Enumeration Documentation

◆ Stage

enum class ConnectProcessor::Stage
strong
Enumerator
InitDestination 
Resolve 
InitEndpoint 
NextEndpoint 
NextDestination 
InitConnect 
FromPool 
Connect 
ConnectFinish 
Connected 
Error 
Done 

Constructor & Destructor Documentation

◆ ConnectProcessor()

ConnectProcessor::ConnectProcessor ( MysqlRoutingClassicConnectionBase conn,
std::function< void(const classic_protocol::message::server::Error &err)>  on_error,
TraceEvent parent_event 
)
inline

Member Function Documentation

◆ assign_server_side_connection_after_pool()

void ConnectProcessor::assign_server_side_connection_after_pool ( ConnectionPool::ServerSideConnection  server_conn)
private

◆ connect()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::connect ( )
private

◆ connect_finish()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::connect_finish ( )
private

◆ connected()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::connected ( )
private

◆ error()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::error ( )
private

◆ from_pool()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::from_pool ( )
private

◆ init_connect()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::init_connect ( )
private

◆ init_destination()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::init_destination ( )
private

◆ init_endpoint()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::init_endpoint ( )
private

◆ is_destination_good()

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

◆ next_destination()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::next_destination ( )
private

◆ next_endpoint()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::next_endpoint ( )
private

◆ process()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::process ( )
overridevirtual

Implements BasicProcessor.

◆ resolve()

stdx::expected< Processor::Result, std::error_code > ConnectProcessor::resolve ( )
private

◆ stage() [1/2]

Stage ConnectProcessor::stage ( ) const
inline

◆ stage() [2/2]

void ConnectProcessor::stage ( Stage  stage)
inline

Member Data Documentation

◆ all_quarantined_

bool ConnectProcessor::all_quarantined_ {false}
private

◆ connect_errors_

std::vector<std::pair<std::string, std::error_code> > ConnectProcessor::connect_errors_
private

◆ connect_started_

std::chrono::steady_clock::time_point ConnectProcessor::connect_started_
private

◆ destination_ec_

std::error_code ConnectProcessor::destination_ec_
private

◆ destinations_

Destinations& ConnectProcessor::destinations_
private

◆ destinations_it_

Destinations::iterator ConnectProcessor::destinations_it_
private

◆ endpoints_

net::ip::tcp::resolver::results_type ConnectProcessor::endpoints_
private

◆ endpoints_it_

net::ip::tcp::resolver::results_type::iterator ConnectProcessor::endpoints_it_
private

◆ io_ctx_

net::io_context& ConnectProcessor::io_ctx_
private

◆ on_error_

std::function<void(const classic_protocol::message::server::Error &err)> ConnectProcessor::on_error_
private

◆ parent_event_

TraceEvent* ConnectProcessor::parent_event_
private

◆ resolver_

net::ip::tcp::resolver ConnectProcessor::resolver_ {io_ctx_}
private

◆ server_endpoint_

server_protocol_type::endpoint ConnectProcessor::server_endpoint_
private

◆ stage_

Stage ConnectProcessor::stage_ {Stage::InitDestination}
private

◆ trace_event_connect_

TraceEvent* ConnectProcessor::trace_event_connect_ {nullptr}
private

◆ trace_event_socket_connect_

TraceEvent* ConnectProcessor::trace_event_socket_connect_ {nullptr}
private

◆ trace_event_socket_from_pool_

TraceEvent* ConnectProcessor::trace_event_socket_from_pool_ {nullptr}
private

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