|
virtual 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=mysql_harness::kDefaultStackSizeInKiloBytes, bool use_cluster_notifications=false, const uint64_t view_id=0)=0 |
| Initialize a MetadataCache object and start caching. More...
|
|
virtual void | instance_name (const std::string &inst_name)=0 |
|
virtual std::string | instance_name () const =0 |
|
virtual bool | is_initialized () noexcept=0 |
|
virtual bool | fetch_whole_topology () const =0 |
|
virtual void | fetch_whole_topology (bool val)=0 |
|
virtual mysqlrouter::ClusterType | cluster_type () const =0 |
|
virtual void | cache_start ()=0 |
| Start the metadata cache. More...
|
|
virtual void | cache_stop () noexcept=0 |
| Teardown the metadata cache. More...
|
|
virtual cluster_nodes_list_t | get_cluster_nodes ()=0 |
| Returns list of managed server in a HA cluster. More...
|
|
virtual ClusterTopology | get_cluster_topology ()=0 |
| Return object containing current cluster topology. More...
|
|
virtual bool | wait_primary_failover (const std::string &primary_server_uuid, const std::chrono::seconds &timeout)=0 |
| Wait until there's a primary member in the cluster. More...
|
|
void | add_state_listener (ClusterStateListenerInterface *listener) override=0 |
| 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=0 |
| Unregister observer previously registered with add_state_listener() More...
|
|
virtual void | add_acceptor_handler_listener (AcceptorUpdateHandlerInterface *listener)=0 |
| Register observer that is notified when the state of listening socket acceptors should be updated on the next metadata refresh. More...
|
|
virtual void | remove_acceptor_handler_listener (AcceptorUpdateHandlerInterface *listener)=0 |
| Unregister observer previously registered with add_acceptor_handler_listener() More...
|
|
virtual void | add_md_refresh_listener (MetadataRefreshListenerInterface *listener)=0 |
| Register observer that is notified when the metadata refresh is triggered. More...
|
|
virtual void | remove_md_refresh_listener (MetadataRefreshListenerInterface *listener)=0 |
| Unregister observer previously registered with add_md_refresh_listener() More...
|
|
virtual std::pair< bool, std::pair< std::string, rapidjson::Document > > | get_rest_user_auth_data (const std::string &username) const =0 |
| Get authentication data (password hash and privileges) for the given user. More...
|
|
virtual void | enable_fetch_auth_metadata ()=0 |
| Enable fetching authentication metadata when using metadata_cache http authentication backend. More...
|
|
virtual void | force_cache_update ()=0 |
| Force cache update in refresh loop. More...
|
|
virtual void | check_auth_metadata_timers () const =0 |
| Check values of auth_cache_ttl and auth_cache_refresh_interval timers. More...
|
|
virtual void | handle_sockets_acceptors_on_md_refresh ()=0 |
| Toggle socket acceptors state update on next metadata refresh. More...
|
|
| MetadataCacheAPIBase ()=default |
|
| MetadataCacheAPIBase (const MetadataCacheAPIBase &)=delete |
|
MetadataCacheAPIBase & | operator= (const MetadataCacheAPIBase &)=delete |
|
| ~MetadataCacheAPIBase () override=default |
|
virtual RefreshStatus | get_refresh_status ()=0 |
|
virtual mysqlrouter::TargetCluster | target_cluster () const =0 |
|
virtual std::chrono::milliseconds | ttl () const =0 |
|
virtual void | set_instance_factory (metadata_factory_t cb)=0 |
|
| ClusterStateNotifierInterface ()=default |
|
| ClusterStateNotifierInterface (const ClusterStateNotifierInterface &)=delete |
|
ClusterStateNotifierInterface & | operator= (const ClusterStateNotifierInterface &)=delete |
|
virtual | ~ClusterStateNotifierInterface () |
|
virtual void metadata_cache::MetadataCacheAPIBase::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 = mysql_harness::kDefaultStackSizeInKiloBytes , |
|
|
bool |
use_cluster_notifications = false , |
|
|
const uint64_t |
view_id = 0 |
|
) |
| |
|
pure virtual |
Initialize a MetadataCache object and start caching.
The metadata_cache::cache_init function will initialize a MetadataCache object using the given arguments and store it globally using the given cache_name.
Parameters host, port, user, password are used to setup the connection with the metadata server.
Cache name given by cache_name can be empty, but must be unique.
The parameters connection_timeout and connection_attempts are used when connected to the metadata server.
Throws a std::runtime_error when the cache object was already initialized.
- Parameters
-
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 connection |
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) |
Implemented in metadata_cache::MetadataCacheAPI.