Move C++ code out of C headers

The additions into the server.h header used C++ language which caused C
programs to fail to compile. Moved the implementation of the EMAverage
class into the private Server class in the server.hh header and exposed it
via functions in the server.h header. Also temporarily moved
almost_equal_server_scores into the public server.hh as there is no
service.hh header.
This commit is contained in:
Markus Mäkelä
2018-09-08 17:32:59 +03:00
parent 4f6990f90d
commit c81173e320
10 changed files with 85 additions and 52 deletions

View File

@ -134,7 +134,7 @@ static const char gtid_wait_stmt[]
*/
using SRWBackendVector = std::vector<mxs::SRWBackend*>;
using BackendSelectFunction = std::function
<SRWBackendVector::const_iterator (const SRWBackendVector& sBackends)>;
<SRWBackendVector::iterator (SRWBackendVector& sBackends)>;
BackendSelectFunction get_backend_select_function(select_criteria_t);
struct Config
@ -385,9 +385,9 @@ std::pair<int, int> get_slave_counts(mxs::SRWBackendList& backends, mxs::SRWBack
*
* @return Valid iterator into argument backends, or end(backends) if empty
*/
SRWBackendVector::const_iterator find_best_backend(const SRWBackendVector& backends,
BackendSelectFunction select,
bool masters_accepts_reads);
SRWBackendVector::iterator find_best_backend(SRWBackendVector& backends,
BackendSelectFunction select,
bool masters_accepts_reads);
/*
* The following are implemented in rwsplit_tmp_table_multi.c