MXS-2220 Miscellaneous cleanup
Removes some duplicate includes.
This commit is contained in:
@ -1978,7 +1978,7 @@ bool server_to_object_relations(Server* server, json_t* old_json, json_t* new_js
|
||||
bool runtime_alter_server_from_json(Server* server, json_t* new_json)
|
||||
{
|
||||
bool rval = false;
|
||||
std::unique_ptr<json_t> old_json(server_to_json(server, ""));
|
||||
std::unique_ptr<json_t> old_json(server->to_json(""));
|
||||
mxb_assert(old_json.get());
|
||||
|
||||
if (is_valid_resource_body(new_json)
|
||||
@ -2038,7 +2038,7 @@ static bool is_valid_relationship_body(json_t* json)
|
||||
bool runtime_alter_server_relationships_from_json(Server* server, const char* type, json_t* json)
|
||||
{
|
||||
bool rval = false;
|
||||
std::unique_ptr<json_t> old_json(server_to_json(server, ""));
|
||||
std::unique_ptr<json_t> old_json(server->to_json(""));
|
||||
mxb_assert(old_json.get());
|
||||
|
||||
if (is_valid_relationship_body(json))
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include <maxscale/server.hh>
|
||||
#include <maxscale/resultset.hh>
|
||||
|
||||
std::unique_ptr<ResultSet> serverGetList();
|
||||
|
||||
// Private server implementation
|
||||
class Server : public SERVER
|
||||
{
|
||||
@ -298,6 +296,16 @@ public:
|
||||
*/
|
||||
void printServer();
|
||||
|
||||
static std::unique_ptr<ResultSet> getList();
|
||||
|
||||
/**
|
||||
* @brief Convert a server to JSON format
|
||||
*
|
||||
* @param host Hostname of this server as given in request
|
||||
* @return JSON representation of server or NULL if an error occurred
|
||||
*/
|
||||
json_t* to_json(const char* host);
|
||||
|
||||
DCB** persistent = nullptr;/**< List of unused persistent connections to the server */
|
||||
|
||||
private:
|
||||
@ -358,13 +366,3 @@ private:
|
||||
Settings m_settings; /**< Server settings */
|
||||
VersionInfo info; /**< Server version and type information */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Convert a server to JSON format
|
||||
*
|
||||
* @param server Server to convert
|
||||
* @param host Hostname of this server
|
||||
*
|
||||
* @return JSON representation of server or NULL if an error occurred
|
||||
*/
|
||||
json_t* server_to_json(const Server* server, const char* host);
|
||||
|
@ -550,7 +550,7 @@ HttpResponse cb_get_server(const HttpRequest& request)
|
||||
{
|
||||
auto server = Server::find_by_unique_name(request.uri_part(1));
|
||||
mxb_assert(server);
|
||||
return HttpResponse(MHD_HTTP_OK, server_to_json(server, request.host()));
|
||||
return HttpResponse(MHD_HTTP_OK, server->to_json(request.host()));
|
||||
}
|
||||
|
||||
HttpResponse cb_all_services(const HttpRequest& request)
|
||||
|
@ -25,11 +25,10 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include <maxbase/atomic.hh>
|
||||
#include <maxbase/stopwatch.hh>
|
||||
@ -47,7 +46,6 @@
|
||||
#include <maxscale/clock.h>
|
||||
#include <maxscale/http.hh>
|
||||
#include <maxscale/maxscale.h>
|
||||
#include <maxscale/server.hh>
|
||||
#include <maxscale/routingworker.hh>
|
||||
|
||||
#include "internal/monitor.hh"
|
||||
@ -770,7 +768,7 @@ string Server::get_custom_parameter(const string& name) const
|
||||
*
|
||||
* @return A Result set
|
||||
*/
|
||||
std::unique_ptr<ResultSet> serverGetList()
|
||||
std::unique_ptr<ResultSet> Server::getList()
|
||||
{
|
||||
std::unique_ptr<ResultSet> set =
|
||||
ResultSet::create({"Server", "Address", "Port", "Connections", "Status"});
|
||||
@ -1139,11 +1137,11 @@ static json_t* server_to_json_data(const Server* server, const char* host)
|
||||
return rval;
|
||||
}
|
||||
|
||||
json_t* server_to_json(const Server* server, const char* host)
|
||||
json_t* Server::to_json(const char* host)
|
||||
{
|
||||
string self = MXS_JSON_API_SERVERS;
|
||||
self += server->name();
|
||||
return mxs_json_resource(host, self.c_str(), server_to_json_data(server, host));
|
||||
self += name();
|
||||
return mxs_json_resource(host, self.c_str(), server_to_json_data(this, host));
|
||||
}
|
||||
|
||||
json_t* Server::server_list_to_json(const char* host)
|
||||
|
@ -164,7 +164,7 @@ static void exec_show_clients(DCB* dcb, MAXINFO_TREE* tree)
|
||||
*/
|
||||
static void exec_show_servers(DCB* dcb, MAXINFO_TREE* tree)
|
||||
{
|
||||
serverGetList()->write(dcb);
|
||||
Server::getList()->write(dcb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user