MySQL 9.1.0
Source Code Documentation
|
The ClusterMetadata
class encapsulates a connection to the Metadata server.
More...
#include <cluster_metadata.h>
Public Member Functions | |
ClusterMetadata (const metadata_cache::MetadataCacheMySQLSessionConfig &session_config, const mysqlrouter::SSLOptions &ssl_options) | |
Constructor. More... | |
ClusterMetadata (const ClusterMetadata &)=delete | |
ClusterMetadata & | operator= (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::MySQLSession > | get_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 metadata_cache::metadata_server_t &md_server, const mysqlrouter::TargetCluster &target_cluster) override |
std::optional< metadata_cache::metadata_server_t > | find_rw_server (const std::vector< metadata_cache::ManagedInstance > &instances) |
std::optional< metadata_cache::metadata_server_t > | find_rw_server (const std::vector< metadata_cache::ManagedCluster > &clusters) |
std::optional< std::chrono::seconds > | get_periodic_stats_update_frequency () noexcept override |
Public Member Functions inherited from MetaData | |
virtual stdx::expected< metadata_cache::ClusterTopology, std::error_code > | fetch_cluster_topology (const std::atomic< bool > &terminated, mysqlrouter::TargetCluster &target_cluster, const unsigned router_id, const metadata_cache::metadata_servers_list_t &metadata_servers, bool needs_writable_node, const std::string &clusterset_id, bool whole_topology, std::size_t &instance_id)=0 |
virtual void | setup_notifications_listener (const metadata_cache::ClusterTopology &cluster_topology, const std::function< void()> &callback)=0 |
virtual void | shutdown_notifications_listener ()=0 |
virtual mysqlrouter::ClusterType | get_cluster_type ()=0 |
MetaData ()=default | |
MetaData (const MetaData &)=delete | |
MetaData & | operator= (const MetaData &)=delete |
virtual | ~MetaData ()=default |
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::MySQLSession > | metadata_connection_ |
RouterOptions | router_options_ |
Additional Inherited Members | |
Public Types inherited from MetaData | |
using | JsonAllocator = rapidjson::CrtAllocator |
using | JsonDocument = rapidjson::Document |
using | auth_credentials_t = std::map< std::string, std::pair< std::string, JsonDocument > > |
The ClusterMetadata
class encapsulates a connection to the Metadata server.
It uses the mysqlrouter::MySQLSession to setup, manage and retrieve results.
ClusterMetadata::ClusterMetadata | ( | const metadata_cache::MetadataCacheMySQLSessionConfig & | session_config, |
const mysqlrouter::SSLOptions & | ssl_options | ||
) |
Constructor.
session_config | Metadata MySQL session configuration |
ssl_options | SSL related options to use for MySQL connections) |
|
explicitdelete |
|
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_)
|
overridevirtualnoexcept |
Connects with the Metadata server and sets up the session parameters.
metadata_server | the server instance for which the connection should be attempted. |
Implements MetaData.
|
inlineoverridevirtualnoexcept |
Disconnects from the Metadata server.
Implements MetaData.
|
protected |
Connects a MYSQL connection to the given instance.
|
overridevirtual |
Implements MetaData.
Reimplemented in GRClusterMetadata.
std::optional< metadata_cache::metadata_server_t > ClusterMetadata::find_rw_server | ( | const std::vector< metadata_cache::ManagedCluster > & | clusters | ) |
std::optional< metadata_cache::metadata_server_t > ClusterMetadata::find_rw_server | ( | const std::vector< metadata_cache::ManagedInstance > & | instances | ) |
|
protected |
|
inlineoverridevirtual |
Gets the object representing the session to the metadata server.
Implements MetaData.
|
inlineoverridevirtualnoexcept |
Implements MetaData.
|
delete |
|
overridevirtual |
Implements MetaData.
|
overridevirtual |
Implements MetaData.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |