Add server state helper functions

Added helper functions that check various server states. This makes the
readwritesplit code easier to read as the function names convey the
intention better than the macro invokations.
This commit is contained in:
Markus Mäkelä
2017-06-19 13:30:53 +03:00
parent 37b6cf250d
commit d7543988ee
4 changed files with 49 additions and 14 deletions

View File

@ -219,6 +219,27 @@ public:
*/
bool is_closed() const;
/**
* @brief Check if the server is a master
*
* @return True if server is a master
*/
bool is_master() const;
/**
* @brief Check if the server is a slave
*
* @return True if the server is a slave
*/
bool is_slave() const;
/**
* @brief Check if the server is a relay server
*
* @return True if the server is a relay server
*/
bool is_relay() const;
/**
* @brief Check if the backend has failed fatally
*