MySQL 8.0.39
Source Code Documentation
server_mock::MySQLServerMock Class Reference

Main class. More...

#include <mysql_server_mock.h>

Public Member Functions

 MySQLServerMock (net::io_context &io_ctx, std::string expected_queries_file, std::vector< std::string > module_prefixes, std::string bind_address, unsigned bind_port, std::string protocol, bool debug_mode, TlsServerContext &&tls_server_ctx, mysql_ssl_mode ssl_mode)
 Constructor. More...
 
void run (mysql_harness::PluginFuncEnv *env)
 Starts handling the clients connections in infinite loop. More...
 
void close_all_connections ()
 close all open connections. More...
 

Private Attributes

std::string bind_address_
 
unsigned bind_port_
 
bool debug_mode_
 
net::io_contextio_ctx_
 
std::string expected_queries_file_
 
std::vector< std::string > module_prefixes_
 
std::string protocol_name_
 
TlsServerContext tls_server_ctx_
 
mysql_ssl_mode ssl_mode_
 
WaitableMonitor< std::list< std::unique_ptr< MySQLServerMockSession > > > client_sessions_ {{}}
 

Detailed Description

Main class.

Responsible for accepting and handling client's connections.

Constructor & Destructor Documentation

◆ MySQLServerMock()

server_mock::MySQLServerMock::MySQLServerMock ( net::io_context io_ctx,
std::string  expected_queries_file,
std::vector< std::string >  module_prefixes,
std::string  bind_address,
unsigned  bind_port,
std::string  protocol,
bool  debug_mode,
TlsServerContext &&  tls_server_ctx,
mysql_ssl_mode  ssl_mode 
)

Constructor.

Parameters
io_ctxIO context for network operations
expected_queries_filePath to the json file with definitins of the expected SQL statements and responses
module_prefixesprefixes of javascript modules used by the nodejs compatible module-loader
bind_addressAddress on which the server accepts client connections
bind_portNumber of the port on which the server accepts clients connections
protocolthe protocol this mock instance speaks: "x" or "classic"
debug_modeFlag indicating if the handled queries should be printed to the standard output
tls_server_ctxTLS Server Context
ssl_modeSSL mode

Member Function Documentation

◆ close_all_connections()

void server_mock::MySQLServerMock::close_all_connections ( )

close all open connections.

can be called from other threads.

◆ run()

void server_mock::MySQLServerMock::run ( mysql_harness::PluginFuncEnv env)

Starts handling the clients connections in infinite loop.

Will return only in case of an exception (error).

Member Data Documentation

◆ bind_address_

std::string server_mock::MySQLServerMock::bind_address_
private

◆ bind_port_

unsigned server_mock::MySQLServerMock::bind_port_
private

◆ client_sessions_

WaitableMonitor<std::list<std::unique_ptr<MySQLServerMockSession> > > server_mock::MySQLServerMock::client_sessions_ {{}}
private

◆ debug_mode_

bool server_mock::MySQLServerMock::debug_mode_
private

◆ expected_queries_file_

std::string server_mock::MySQLServerMock::expected_queries_file_
private

◆ io_ctx_

net::io_context& server_mock::MySQLServerMock::io_ctx_
private

◆ module_prefixes_

std::vector<std::string> server_mock::MySQLServerMock::module_prefixes_
private

◆ protocol_name_

std::string server_mock::MySQLServerMock::protocol_name_
private

◆ ssl_mode_

mysql_ssl_mode server_mock::MySQLServerMock::ssl_mode_
private

◆ tls_server_ctx_

TlsServerContext server_mock::MySQLServerMock::tls_server_ctx_
private

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