MySQL 9.1.0
Source Code Documentation
Gcs_xcom_interface Class Reference

Implementation of the Gcs_interface for the XCom binding. More...

#include <gcs_xcom_interface.h>

Inheritance diagram for Gcs_xcom_interface:
[legend]

Public Member Functions

 ~Gcs_xcom_interface () override
 
enum_gcs_error initialize (const Gcs_interface_parameters &interface_params) override
 This block implements the virtual methods defined in Gcs_interface. More...
 
enum_gcs_error configure (const Gcs_interface_parameters &interface_params) override
 Method used by a binding implementation in order to implement any type of necessary dynamic reconfiguration. More...
 
bool is_initialized () override
 Method used to report if the binding interface has already been initialized. More...
 
enum_gcs_error finalize () override
 Method used by a binding implementation in order to implement any internal shutdown procedure. More...
 
Gcs_control_interfaceget_control_session (const Gcs_group_identifier &group_identifier) override
 Method that retrieves the binding implementation of the Control Session interface. More...
 
Gcs_communication_interfaceget_communication_session (const Gcs_group_identifier &group_identifier) override
 Method that retrieves the binding implementation of the Communication Session interface. More...
 
Gcs_statistics_interfaceget_statistics (const Gcs_group_identifier &group_identifier) override
 Method that retrieves the binding implementation of the Statistics interface. More...
 
Gcs_group_management_interfaceget_management_session (const Gcs_group_identifier &group_identifier) override
 Method that retrieves the binding implementation of the Group Management Session interface. More...
 
enum_gcs_error configure_message_stages (const Gcs_group_identifier &gid)
 
enum_gcs_error configure_suspicions_mgr (Gcs_interface_parameters &p, Gcs_suspicions_manager *mgr)
 
enum_gcs_error set_logger (Logger_interface *logger) override
 Method that retrieves the binding implementation of the Group Management Session interface. More...
 
void set_xcom_group_information (const std::string &group_id)
 
Gcs_group_identifierget_xcom_group_information (const u_long group_id)
 
Gcs_xcom_node_addressget_node_address ()
 
void set_node_address (std::string const &address)
 
enum_gcs_error setup_runtime_resources (Gcs_interface_runtime_requirements &reqs) override
 
enum_gcs_error cleanup_runtime_resources (Gcs_interface_runtime_requirements &reqs) override
 
const Gcs_interface_parametersget_initialization_parameters ()
 This member function shall return the set of parameters that configure the interface at the time its initialization was done. More...
 
Gcs_ip_allowlistget_ip_allowlist ()
 Must return the allowlist. More...
 
void process_xcom_exit ()
 
void finalize_xcom ()
 Contains all the code needed to stop the xcom daemon if it was not already stopped as it should have been done. More...
 
void make_gcs_leave_group_on_error ()
 Makes GCS leave the group when an error has caused XCom to terminate unexpectedly. More...
 
void initialize_ssl ()
 Used to initialize SSL assuming that the necessary parameters have already been read. More...
 
bool set_xcom_identity (Gcs_xcom_node_information const &node_information, Gcs_xcom_proxy &xcom_proxy)
 Used to initialize the unique identifier of the XCom instance. More...
 
- Public Member Functions inherited from Gcs_interface
virtual ~Gcs_interface ()=default
 

Static Public Member Functions

static Gcs_interfaceget_interface ()
 Since one wants that a single instance exists, the interface implementation shall be retrieved via a Singleton pattern. More...
 
static void cleanup ()
 Public method that finalizes and cleans the singleton. More...
 
static void cleanup_thread_ssl_resources ()
 Public method that cleans thread-local resources related to communication. More...
 

Private Member Functions

 Gcs_xcom_interface ()
 XCom binding private constructor. More...
 
enum_gcs_error initialize_logging (const std::string *debug_file, const std::string *debug_path)
 Method to initialize the logging and debugging systems. More...
 
enum_gcs_error finalize_logging ()
 Method to finalize the logging and debugging systems. More...
 
gcs_xcom_group_interfacesget_group_interfaces (const Gcs_group_identifier &group_identifier)
 Internal helper method that retrieves all group interfaces for a certain group. More...
 
bool initialize_xcom (const Gcs_interface_parameters &interface_params)
 Contains all the code needed to initialize a connection to the xcom daemon. More...
 
void clean_group_interfaces ()
 Internal helper method to delete all previously created group interfaces. More...
 
void clean_group_references ()
 Internal helper method to delete all previously created group references. More...
 
void initialize_peer_nodes (const std::string *peer_nodes)
 Helper used to parse the peer_nodes parameter and to initialize XCom peer nodes. More...
 
void clear_peer_nodes ()
 Helper used to delete the existing XCom peer nodes in m_xcom_peers and to clear that vector. More...
 
void announce_finalize_to_view_control ()
 Announces that a finalize was called to all group instances that use a Gcs_xcom_view_change_control_interface. More...
 
 Gcs_xcom_interface (Gcs_xcom_interface const &)
 
Gcs_xcom_interfaceoperator= (Gcs_xcom_interface const &)
 

Private Attributes

std::map< std::string, gcs_xcom_group_interfaces * > m_group_interfaces
 
std::map< u_long, Gcs_group_identifier * > m_xcom_configured_groups
 
Gcs_xcom_node_addressm_node_address
 
std::vector< Gcs_xcom_node_address * > m_xcom_peers
 
bool m_is_initialized
 
bool m_boot
 
My_xp_socket_utilm_socket_util
 
Gcs_xcom_app_cfg m_gcs_xcom_app_cfg
 The C++ interface to setup and configure xcom properties from GCS. More...
 
Gcs_interface_parameters m_initialization_parameters
 The initialization parameters provided through the initialize member function. More...
 
Gcs_async_bufferm_default_sink
 
Logger_interfacem_default_logger
 
Gcs_default_debuggerm_default_debugger
 
Gcs_ip_allowlist m_ip_allowlist
 The IP allowlist. More...
 
int m_ssl_init_state
 Indicates whether SSL has been initialized and if that initialization was successful. More...
 
My_xp_cond_impl m_wait_for_ssl_init_cond
 protects the m_ssl_init_state thread shared variable More...
 
My_xp_mutex_impl m_wait_for_ssl_init_mutex
 
Network_namespace_managerm_netns_manager
 Network namespace service provider. More...
 
Gcs_xcom_statistics_manager_interfacem_stats_mgr
 Interface for statistic storage. More...
 
Gcs_xcom_statistics_storage_implm_xcom_stats_storage
 Interface for XCom statistic storage. More...
 

Static Private Attributes

static Gcs_interfaceinterface_reference_singleton = nullptr
 

Detailed Description

Implementation of the Gcs_interface for the XCom binding.

Constructor & Destructor Documentation

◆ Gcs_xcom_interface() [1/2]

Gcs_xcom_interface::Gcs_xcom_interface ( )
explicitprivate

XCom binding private constructor.

◆ ~Gcs_xcom_interface()

Gcs_xcom_interface::~Gcs_xcom_interface ( )
overridedefault

◆ Gcs_xcom_interface() [2/2]

Gcs_xcom_interface::Gcs_xcom_interface ( Gcs_xcom_interface const &  )
private

Member Function Documentation

◆ announce_finalize_to_view_control()

void Gcs_xcom_interface::announce_finalize_to_view_control ( )
private

Announces that a finalize was called to all group instances that use a Gcs_xcom_view_change_control_interface.

The purpose of this is to end any ongoing tasks, like pending joins.

◆ clean_group_interfaces()

void Gcs_xcom_interface::clean_group_interfaces ( )
private

Internal helper method to delete all previously created group interfaces.

◆ clean_group_references()

void Gcs_xcom_interface::clean_group_references ( )
private

Internal helper method to delete all previously created group references.

◆ cleanup()

void Gcs_xcom_interface::cleanup ( )
static

Public method that finalizes and cleans the singleton.

◆ cleanup_runtime_resources()

enum_gcs_error Gcs_xcom_interface::cleanup_runtime_resources ( Gcs_interface_runtime_requirements reqs)
overridevirtual
See also
Gcs_interface::cleanup_runtime_resources

Implements Gcs_interface.

◆ cleanup_thread_ssl_resources()

void Gcs_xcom_interface::cleanup_thread_ssl_resources ( )
static

Public method that cleans thread-local resources related to communication.

Required when SSL is provided by OpenSSL.

◆ clear_peer_nodes()

void Gcs_xcom_interface::clear_peer_nodes ( )
private

Helper used to delete the existing XCom peer nodes in m_xcom_peers and to clear that vector.

◆ configure()

enum_gcs_error Gcs_xcom_interface::configure ( const Gcs_interface_parameters interface_params)
overridevirtual

Method used by a binding implementation in order to implement any type of necessary dynamic reconfiguration.

An example of this could be an underlying GCS that needs to adjust itself to changes in a group. Note, however, that the method must be only used when the system is not running in order to avoid possible concurrency issues. Using cached information by the caller, after this member function has been called, results in undefined behavior.

Return values
GCS_OKin case of everything goes well. Any other value of gcs_error in case of error.

Implements Gcs_interface.

◆ configure_message_stages()

enum_gcs_error Gcs_xcom_interface::configure_message_stages ( const Gcs_group_identifier gid)

◆ configure_suspicions_mgr()

enum_gcs_error Gcs_xcom_interface::configure_suspicions_mgr ( Gcs_interface_parameters p,
Gcs_suspicions_manager mgr 
)

◆ finalize()

enum_gcs_error Gcs_xcom_interface::finalize ( )
overridevirtual

Method used by a binding implementation in order to implement any internal shutdown procedure.

Return values
GCS_OKin case of everything goes well. Any other value of gcs_error in case of error

Implements Gcs_interface.

◆ finalize_logging()

enum_gcs_error Gcs_xcom_interface::finalize_logging ( )
private

Method to finalize the logging and debugging systems.

If something bad happens, an error is returned.

◆ finalize_xcom()

void Gcs_xcom_interface::finalize_xcom ( )

Contains all the code needed to stop the xcom daemon if it was not already stopped as it should have been done.

◆ get_communication_session()

Gcs_communication_interface * Gcs_xcom_interface::get_communication_session ( const Gcs_group_identifier group_identifier)
overridevirtual

Method that retrieves the binding implementation of the Communication Session interface.

Parameters
[in]group_identifierthe group in which this implementation pertains
Returns
A valid reference to a gcs_communication_interface implementation. NULL, in case of error.

Implements Gcs_interface.

◆ get_control_session()

Gcs_control_interface * Gcs_xcom_interface::get_control_session ( const Gcs_group_identifier group_identifier)
overridevirtual

Method that retrieves the binding implementation of the Control Session interface.

Parameters
[in]group_identifierthe group in which this implementation pertains
Returns
A valid reference to a gcs_control_interface implementation, NULL, in case of error.

Implements Gcs_interface.

◆ get_group_interfaces()

gcs_xcom_group_interfaces * Gcs_xcom_interface::get_group_interfaces ( const Gcs_group_identifier group_identifier)
private

Internal helper method that retrieves all group interfaces for a certain group.

Note
Since the group interfaces work as a singleton, meaning that a group has a single set of interfaces built, this method will also implement the behavior to build and initialize the interfaces implementation.
Parameters
[in]group_identifierthe group in which one wants to instantiate the interface implementation
Returns
a reference to a struct gcs_xcom_group_interfaces

◆ get_initialization_parameters()

const Gcs_interface_parameters & Gcs_xcom_interface::get_initialization_parameters ( )
inline

This member function shall return the set of parameters that configure the interface at the time its initialization was done.

The parameters returned already contain default values set as well as values that may have been fixed.

Returns
The parameters configured at the time the interface was initialized.

◆ get_interface()

Gcs_interface * Gcs_xcom_interface::get_interface ( )
static

Since one wants that a single instance exists, the interface implementation shall be retrieved via a Singleton pattern.

This is the public method that allows the retrieving of the single instance.

Returns
a reference to the Singleton instance

◆ get_ip_allowlist()

Gcs_ip_allowlist & Gcs_xcom_interface::get_ip_allowlist ( )

Must return the allowlist.

Returns
the list of allowlisted IP addresses and subnet masks.

◆ get_management_session()

Gcs_group_management_interface * Gcs_xcom_interface::get_management_session ( const Gcs_group_identifier group_identifier)
overridevirtual

Method that retrieves the binding implementation of the Group Management Session interface.

Parameters
[in]group_identifierthe group in which this implementation pertains
Returns
A valid reference to a Gcs_group_management_interface implementation, NULL, in case of error.

Implements Gcs_interface.

◆ get_node_address()

Gcs_xcom_node_address * Gcs_xcom_interface::get_node_address ( )

◆ get_statistics()

Gcs_statistics_interface * Gcs_xcom_interface::get_statistics ( const Gcs_group_identifier group_identifier)
overridevirtual

Method that retrieves the binding implementation of the Statistics interface.

Parameters
[in]group_identifierthe group in which this implementation pertains
Returns
A valid reference to a gcs_statistics_interface implementation. NULL, in case of error.

Implements Gcs_interface.

◆ get_xcom_group_information()

Gcs_group_identifier * Gcs_xcom_interface::get_xcom_group_information ( const u_long  group_id)

◆ initialize()

enum_gcs_error Gcs_xcom_interface::initialize ( const Gcs_interface_parameters interface_params)
overridevirtual

This block implements the virtual methods defined in Gcs_interface.

Implements Gcs_interface.

◆ initialize_logging()

enum_gcs_error Gcs_xcom_interface::initialize_logging ( const std::string *  debug_file,
const std::string *  debug_path 
)
private

Method to initialize the logging and debugging systems.

If something bad happens, an error is returned.

Parameters
[in]debug_fileFile where the debug information on GCS will be stored to
[in]debug_pathDefault path where the debug information on GCS will be stored to

◆ initialize_peer_nodes()

void Gcs_xcom_interface::initialize_peer_nodes ( const std::string *  peer_nodes)
private

Helper used to parse the peer_nodes parameter and to initialize XCom peer nodes.

Parameters
[in]peer_nodesreceived parameter with the addresses of all peer nodes

◆ initialize_ssl()

void Gcs_xcom_interface::initialize_ssl ( )

Used to initialize SSL assuming that the necessary parameters have already been read.

◆ initialize_xcom()

bool Gcs_xcom_interface::initialize_xcom ( const Gcs_interface_parameters interface_params)
private

Contains all the code needed to initialize a connection to the xcom daemon.

Returns
true in case of error

These parameters must have been validated syntatically on the caller. Gcs_xcom_interface::initialize.

◆ is_initialized()

bool Gcs_xcom_interface::is_initialized ( )
overridevirtual

Method used to report if the binding interface has already been initialized.

Return values
trueif already initialized

Implements Gcs_interface.

◆ make_gcs_leave_group_on_error()

void Gcs_xcom_interface::make_gcs_leave_group_on_error ( )

Makes GCS leave the group when an error has caused XCom to terminate unexpectedly.

◆ operator=()

Gcs_xcom_interface & Gcs_xcom_interface::operator= ( Gcs_xcom_interface const &  )
private

◆ process_xcom_exit()

void Gcs_xcom_interface::process_xcom_exit ( )

◆ set_logger()

enum_gcs_error Gcs_xcom_interface::set_logger ( Logger_interface logger)
overridevirtual

Method that retrieves the binding implementation of the Group Management Session interface.

Parameters
[in]loggerthe logger implementation for GCS to use
Return values
GCS_OKin case of everything goes well. Any other value of gcs_error in case of error

Implements Gcs_interface.

◆ set_node_address()

void Gcs_xcom_interface::set_node_address ( std::string const &  address)

◆ set_xcom_group_information()

void Gcs_xcom_interface::set_xcom_group_information ( const std::string &  group_id)

◆ set_xcom_identity()

bool Gcs_xcom_interface::set_xcom_identity ( Gcs_xcom_node_information const &  node_information,
Gcs_xcom_proxy xcom_proxy 
)

Used to initialize the unique identifier of the XCom instance.

Parameters
node_informationInformation about the XCom node
xcom_proxyXCom proxy
Return values
trueif there was an error initialising the XCom identity
falseif operation was successful

◆ setup_runtime_resources()

enum_gcs_error Gcs_xcom_interface::setup_runtime_resources ( Gcs_interface_runtime_requirements reqs)
overridevirtual
See also
Gcs_interface::setup_runtime_resources

Implements Gcs_interface.

Member Data Documentation

◆ interface_reference_singleton

Gcs_interface * Gcs_xcom_interface::interface_reference_singleton = nullptr
staticprivate

◆ m_boot

bool Gcs_xcom_interface::m_boot
private

◆ m_default_debugger

Gcs_default_debugger* Gcs_xcom_interface::m_default_debugger
private

◆ m_default_logger

Logger_interface* Gcs_xcom_interface::m_default_logger
private

◆ m_default_sink

Gcs_async_buffer* Gcs_xcom_interface::m_default_sink
private

◆ m_gcs_xcom_app_cfg

Gcs_xcom_app_cfg Gcs_xcom_interface::m_gcs_xcom_app_cfg
private

The C++ interface to setup and configure xcom properties from GCS.

Under the hood, this changes the C structure that holds the configuration for XCom.

(As XCom moves into C++, we can replace XCom's internal structure with a similar object and remove it from this place.)

◆ m_group_interfaces

std::map<std::string, gcs_xcom_group_interfaces *> Gcs_xcom_interface::m_group_interfaces
private

◆ m_initialization_parameters

Gcs_interface_parameters Gcs_xcom_interface::m_initialization_parameters
private

The initialization parameters provided through the initialize member function.

◆ m_ip_allowlist

Gcs_ip_allowlist Gcs_xcom_interface::m_ip_allowlist
private

The IP allowlist.

◆ m_is_initialized

bool Gcs_xcom_interface::m_is_initialized
private

◆ m_netns_manager

Network_namespace_manager* Gcs_xcom_interface::m_netns_manager
private

Network namespace service provider.

◆ m_node_address

Gcs_xcom_node_address* Gcs_xcom_interface::m_node_address
private

◆ m_socket_util

My_xp_socket_util* Gcs_xcom_interface::m_socket_util
private

◆ m_ssl_init_state

int Gcs_xcom_interface::m_ssl_init_state
private

Indicates whether SSL has been initialized and if that initialization was successful.

◆ m_stats_mgr

Gcs_xcom_statistics_manager_interface* Gcs_xcom_interface::m_stats_mgr
private

Interface for statistic storage.

◆ m_wait_for_ssl_init_cond

My_xp_cond_impl Gcs_xcom_interface::m_wait_for_ssl_init_cond
private

protects the m_ssl_init_state thread shared variable

◆ m_wait_for_ssl_init_mutex

My_xp_mutex_impl Gcs_xcom_interface::m_wait_for_ssl_init_mutex
private

◆ m_xcom_configured_groups

std::map<u_long, Gcs_group_identifier *> Gcs_xcom_interface::m_xcom_configured_groups
private

◆ m_xcom_peers

std::vector<Gcs_xcom_node_address *> Gcs_xcom_interface::m_xcom_peers
private

◆ m_xcom_stats_storage

Gcs_xcom_statistics_storage_impl* Gcs_xcom_interface::m_xcom_stats_storage
private

Interface for XCom statistic storage.


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