MySQL 9.1.0
Source Code Documentation
RouterOptions Class Reference

Represents the Router options in v2_routers view in the metadata schema. More...

#include <router_options.h>

Public Member Functions

bool read_from_metadata (mysqlrouter::MySQLSession &session, const unsigned router_id, const mysqlrouter::MetadataSchemaVersion schema_version, const mysqlrouter::ClusterType cluster_type)
 Pupulate the object by reading the options from the metadata. More...
 
std::string get_string () const
 Get the raw JSON string read from the metadata during the last read_from_metadata() call. More...
 
ReadOnlyTargets get_read_only_targets () const
 Get the setting for RO targets assigned to a given Router in the metadata. More...
 
std::optional< std::chrono::secondsget_stats_updates_frequency () const
 Get the stats updates ferquency value (in seconds) assigned for a given Router in the metadata. More...
 
bool get_use_replica_primary_as_rw () const
 Get the get_use_replica_primary_as_rw boolean value assigned for a given Router in the metadata. More...
 
QuorumConnectionLostAllowTraffic get_unreachable_quorum_allowed_traffic () const
 Get the unreachable_quorum_allowed_traffic value assigned for a given Router in the metadata. More...
 
std::optional< mysqlrouter::TargetClusterget_target_cluster () const
 Get the target_cluster assigned for a given Router in the metadata. More...
 

Private Attributes

std::string options_str_
 
unsigned int router_id_ {}
 
mysqlrouter::ClusterType cluster_type_ {}
 

Detailed Description

Represents the Router options in v2_routers view in the metadata schema.

Member Function Documentation

◆ get_read_only_targets()

ReadOnlyTargets RouterOptions::get_read_only_targets ( ) const

Get the setting for RO targets assigned to a given Router in the metadata.

◆ get_stats_updates_frequency()

std::optional< std::chrono::seconds > RouterOptions::get_stats_updates_frequency ( ) const

Get the stats updates ferquency value (in seconds) assigned for a given Router in the metadata.

◆ get_string()

std::string RouterOptions::get_string ( ) const
inline

Get the raw JSON string read from the metadata during the last read_from_metadata() call.

◆ get_target_cluster()

std::optional< mysqlrouter::TargetCluster > RouterOptions::get_target_cluster ( ) const

Get the target_cluster assigned for a given Router in the metadata.

Returns
assigned target_cluster if read successful, std::nullopt otherwise

◆ get_unreachable_quorum_allowed_traffic()

QuorumConnectionLostAllowTraffic RouterOptions::get_unreachable_quorum_allowed_traffic ( ) const

Get the unreachable_quorum_allowed_traffic value assigned for a given Router in the metadata.

◆ get_use_replica_primary_as_rw()

bool RouterOptions::get_use_replica_primary_as_rw ( ) const

Get the get_use_replica_primary_as_rw boolean value assigned for a given Router in the metadata.

◆ read_from_metadata()

bool RouterOptions::read_from_metadata ( mysqlrouter::MySQLSession session,
const unsigned  router_id,
const mysqlrouter::MetadataSchemaVersion  schema_version,
const mysqlrouter::ClusterType  cluster_type 
)

Pupulate the object by reading the options from the metadata.

Parameters
sessionmysql server session to read metadata with
router_idid of the Router in the metadata\
schema_versioncurrent metadata schema version
cluster_typetype of the cluster the Router is configured to use
Returns
true if successful, false otherwise

Member Data Documentation

◆ cluster_type_

mysqlrouter::ClusterType RouterOptions::cluster_type_ {}
private

◆ options_str_

std::string RouterOptions::options_str_
private

◆ router_id_

unsigned int RouterOptions::router_id_ {}
private

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