MySQL 8.0.40
Source Code Documentation
Network_provider Class Referenceabstract

Base class for External Network Providers. More...

#include <network_provider.h>

Inheritance diagram for Network_provider:
[legend]

Public Member Functions

 Network_provider ()
 
 Network_provider (Network_provider &&param)
 
Network_provideroperator= (Network_provider &param)=delete
 
 Network_provider (Network_provider &param)=delete
 
virtual ~Network_provider ()
 
virtual std::pair< bool, int > start ()=0
 Starts the network provider. More...
 
virtual std::pair< bool, int > stop ()=0
 Stops the network provider. More...
 
virtual enum_transport_protocol get_communication_stack () const =0
 Get the communication stack implemented by this provider. More...
 
virtual bool configure (const Network_configuration_parameters &params)=0
 Configures a network provider. More...
 
virtual bool configure_secure_connections (const Network_configuration_parameters &params)=0
 Configures the active provider with all things needed to establish SSL connections. More...
 
virtual void cleanup_secure_connections_context ()=0
 
virtual std::function< void()> get_secure_connections_context_cleaner ()
 
virtual bool finalize_secure_connections_context ()=0
 
virtual std::unique_ptr< Network_connectionopen_connection (const std::string &address, const unsigned short port, const Network_security_credentials &security_credentials, int connection_timeout=default_connection_timeout(), network_provider_dynamic_log_level log_level=network_provider_dynamic_log_level::PROVIDED)=0
 Opens a new connection to another XCom endpoint served by the same Network provider. More...
 
virtual int close_connection (const Network_connection &connection)=0
 Closes an open connection to another XCom endpoint served by the same Network provider. More...
 
void set_new_connection (Network_connection *connection)
 Lock-free Set connection. More...
 
Network_connectionget_new_connection ()
 Get the new connection object. More...
 
void reset_new_connection ()
 

Static Public Member Functions

static constexpr int default_connection_timeout ()
 

Private Attributes

std::atomic< Network_connection * > m_shared_connection
 

Detailed Description

Base class for External Network Providers.

This virtual class will serve as base class for any external entity that whishes to provide network connections to XCom.

It will have to implement the following methods:

  • start();
  • stop();
  • get_ĩd();
  • configure();
  • open_connection();
  • close_connection();

If provides a lock free implementation of (set)(get)_connection() for multithreaded usage.

Constructor & Destructor Documentation

◆ Network_provider() [1/3]

Network_provider::Network_provider ( )
inline

◆ Network_provider() [2/3]

Network_provider::Network_provider ( Network_provider &&  param)
inline

◆ Network_provider() [3/3]

Network_provider::Network_provider ( Network_provider param)
delete

◆ ~Network_provider()

virtual Network_provider::~Network_provider ( )
inlinevirtual

Member Function Documentation

◆ cleanup_secure_connections_context()

virtual void Network_provider::cleanup_secure_connections_context ( )
pure virtual

◆ close_connection()

virtual int Network_provider::close_connection ( const Network_connection connection)
pure virtual

Closes an open connection to another XCom endpoint served by the same Network provider.

Parameters
connectionan open and valid connection
Returns
int an error code in case of error. 0, otherwise.

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

◆ configure()

virtual bool Network_provider::configure ( const Network_configuration_parameters params)
pure virtual

Configures a network provider.

Parameters
paramsa sensible list of possibly configurable network parameters
Returns
true in case of a successful configuration.
false in case of a unsuccessful configuration.

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

◆ configure_secure_connections()

virtual bool Network_provider::configure_secure_connections ( const Network_configuration_parameters params)
pure virtual

Configures the active provider with all things needed to establish SSL connections.

Parameters
paramsconfiguration parameters for SSL.
Returns
true In case of success.
false In case of failure.

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

◆ default_connection_timeout()

static constexpr int Network_provider::default_connection_timeout ( )
inlinestaticconstexpr

◆ finalize_secure_connections_context()

virtual bool Network_provider::finalize_secure_connections_context ( )
pure virtual

◆ get_communication_stack()

virtual enum_transport_protocol Network_provider::get_communication_stack ( ) const
pure virtual

Get the communication stack implemented by this provider.

Return a valid value withint the range of RunningProtocol enum.

Returns
RunningProtocol valid value

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

◆ get_new_connection()

Network_connection * Network_provider::get_new_connection ( )
inline

Get the new connection object.

Returns
Network_connection* a new connection coming from this network provider

◆ get_secure_connections_context_cleaner()

virtual std::function< void()> Network_provider::get_secure_connections_context_cleaner ( )
inlinevirtual

◆ open_connection()

virtual std::unique_ptr< Network_connection > Network_provider::open_connection ( const std::string &  address,
const unsigned short  port,
const Network_security_credentials security_credentials,
int  connection_timeout = default_connection_timeout(),
network_provider_dynamic_log_level  log_level = network_provider_dynamic_log_level::PROVIDED 
)
pure virtual

Opens a new connection to another XCom endpoint served by the same Network provider.

Parameters
addressaddress of the remote endpoint
portport of the remote endpoint
security_credentialssecurity credentials to connect to the remote endpoint
connection_timeoutconnection timeout
log_levellog level
See also
network_provider_dynamic_log_level for more information
Returns
std::unique_ptr<Network_connection> an established connection. nullptr in case of failure.

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

◆ operator=()

Network_provider & Network_provider::operator= ( Network_provider param)
delete

◆ reset_new_connection()

void Network_provider::reset_new_connection ( )
inline

◆ set_new_connection()

void Network_provider::set_new_connection ( Network_connection connection)
inline

Lock-free Set connection.

Sets a new connection received by this provider. It will be consumed internally by get_new_connection().

Parameters
connectiona newly created connection.

◆ start()

virtual std::pair< bool, int > Network_provider::start ( )
pure virtual

Starts the network provider.

Each implementation will place here any code that it needs to start a network provider.

start() is synchronous. After start() succeeded, it is assumed that XCom is ready to receive new connections.

Returns
a pair of <bool,int> bool indicates the success of the operation. false means success. int returns an error code.

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

◆ stop()

virtual std::pair< bool, int > Network_provider::stop ( )
pure virtual

Stops the network provider.

Each implementation will place here any code that it needs to stop a network provider.

stop() is synchronous. After stop() succeeded, it is assumed that XCom shall not receive any new connection.

Returns
a pair of <bool,int> bool indicates the success of the operation. false means success. int returns an error code.

Implemented in Gcs_mysql_network_provider, and Xcom_network_provider.

Member Data Documentation

◆ m_shared_connection

std::atomic<Network_connection *> Network_provider::m_shared_connection
private

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