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.
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2018 MariaDB Corporation Ab
|
|
*
|
|
* Use of this software is governed by the Business Source License included
|
|
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
|
*
|
|
* Change Date: 2022-01-01
|
|
*
|
|
* On the date above, in accordance with the Business Source License, use
|
|
* of this software will be governed by version 2 or later of the General
|
|
* Public License.
|
|
*/
|
|
#pragma once
|
|
|
|
/**
|
|
* Internal header for the server type
|
|
*/
|
|
|
|
#include <maxbase/average.hh>
|
|
#include <maxscale/server.h>
|
|
#include <maxscale/resultset.hh>
|
|
|
|
std::unique_ptr<ResultSet> serverGetList();
|
|
|
|
// Private server implementation
|
|
class Server : public SERVER
|
|
{
|
|
public:
|
|
|
|
int response_time_num_samples() const
|
|
{
|
|
return response_time.num_samples();
|
|
}
|
|
|
|
double response_time_average() const
|
|
{
|
|
return response_time.average();
|
|
}
|
|
|
|
void response_time_add(double ave, int num_samples)
|
|
{
|
|
response_time.add(ave, num_samples);
|
|
}
|
|
|
|
private:
|
|
// nantti, TODO. Decide whether to expose some of this in config, or if the values
|
|
// can be calculated at runtime. The "500" or sample_max affects how often a
|
|
// session should updates this stat. sample_max should be slightly lower than max sample
|
|
// rate (which is less than qps due to the noise filter).
|
|
maxbase::EMAverage response_time = {0.04, 0.35, 500};
|
|
};
|
|
|
|
void server_free(Server* server);
|