MySQL 9.1.0
Source Code Documentation
|
#include <metadata_cache.h>
Classes | |
struct | InstData |
Public Member Functions | |
void | cache_init (const mysqlrouter::ClusterType cluster_type, const unsigned router_id, const std::string &clusterset_id, const metadata_servers_list_t &metadata_servers, const MetadataCacheTTLConfig &ttl_config, const mysqlrouter::SSLOptions &ssl_options, const mysqlrouter::TargetCluster &target_cluster, const MetadataCacheMySQLSessionConfig &session_config, const RouterAttributes &router_attributes, size_t thread_stack_size, bool use_cluster_notifications, const uint64_t view_id) override |
Initialize the metadata cache. More... | |
mysqlrouter::ClusterType | cluster_type () const override |
void | instance_name (const std::string &inst_name) override |
std::string | instance_name () const override |
mysqlrouter::TargetCluster | target_cluster () const override |
std::chrono::milliseconds | ttl () const override |
bool | is_initialized () noexcept override |
void | cache_start () override |
Start the metadata cache. More... | |
void | cache_stop () noexcept override |
Teardown the metadata cache. More... | |
cluster_nodes_list_t | get_cluster_nodes () override |
Lookup the servers that belong to the cluster. More... | |
ClusterTopology | get_cluster_topology () override |
Return object containing current cluster topology. More... | |
bool | wait_primary_failover (const std::string &primary_server_uuid, const std::chrono::seconds &timeout) override |
Wait until there's a primary member in the cluster. More... | |
void | add_state_listener (ClusterStateListenerInterface *listener) override |
Register observer that is notified when there is a change in the cluster nodes setup/state discovered. More... | |
void | remove_state_listener (ClusterStateListenerInterface *listener) override |
Unregister observer previously registered with add_state_listener() More... | |
void | add_acceptor_handler_listener (AcceptorUpdateHandlerInterface *listener) override |
Register observer that is notified when the state of listening socket acceptors should be updated on the next metadata refresh. More... | |
void | remove_acceptor_handler_listener (AcceptorUpdateHandlerInterface *listener) override |
Unregister observer previously registered with add_acceptor_handler_listener() More... | |
void | add_md_refresh_listener (MetadataRefreshListenerInterface *listener) override |
Register observer that is notified when the metadata refresh is triggered. More... | |
void | remove_md_refresh_listener (MetadataRefreshListenerInterface *listener) override |
Unregister observer previously registered with add_md_refresh_listener() More... | |
RefreshStatus | get_refresh_status () override |
std::pair< bool, std::pair< std::string, rapidjson::Document > > | get_rest_user_auth_data (const std::string &user) const override |
Get authentication data (password hash and privileges) for the given user. More... | |
void | enable_fetch_auth_metadata () override |
Enable fetching authentication metadata when using metadata_cache http authentication backend. More... | |
void | force_cache_update () override |
Force cache update in refresh loop. More... | |
void | check_auth_metadata_timers () const override |
Check values of auth_cache_ttl and auth_cache_refresh_interval timers. More... | |
void | handle_sockets_acceptors_on_md_refresh () override |
Toggle socket acceptors state update on next metadata refresh. More... | |
void | set_instance_factory (metadata_factory_t cb) override |
bool | fetch_whole_topology () const override |
void | fetch_whole_topology (bool val) override |
Public Member Functions inherited from metadata_cache::MetadataCacheAPIBase | |
MetadataCacheAPIBase ()=default | |
MetadataCacheAPIBase (const MetadataCacheAPIBase &)=delete | |
MetadataCacheAPIBase & | operator= (const MetadataCacheAPIBase &)=delete |
~MetadataCacheAPIBase () override=default | |
Public Member Functions inherited from metadata_cache::ClusterStateNotifierInterface | |
ClusterStateNotifierInterface ()=default | |
ClusterStateNotifierInterface (const ClusterStateNotifierInterface &)=delete | |
ClusterStateNotifierInterface & | operator= (const ClusterStateNotifierInterface &)=delete |
virtual | ~ClusterStateNotifierInterface () |
Static Public Member Functions | |
static MetadataCacheAPIBase * | instance () |
Private Member Functions | |
MetadataCacheAPI ()=default | |
MetadataCacheAPI (const MetadataCacheAPI &)=delete | |
MetadataCacheAPI & | operator= (const MetadataCacheAPI &)=delete |
Private Attributes | |
metadata_factory_t | instance_factory_ {&metadata_factory_get_instance} |
Monitor< InstData > | inst_ {{}} |
std::atomic< bool > | is_initialized_ {false} |
Additional Inherited Members | |
Public Types inherited from metadata_cache::MetadataCacheAPIBase | |
using | metadata_factory_t = std::function< std::shared_ptr< MetaData >(mysqlrouter::ClusterType cluster_type, const metadata_cache::MetadataCacheMySQLSessionConfig &session_config, const mysqlrouter::SSLOptions &ssl_options, const bool use_cluster_notifications, unsigned view_id)> |
|
privatedefault |
|
privatedelete |
|
overridevirtual |
Register observer that is notified when the state of listening socket acceptors should be updated on the next metadata refresh.
listener | Observer object that is notified when replicaset nodes state is changed. |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Register observer that is notified when the metadata refresh is triggered.
listener | Observer object that is notified on metadata refresh. |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Register observer that is notified when there is a change in the cluster nodes setup/state discovered.
listener | Observer object that is notified when cluster nodes state is changed. |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Initialize the metadata cache.
cluster_type | type of the cluster the metadata cache object will represent (GR or ReplicaSet) |
router_id | id of the router in the cluster metadata |
clusterset_id | UUID of the ClusterSet the Cluster belongs to (if bootstrapped as a ClusterSet, empty otherwise) |
metadata_servers | The list of cluster metadata servers |
ttl_config | metadata TTL configuration |
ssl_options | SSL related options for connections |
target_cluster | object identifying the Cluster this operation refers to |
session_config | Metadata MySQL session configuration |
router_attributes | Router attributes to be registered in the metadata |
thread_stack_size | memory in kilobytes allocated for thread's stack |
use_cluster_notifications | Flag indicating if the metadata cache should use cluster notifications as an additional trigger for metadata refresh (only available for GR cluster type) |
view_id | last known view_id of the cluster metadata (only relevant for ReplicaSet cluster) |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Start the metadata cache.
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtualnoexcept |
Teardown the metadata cache.
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Check values of auth_cache_ttl and auth_cache_refresh_interval timers.
std::invalid_argument | for each of the following scenarios:
|
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Enable fetching authentication metadata when using metadata_cache http authentication backend.
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Force cache update in refresh loop.
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Lookup the servers that belong to the cluster.
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Return object containing current cluster topology.
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Get authentication data (password hash and privileges) for the given user.
username | - name of the user for which the authentidation data is requested |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Toggle socket acceptors state update on next metadata refresh.
Implements metadata_cache::MetadataCacheAPIBase.
|
static |
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
inlineoverridevirtualnoexcept |
Implements metadata_cache::MetadataCacheAPIBase.
|
privatedelete |
|
overridevirtual |
Unregister observer previously registered with add_acceptor_handler_listener()
listener | Observer object that should be unregistered. |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Unregister observer previously registered with add_md_refresh_listener()
listener | Observer object that should be unregistered. |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Unregister observer previously registered with add_state_listener()
listener | Observer object that should be unregistered. |
Implements metadata_cache::MetadataCacheAPIBase.
|
inlineoverridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Implements metadata_cache::MetadataCacheAPIBase.
|
overridevirtual |
Wait until there's a primary member in the cluster.
To be called when the primary member of a single-primary cluster is down and we want to wait until one becomes elected.
primary_server_uuid | - server_uuid of the PRIMARY that shall be failover from. |
timeout | - amount of time to wait for a failover, in seconds |
Implements metadata_cache::MetadataCacheAPIBase.
|
private |
|
private |