MySQL 9.1.0
Source Code Documentation
ARClusterMetadata Class Reference

The ARClusterMetadata class encapsulates a connection to the ReplicaSet Cluster metadata server. More...

#include <cluster_metadata_ar.h>

Inheritance diagram for ARClusterMetadata:
[legend]

Public Member Functions

 ARClusterMetadata (const metadata_cache::MetadataCacheMySQLSessionConfig &session_config, const mysqlrouter::SSLOptions &ssl_options, uint64_t view_id)
 Constructor. More...
 
 ARClusterMetadata (const ARClusterMetadata &)=delete
 
ARClusterMetadataoperator= (const ARClusterMetadata &)=delete
 
 ~ARClusterMetadata () override
 Destructor. More...
 
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 &, bool, std::size_t &instance_id) override
 Returns cluster defined in the metadata given set of the metadata servers (cluster members) More...
 
mysqlrouter::ClusterType get_cluster_type () override
 Returns cluster type this object is suppsed to handle. More...
 
void setup_notifications_listener (const metadata_cache::ClusterTopology &, const GRNotificationListener::NotificationClb &) override
 
void shutdown_notifications_listener () override
 Deinitializes the notifications listener thread. More...
 

Private Member Functions

metadata_cache::ClusterTopology fetch_topology_from_member (mysqlrouter::MySQLSession &session, unsigned view_id, const std::string &cluster_id="")
 Returns the current cluster topology according to the metadata of the given metadata server. More...
 
bool get_member_view_id (mysqlrouter::MySQLSession &session, const std::string &cluster_id, uint64_t &result)
 Returns metadata view id the given member holds. More...
 

Private Attributes

uint64_t view_id_
 

Additional Inherited Members

Detailed Description

The ARClusterMetadata class encapsulates a connection to the ReplicaSet Cluster metadata server.

Constructor & Destructor Documentation

◆ ARClusterMetadata() [1/2]

ARClusterMetadata::ARClusterMetadata ( const metadata_cache::MetadataCacheMySQLSessionConfig session_config,
const mysqlrouter::SSLOptions ssl_options,
uint64_t  view_id 
)
inline

Constructor.

Parameters
session_configMetadata MySQL session configuration
ssl_optionsSSL related options to use for MySQL connections
view_idlast known view_id of the cluster metadata

◆ ARClusterMetadata() [2/2]

ARClusterMetadata::ARClusterMetadata ( const ARClusterMetadata )
explicitdelete

◆ ~ARClusterMetadata()

ARClusterMetadata::~ARClusterMetadata ( )
overridedefault

Destructor.

Disconnect and release the connection to the metadata node.

Member Function Documentation

◆ fetch_cluster_topology()

stdx::expected< metadata_cache::ClusterTopology, std::error_code > ARClusterMetadata::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 &  ,
bool  ,
std::size_t &  instance_id 
)
overridevirtual

Returns cluster defined in the metadata given set of the metadata servers (cluster members)

Parameters
terminatedflag indicating that the process is cterminating, allowing the function to leave earlier if possible
[in,out]target_clusterobject identifying the Cluster this operation refers to
router_idid of the router in the cluster metadata
metadata_serversset of the metadata servers to use to fetch the metadata
needs_writable_nodeflag indicating if the caller needs us to query for writable node
[out]instance_idid of the server the metadata was fetched from
Returns
object containing cluster topology information in case of success, or error code in case of failure
Exceptions
metadata_cache::metadata_error

Implements MetaData.

◆ fetch_topology_from_member()

metadata_cache::ClusterTopology ARClusterMetadata::fetch_topology_from_member ( mysqlrouter::MySQLSession session,
unsigned  view_id,
const std::string &  cluster_id = "" 
)
private

Returns the current cluster topology according to the metadata of the given metadata server.

Parameters
sessionactive connection to the member that is checked for the metadata
view_idlast known view_id of the cluster metadata
cluster_idID of the cluster this operation refers to
Returns
vector of the cluster members

◆ get_cluster_type()

mysqlrouter::ClusterType ARClusterMetadata::get_cluster_type ( )
inlineoverridevirtual

Returns cluster type this object is suppsed to handle.

Implements MetaData.

◆ get_member_view_id()

bool ARClusterMetadata::get_member_view_id ( mysqlrouter::MySQLSession session,
const std::string &  cluster_id,
uint64_t &  result 
)
private

Returns metadata view id the given member holds.

Parameters
sessionactive connection to the member that is checked for the view id
cluster_idID of the cluster this operation refers to
[out]resultmember's metadata view_id
Return values
trueon success
falseotherwise.

◆ operator=()

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

◆ setup_notifications_listener()

void ARClusterMetadata::setup_notifications_listener ( const metadata_cache::ClusterTopology ,
const GRNotificationListener::NotificationClb  
)
inlineoverridevirtual

Implements MetaData.

◆ shutdown_notifications_listener()

void ARClusterMetadata::shutdown_notifications_listener ( )
inlineoverridevirtual

Deinitializes the notifications listener thread.

Implements MetaData.

Member Data Documentation

◆ view_id_

uint64_t ARClusterMetadata::view_id_
private

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