MySQL 8.0.40
Source Code Documentation
LazyConnector Class Reference

attach a server connection and initialize it. More...

#include <classic_lazy_connect.h>

Inheritance diagram for LazyConnector:
[legend]

Public Types

enum class  Stage {
  Connect , Connected , Authenticated , SetVars ,
  SetVarsDone , SetServerOption , SetServerOptionDone , SetSchema ,
  SetSchemaDone , FetchSysVars , FetchSysVarsDone , Done
}
 
- Public Types inherited from BasicProcessor
enum class  Result {
  Again , RecvFromClient , SendToClient , RecvFromServer ,
  RecvFromBoth , SendToServer , SendableToServer , Suspend ,
  Done , Void
}
 

Public Member Functions

 LazyConnector (MysqlRoutingClassicConnectionBase *conn, bool in_handshake, std::function< void(const classic_protocol::message::server::Error &err)> on_error)
 create a lazy-connector. More...
 
stdx::expected< Processor::Result, std::error_code > process () override
 
void stage (Stage stage)
 
Stage stage () 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 > connect ()
 
stdx::expected< Processor::Result, std::error_code > connected ()
 the handshake part. More...
 
stdx::expected< Processor::Result, std::error_code > authenticated ()
 
stdx::expected< Processor::Result, std::error_code > set_vars ()
 
stdx::expected< Processor::Result, std::error_code > set_vars_done ()
 
stdx::expected< Processor::Result, std::error_code > set_server_option ()
 
stdx::expected< Processor::Result, std::error_code > set_server_option_done ()
 
stdx::expected< Processor::Result, std::error_code > set_schema ()
 
stdx::expected< Processor::Result, std::error_code > set_schema_done ()
 
stdx::expected< Processor::Result, std::error_code > fetch_sys_vars ()
 
stdx::expected< Processor::Result, std::error_code > fetch_sys_vars_done ()
 

Private Attributes

Stage stage_ {Stage::Connect}
 
bool in_handshake_
 
std::function< void(const classic_protocol::message::server::Error &err)> on_error_
 

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...
 
void trace (Tracer::Event e)
 
Tracertracer ()
 
- 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...
 

Detailed Description

attach a server connection and initialize it.

  • if a server-connection is attached to the client connection, leave.
  • otherwise,
    • if a connection can be taken from the pool, take it.
    • otherwise, connect to the server and authenticate.
  • set tracking session-vars
  • set the client's schema, if it differs from the server-connection's.

Precondition:

  • the client's cleartext password must be known.

Member Enumeration Documentation

◆ Stage

enum class LazyConnector::Stage
strong
Enumerator
Connect 
Connected 
Authenticated 
SetVars 
SetVarsDone 
SetServerOption 
SetServerOptionDone 
SetSchema 
SetSchemaDone 
FetchSysVars 
FetchSysVarsDone 
Done 

Constructor & Destructor Documentation

◆ LazyConnector()

LazyConnector::LazyConnector ( MysqlRoutingClassicConnectionBase conn,
bool  in_handshake,
std::function< void(const classic_protocol::message::server::Error &err)>  on_error 
)
inline

create a lazy-connector.

Parameters
conna connection handle
in_handshakeif true, the client connection is in Greeting or ChangeUser right now.
on_errorfunction that's called if an error happened.

If "in_handshake" the LazyConnector may ask the client for a "auth-method-switch" or a "plaintext-password".

Member Function Documentation

◆ authenticated()

stdx::expected< Processor::Result, std::error_code > LazyConnector::authenticated ( )
private

◆ connect()

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

◆ connected()

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

the handshake part.

◆ fetch_sys_vars()

stdx::expected< Processor::Result, std::error_code > LazyConnector::fetch_sys_vars ( )
private

◆ fetch_sys_vars_done()

stdx::expected< Processor::Result, std::error_code > LazyConnector::fetch_sys_vars_done ( )
private

◆ process()

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

Implements BasicProcessor.

◆ set_schema()

stdx::expected< Processor::Result, std::error_code > LazyConnector::set_schema ( )
private

◆ set_schema_done()

stdx::expected< Processor::Result, std::error_code > LazyConnector::set_schema_done ( )
private

◆ set_server_option()

stdx::expected< Processor::Result, std::error_code > LazyConnector::set_server_option ( )
private

◆ set_server_option_done()

stdx::expected< Processor::Result, std::error_code > LazyConnector::set_server_option_done ( )
private

◆ set_vars()

stdx::expected< Processor::Result, std::error_code > LazyConnector::set_vars ( )
private

◆ set_vars_done()

stdx::expected< Processor::Result, std::error_code > LazyConnector::set_vars_done ( )
private

◆ stage() [1/2]

Stage LazyConnector::stage ( ) const
inline

◆ stage() [2/2]

void LazyConnector::stage ( Stage  stage)
inline

Member Data Documentation

◆ in_handshake_

bool LazyConnector::in_handshake_
private

◆ on_error_

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

◆ stage_

Stage LazyConnector::stage_ {Stage::Connect}
private

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