MySQL 8.3.0
Source Code Documentation
ClusterMetadataDynamicState Class Reference

ClusterMetadataDynamicState represents a dynamic state that the metadata cache module wants to persist in the file. More...

#include <cluster_metadata_dynamic_state.h>

Classes

struct  Pimpl
 

Public Member Functions

 ClusterMetadataDynamicState (mysql_harness::DynamicState *base_config, mysqlrouter::ClusterType cluster_type)
 Creates and initializes a metadata cache dynamic state object. More...
 
virtual ~ClusterMetadataDynamicState ()
 Destructor. More...
 
bool save ()
 Saves the current state in the associated global base object, overwrites the current state in the global. More...
 
void load ()
 Loads the dynamic state from the associated global base object, overwrites the current state with the loaded data. More...
 
bool save (std::ostream &state_stream)
 Saves the state to the output stream given as a parameter, overwrites the stream content. More...
 
void set_cluster_type_specific_id (const std::string &cluster_type_specific_id)
 Sets the new value for the cluster type specific id in the state object. More...
 
void set_clusterset_id (const std::string &clusterset_id)
 Sets the new value for the ClusterSet id in the state object. More...
 
void set_metadata_servers (const std::vector< std::string > &metadata_servers)
 Sets the new value for the cluster metadata server list in the state object. More...
 
std::vector< std::string > get_metadata_servers () const
 Reads the current cluster metadata server list from the state object. More...
 
void set_view_id (const uint64_t view_id)
 Sets the new value for the last known metadata view_id of the ReplicaSet cluster or ClusterSet. More...
 
unsigned get_view_id () const
 Reads the current value of the last known metadata view_id of the ReplicaSet cluster or ClusterSet from the state object. More...
 
std::string get_cluster_type_specific_id () const
 Reads the current cluster type specific id from the state object. More...
 
std::string get_clusterset_id () const
 Reads the current ClusterSet id from the state object. More...
 
bool is_clusterset () const
 Returns true if the metadata is configured to work with a ClusterSet, false if a single Cluster. More...
 

Private Member Functions

void save_section ()
 

Private Attributes

std::unique_ptr< Pimplpimpl_
 
std::string cluster_type_specific_id_
 
std::string clusterset_id_
 
std::vector< std::string > metadata_servers_
 
uint64_t view_id_ {0}
 
bool changed_ {false}
 
mysqlrouter::ClusterType cluster_type_
 

Detailed Description

ClusterMetadataDynamicState represents a dynamic state that the metadata cache module wants to persist in the file.

Constructor & Destructor Documentation

◆ ClusterMetadataDynamicState()

ClusterMetadataDynamicState::ClusterMetadataDynamicState ( mysql_harness::DynamicState base_config,
mysqlrouter::ClusterType  cluster_type 
)

Creates and initializes a metadata cache dynamic state object.

Parameters
base_configpointer to the global dynamic state base object that should be used to read and write metadata cache section.
cluster_typetype of the cluster (GR or ReplicaSet)

◆ ~ClusterMetadataDynamicState()

ClusterMetadataDynamicState::~ClusterMetadataDynamicState ( )
virtualdefault

Destructor.

Member Function Documentation

◆ get_cluster_type_specific_id()

std::string ClusterMetadataDynamicState::get_cluster_type_specific_id ( ) const

Reads the current cluster type specific id from the state object.

Returns
current cluster type specific id

◆ get_clusterset_id()

std::string ClusterMetadataDynamicState::get_clusterset_id ( ) const

Reads the current ClusterSet id from the state object.

Returns
current cluster type specific id

◆ get_metadata_servers()

std::vector< std::string > ClusterMetadataDynamicState::get_metadata_servers ( ) const

Reads the current cluster metadata server list from the state object.

Returns
vector containing current cluster metadata server list

◆ get_view_id()

unsigned ClusterMetadataDynamicState::get_view_id ( ) const

Reads the current value of the last known metadata view_id of the ReplicaSet cluster or ClusterSet from the state object.

Returns
last known metadata view_id of the ReplicaSet cluster

◆ is_clusterset()

bool ClusterMetadataDynamicState::is_clusterset ( ) const

Returns true if the metadata is configured to work with a ClusterSet, false if a single Cluster.

◆ load()

void ClusterMetadataDynamicState::load ( )

Loads the dynamic state from the associated global base object, overwrites the current state with the loaded data.

◆ save() [1/2]

bool ClusterMetadataDynamicState::save ( )

Saves the current state in the associated global base object, overwrites the current state in the global.

Returns
success of operation
Return values
trueoperation succeeded
falseoperation failed

◆ save() [2/2]

bool ClusterMetadataDynamicState::save ( std::ostream &  state_stream)

Saves the state to the output stream given as a parameter, overwrites the stream content.

Parameters
state_streamstream where json content should be written to
Returns
success of operation
Return values
trueoperation succeeded
falseoperation failed

◆ save_section()

void ClusterMetadataDynamicState::save_section ( )
private

◆ set_cluster_type_specific_id()

void ClusterMetadataDynamicState::set_cluster_type_specific_id ( const std::string &  cluster_type_specific_id)

Sets the new value for the cluster type specific id in the state object.

Parameters
cluster_type_specific_idnew value of the cluster type specific id to set

◆ set_clusterset_id()

void ClusterMetadataDynamicState::set_clusterset_id ( const std::string &  clusterset_id)

Sets the new value for the ClusterSet id in the state object.

Parameters
clusterset_idnew value of the ClusterSet id to set

◆ set_metadata_servers()

void ClusterMetadataDynamicState::set_metadata_servers ( const std::vector< std::string > &  metadata_servers)

Sets the new value for the cluster metadata server list in the state object.

Parameters
metadata_serversvector of the new metadata servers to set

◆ set_view_id()

void ClusterMetadataDynamicState::set_view_id ( const uint64_t  view_id)

Sets the new value for the last known metadata view_id of the ReplicaSet cluster or ClusterSet.

Parameters
view_idlast known metadata view_id of the ReplicaSet cluster

Member Data Documentation

◆ changed_

bool ClusterMetadataDynamicState::changed_ {false}
private

◆ cluster_type_

mysqlrouter::ClusterType ClusterMetadataDynamicState::cluster_type_
private

◆ cluster_type_specific_id_

std::string ClusterMetadataDynamicState::cluster_type_specific_id_
private

◆ clusterset_id_

std::string ClusterMetadataDynamicState::clusterset_id_
private

◆ metadata_servers_

std::vector<std::string> ClusterMetadataDynamicState::metadata_servers_
private

◆ pimpl_

std::unique_ptr<Pimpl> ClusterMetadataDynamicState::pimpl_
private

◆ view_id_

uint64_t ClusterMetadataDynamicState::view_id_ {0}
private

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