MySQL 8.0.39
Source Code Documentation
ClusterMetadata Class Reference

The ClusterMetadata class encapsulates a connection to the Metadata server. More...

#include <cluster_metadata.h>

Inheritance diagram for ClusterMetadata:
[legend]

Public Member Functions

 ClusterMetadata (const metadata_cache::MetadataCacheMySQLSessionConfig &session_config, const mysqlrouter::SSLOptions &ssl_options)
 Constructor. More...
 
 ClusterMetadata (const ClusterMetadata &)=delete
 
ClusterMetadataoperator= (const ClusterMetadata &)=delete
 
 ~ClusterMetadata () override
 Destructor. More...
 
bool connect_and_setup_session (const metadata_cache::metadata_server_t &metadata_server) noexcept override
 Connects with the Metadata server and sets up the session parameters. More...
 
void disconnect () noexcept override
 Disconnects from the Metadata server. More...
 
std::shared_ptr< mysqlrouter::MySQLSessionget_connection () override
 Gets the object representing the session to the metadata server. More...
 
bool update_router_attributes (const metadata_cache::metadata_server_t &rw_server, const unsigned router_id, const metadata_cache::RouterAttributes &router_attributes) override
 
bool update_router_last_check_in (const metadata_cache::metadata_server_t &rw_server, const unsigned router_id) override
 
auth_credentials_t fetch_auth_credentials (const mysqlrouter::TargetCluster &target_cluster) override
 
std::optional< metadata_cache::metadata_server_tfind_rw_server (const std::vector< metadata_cache::ManagedInstance > &instances)
 
std::optional< metadata_cache::metadata_server_tfind_rw_server (const std::vector< metadata_cache::ManagedCluster > &clusters)
 
std::optional< std::chrono::secondsget_periodic_stats_update_frequency () noexcept override
 

Protected Member Functions

bool do_connect (mysqlrouter::MySQLSession &connection, const metadata_cache::metadata_server_t &mi)
 Connects a MYSQL connection to the given instance. More...
 
mysqlrouter::MetadataSchemaVersion get_and_check_metadata_schema_version (mysqlrouter::MySQLSession &session)
 

Protected Attributes

mysql_ssl_mode ssl_mode_
 
mysqlrouter::SSLOptions ssl_options_
 
metadata_cache::MetadataCacheMySQLSessionConfig session_config_
 
std::shared_ptr< mysqlrouter::MySQLSessionmetadata_connection_
 

Additional Inherited Members

Detailed Description

The ClusterMetadata class encapsulates a connection to the Metadata server.

It uses the mysqlrouter::MySQLSession to setup, manage and retrieve results.

Constructor & Destructor Documentation

◆ ClusterMetadata() [1/2]

ClusterMetadata::ClusterMetadata ( const metadata_cache::MetadataCacheMySQLSessionConfig session_config,
const mysqlrouter::SSLOptions ssl_options 
)

Constructor.

Parameters
session_configMetadata MySQL session configuration
ssl_optionsSSL related options to use for MySQL connections)

◆ ClusterMetadata() [2/2]

ClusterMetadata::ClusterMetadata ( const ClusterMetadata )
explicitdelete

◆ ~ClusterMetadata()

ClusterMetadata::~ClusterMetadata ( )
overridedefault

Destructor.

Disconnect and release the connection to the metadata node.

Disconnect and release the connection to the metadata node. (RAII will close the connection in metadata_connection_)

Member Function Documentation

◆ connect_and_setup_session()

bool ClusterMetadata::connect_and_setup_session ( const metadata_cache::metadata_server_t metadata_server)
overridevirtualnoexcept

Connects with the Metadata server and sets up the session parameters.

Parameters
metadata_serverthe server instance for which the connection should be attempted.
Returns
a boolean to indicate if the connection and session parameters setup was successful.

Implements MetaData.

◆ disconnect()

void ClusterMetadata::disconnect ( )
inlineoverridevirtualnoexcept

Disconnects from the Metadata server.

This is a no-op, as MySQLSession object used underneath for connection handling employs RAII, making this method unnecessary.

Implements MetaData.

◆ do_connect()

bool ClusterMetadata::do_connect ( mysqlrouter::MySQLSession connection,
const metadata_cache::metadata_server_t mi 
)
protected

Connects a MYSQL connection to the given instance.

◆ fetch_auth_credentials()

ClusterMetadata::auth_credentials_t ClusterMetadata::fetch_auth_credentials ( const mysqlrouter::TargetCluster target_cluster)
overridevirtual

Implements MetaData.

Reimplemented in GRClusterMetadata.

◆ find_rw_server() [1/2]

std::optional< metadata_cache::metadata_server_t > ClusterMetadata::find_rw_server ( const std::vector< metadata_cache::ManagedCluster > &  clusters)

◆ find_rw_server() [2/2]

std::optional< metadata_cache::metadata_server_t > ClusterMetadata::find_rw_server ( const std::vector< metadata_cache::ManagedInstance > &  instances)

◆ get_and_check_metadata_schema_version()

mysqlrouter::MetadataSchemaVersion ClusterMetadata::get_and_check_metadata_schema_version ( mysqlrouter::MySQLSession session)
protected

◆ get_connection()

std::shared_ptr< mysqlrouter::MySQLSession > ClusterMetadata::get_connection ( )
inlineoverridevirtual

Gets the object representing the session to the metadata server.

Implements MetaData.

◆ get_periodic_stats_update_frequency()

std::optional< std::chrono::seconds > ClusterMetadata::get_periodic_stats_update_frequency ( )
inlineoverridevirtualnoexcept

Implements MetaData.

Reimplemented in GRClusterMetadata.

◆ operator=()

ClusterMetadata & ClusterMetadata::operator= ( const ClusterMetadata )
delete

◆ update_router_attributes()

bool ClusterMetadata::update_router_attributes ( const metadata_cache::metadata_server_t rw_server,
const unsigned  router_id,
const metadata_cache::RouterAttributes router_attributes 
)
overridevirtual

Implements MetaData.

◆ update_router_last_check_in()

bool ClusterMetadata::update_router_last_check_in ( const metadata_cache::metadata_server_t rw_server,
const unsigned  router_id 
)
overridevirtual

Implements MetaData.

Member Data Documentation

◆ metadata_connection_

std::shared_ptr<mysqlrouter::MySQLSession> ClusterMetadata::metadata_connection_
protected

◆ session_config_

metadata_cache::MetadataCacheMySQLSessionConfig ClusterMetadata::session_config_
protected

◆ ssl_mode_

mysql_ssl_mode ClusterMetadata::ssl_mode_
protected

◆ ssl_options_

mysqlrouter::SSLOptions ClusterMetadata::ssl_options_
protected

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