![]() |
MySQL 9.2.0
Source Code Documentation
|
Routing guidelines engine. More...
#include <routing_guidelines.h>
Classes | |
struct | Destination_classification |
Result of destination classification. More... | |
struct | Route |
Class representing routing guidelines route section entry. More... | |
struct | Route_classification |
Result of route classification. More... | |
struct | RouteChanges |
Type for names of Routes changed during routing guidelines document update. More... | |
struct | Rpd |
Public Types | |
using | ResolveCache = std::unordered_map< std::string, net::ip::address > |
Map with preprocessed resolved hostnames. More... | |
Public Member Functions | |
Routing_guidelines_engine () | |
~Routing_guidelines_engine () | |
Routing_guidelines_engine (Routing_guidelines_engine &&rp) | |
Routing_guidelines_engine & | operator= (Routing_guidelines_engine &&) |
Routing_guidelines_engine (const Routing_guidelines_engine &)=delete | |
Routing_guidelines_engine & | operator= (const Routing_guidelines_engine &)=delete |
RouteChanges | update_routing_guidelines (Routing_guidelines_engine &&new_rp, bool is_provided_by_user=true) |
Update routing guidelines and return affected classes and routes. More... | |
const std::string & | name () const |
Get routing routing guidelines document name. More... | |
Route_classification | classify (const Session_info &session, const Router_info &router_info, const Sql_info *sql=nullptr) const |
Compute a route of a session. More... | |
Destination_classification | classify (const Server_info &instance, const Router_info &router_info) const |
Compute destination classes to which a MySQL instance belongs. More... | |
const std::vector< std::string > & | destination_classes () const |
Get destination names defined by routing guidelines document. More... | |
const std::vector< Route > & | get_routes () const |
Get list of routes defined in routing guidelines. More... | |
std::vector< Resolve_host > | hostnames_to_resolve () const |
List of hostnames that are used in routing guideline document that need to be resolved. More... | |
void | update_resolve_cache (ResolveCache cache) |
Set the resolved hostnames cache, used when hostnames used by the routing guidelines are resolved. More... | |
const rapidjson::Document & | get_routing_guidelines_document () const |
Get routing guidelines document that is used by the guidelines engine. More... | |
bool | extended_session_info_in_use () const |
Check if routing guideline in use uses extended session info that needs traffic inspection. More... | |
bool | session_rand_used () const |
Check if routing guideline in use uses random value generated per session. More... | |
bool | routing_guidelines_updated () const |
Check if the routing guidelines were updated. More... | |
Routing_guidelines_engine::RouteChanges | restore_default () |
Restore auto-generated guideline (based on Router's configuration). More... | |
void | set_default_routing_guidelines (std::string routing_guidelines_doc) |
Set the default guideline (auto-generated based on Router's configuration). More... | |
Static Public Member Functions | |
static std::string | get_schema () |
Get routing guidelines schema describing guidelines document. More... | |
static Routing_guidelines_engine | create (const std::string &routing_guidelines_document) |
Factory method for creating instance of Routing_guidelines_engine. More... | |
static void | validate_one_route (const std::string &route) |
Validate route entry string. More... | |
static void | validate_one_destination (const std::string &destination) |
Validate destination entry string. More... | |
static void | validate_guideline_document (const std::string &doc) |
Validate whole guidelines document. More... | |
Private Member Functions | |
RouteChanges | compare (const Routing_guidelines_engine &new_routing_guidelines) |
Compute changes introduced by the new routing guidelines. More... | |
Private Attributes | |
std::unique_ptr< Rpd > | rpd_ |
rapidjson::Document | routing_guidelines_document_ |
std::string | default_routing_guidelines_doc_ |
Friends | |
class | Routing_guidelines_document_parser |
Routing guidelines engine.
Responsible for traffic classification based on routing guidelines document, information about the given Router instance, incoming session information and destination servers that are provided by the metadata.
using routing_guidelines::Routing_guidelines_engine::ResolveCache = std::unordered_map<std::string, net::ip::address> |
Map with preprocessed resolved hostnames.
routing_guidelines::Routing_guidelines_engine::Routing_guidelines_engine | ( | ) |
|
default |
|
default |
|
delete |
Routing_guidelines_engine::Destination_classification routing_guidelines::Routing_guidelines_engine::classify | ( | const Server_info & | instance, |
const Router_info & | router_info | ||
) | const |
Compute destination classes to which a MySQL instance belongs.
If no suitable class is found class_names vector in returned Destination_classification will be empty.
Routing_guidelines_engine::Route_classification routing_guidelines::Routing_guidelines_engine::classify | ( | const Session_info & | session, |
const Router_info & | router_info, | ||
const Sql_info * | sql = nullptr |
||
) | const |
Compute a route of a session.
|
private |
Compute changes introduced by the new routing guidelines.
|
static |
Factory method for creating instance of Routing_guidelines_engine.
routing_guidelines_document | document content. |
Guidelines_parse_error | containing all encountered errors. |
const std::vector< std::string > & routing_guidelines::Routing_guidelines_engine::destination_classes | ( | ) | const |
Get destination names defined by routing guidelines document.
bool routing_guidelines::Routing_guidelines_engine::extended_session_info_in_use | ( | ) | const |
Check if routing guideline in use uses extended session info that needs traffic inspection.
const std::vector< Routing_guidelines_engine::Route > & routing_guidelines::Routing_guidelines_engine::get_routes | ( | ) | const |
Get list of routes defined in routing guidelines.
const rapidjson::Document & routing_guidelines::Routing_guidelines_engine::get_routing_guidelines_document | ( | ) | const |
Get routing guidelines document that is used by the guidelines engine.
|
static |
Get routing guidelines schema describing guidelines document.
std::vector< Resolve_host > routing_guidelines::Routing_guidelines_engine::hostnames_to_resolve | ( | ) | const |
List of hostnames that are used in routing guideline document that need to be resolved.
const std::string & routing_guidelines::Routing_guidelines_engine::name | ( | ) | const |
Get routing routing guidelines document name.
|
delete |
|
default |
Routing_guidelines_engine::RouteChanges routing_guidelines::Routing_guidelines_engine::restore_default | ( | ) |
Restore auto-generated guideline (based on Router's configuration).
bool routing_guidelines::Routing_guidelines_engine::routing_guidelines_updated | ( | ) | const |
Check if the routing guidelines were updated.
That means that there is a custom routing guideline in use instead of an auto-generated one.
bool routing_guidelines::Routing_guidelines_engine::session_rand_used | ( | ) | const |
Check if routing guideline in use uses random value generated per session.
|
inline |
Set the default guideline (auto-generated based on Router's configuration).
routing_guidelines_doc | routing guidelines document |
void routing_guidelines::Routing_guidelines_engine::update_resolve_cache | ( | ResolveCache | cache | ) |
Set the resolved hostnames cache, used when hostnames used by the routing guidelines are resolved.
Can be called from a different thread, than the one performing classification.
Routing_guidelines_engine::RouteChanges routing_guidelines::Routing_guidelines_engine::update_routing_guidelines | ( | Routing_guidelines_engine && | new_rp, |
bool | is_provided_by_user = true |
||
) |
Update routing guidelines and return affected classes and routes.
[in] | new_rp | - new Routing Guidelines engine |
[in] | is_provided_by_user | - true if guideline is provided by user or false if it is auto-generated. |
|
static |
Validate whole guidelines document.
std::runtime_error | when guidelines doc is invalid |
|
static |
Validate destination entry string.
std::runtime_error | when destination entry is invalid |
|
static |
Validate route entry string.
std::runtime_error | when route entry is invalid |
|
friend |
|
private |
|
private |
|
private |