From 8ababa1d3968d3843458081c9c332312975913e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 31 Jul 2018 10:01:18 +0300 Subject: [PATCH] MXS-1929: Make core ResultSet functions private The functions in the core that generate a ResultSet are now private. --- include/maxscale/server.h | 2 -- include/maxscale/service.h | 3 --- include/maxscale/session.h | 2 +- server/core/internal/modules.h | 8 -------- server/core/internal/modules.hh | 24 ++++++++++++++++++++++++ server/core/internal/monitor.h | 1 - server/core/internal/monitor.hh | 23 +++++++++++++++++++++++ server/core/internal/poll.h | 4 ++-- server/core/internal/server.hh | 21 +++++++++++++++++++++ server/core/internal/service.hh | 4 ++++ server/core/internal/session.h | 2 -- server/core/internal/session.hh | 4 ++++ server/modules/routing/maxinfo/maxinfo.h | 9 +++------ 13 files changed, 82 insertions(+), 25 deletions(-) create mode 100644 server/core/internal/modules.hh create mode 100644 server/core/internal/monitor.hh create mode 100644 server/core/internal/server.hh diff --git a/include/maxscale/server.h b/include/maxscale/server.h index 5f4393894..944eb3aae 100644 --- a/include/maxscale/server.h +++ b/include/maxscale/server.h @@ -21,7 +21,6 @@ #include #include #include -#include #include MXS_BEGIN_DECLS @@ -480,6 +479,5 @@ extern void dprintAllServersJson(DCB *); extern void dprintServer(DCB *, const SERVER *); extern void dprintPersistentDCBs(DCB *, const SERVER *); extern void dListServers(DCB *); -extern RESULTSET *serverGetList(); MXS_END_DECLS diff --git a/include/maxscale/service.h b/include/maxscale/service.h index f53a43b4d..0cfd014f3 100644 --- a/include/maxscale/service.h +++ b/include/maxscale/service.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -248,8 +247,6 @@ void dprintService(DCB *dcb, SERVICE *service); void dListServices(DCB *dcb); void dListListeners(DCB *dcb); int serviceSessionCountAll(void); -RESULTSET* serviceGetList(void); -RESULTSET* serviceGetListenerList(void); /** * Get the capabilities of the servive. diff --git a/include/maxscale/session.h b/include/maxscale/session.h index 955f8dd46..12aa674ad 100644 --- a/include/maxscale/session.h +++ b/include/maxscale/session.h @@ -21,9 +21,9 @@ #include #include +#include #include #include -#include #include #include diff --git a/server/core/internal/modules.h b/server/core/internal/modules.h index d4f17f5f0..01a040071 100644 --- a/server/core/internal/modules.h +++ b/server/core/internal/modules.h @@ -19,7 +19,6 @@ #include #include #include -#include #include MXS_BEGIN_DECLS @@ -85,13 +84,6 @@ void printModules(); */ void dprintAllModules(DCB *); -/** - * @brief Return a resultset that has the current set of modules in it - * - * @return A Result set - */ -RESULTSET *moduleGetList(); - typedef struct mxs_module_iterator { const char* type; diff --git a/server/core/internal/modules.hh b/server/core/internal/modules.hh new file mode 100644 index 000000000..40ca2efd5 --- /dev/null +++ b/server/core/internal/modules.hh @@ -0,0 +1,24 @@ +#pragma once +/* + * Copyright (c) 2016 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. + */ + +#include "modules.h" + +#include + +/** + * @brief Return a resultset that has the current set of modules in it + * + * @return A Result set + */ +ResultSet *moduleGetList(); diff --git a/server/core/internal/monitor.h b/server/core/internal/monitor.h index 0d41405d5..adfdf4152 100644 --- a/server/core/internal/monitor.h +++ b/server/core/internal/monitor.h @@ -81,7 +81,6 @@ void monitor_show(DCB *, MXS_MONITOR *); void monitor_show_all(DCB *); void monitor_list(DCB *); -RESULTSET *monitor_get_list(); bool monitor_add_server(MXS_MONITOR *mon, SERVER *server); void monitor_remove_server(MXS_MONITOR *mon, SERVER *server); diff --git a/server/core/internal/monitor.hh b/server/core/internal/monitor.hh new file mode 100644 index 000000000..e8f579047 --- /dev/null +++ b/server/core/internal/monitor.hh @@ -0,0 +1,23 @@ +#pragma once +/* + * Copyright (c) 2016 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. + */ + +/** + * Internal header for the monitor type + */ + +#include "monitor.h" + +#include + +ResultSet *monitor_get_list(); diff --git a/server/core/internal/poll.h b/server/core/internal/poll.h index 30a5f59b5..64dd9db56 100644 --- a/server/core/internal/poll.h +++ b/server/core/internal/poll.h @@ -18,7 +18,7 @@ #include -#include +#include MXS_BEGIN_DECLS @@ -42,6 +42,6 @@ void dShowThreads(DCB *dcb); void dShowEventQ(DCB *dcb); void dShowEventStats(DCB *dcb); -RESULTSET *eventTimesGetList(); +ResultSet *eventTimesGetList(); MXS_END_DECLS diff --git a/server/core/internal/server.hh b/server/core/internal/server.hh new file mode 100644 index 000000000..35e8d5bda --- /dev/null +++ b/server/core/internal/server.hh @@ -0,0 +1,21 @@ +#pragma once +/* + * Copyright (c) 2016 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. + */ + +/** + * Internal header for the server type + */ + +#include + +ResultSet* serverGetList(); diff --git a/server/core/internal/service.hh b/server/core/internal/service.hh index 60a6ac7e5..40b727ed6 100644 --- a/server/core/internal/service.hh +++ b/server/core/internal/service.hh @@ -13,6 +13,7 @@ */ #include +#include /** * @file service.h - MaxScale internal service functions @@ -351,3 +352,6 @@ json_t* service_relations_to_server(const SERVER* server, const char* host); * @return Array of service links */ json_t* service_relations_to_filter(const MXS_FILTER_DEF* filter, const char* host); + +ResultSet* serviceGetList(void); +ResultSet* serviceGetListenerList(void); diff --git a/server/core/internal/session.h b/server/core/internal/session.h index 92b300c70..c1339a26a 100644 --- a/server/core/internal/session.h +++ b/server/core/internal/session.h @@ -59,8 +59,6 @@ void session_link_backend_dcb(MXS_SESSION *session, struct dcb *dcb); */ void session_unlink_backend_dcb(MXS_SESSION *session, struct dcb *dcb); -RESULTSET *sessionGetList(SESSIONLISTFILTER); - void printAllSessions(); void printSession(MXS_SESSION *); diff --git a/server/core/internal/session.hh b/server/core/internal/session.hh index a403861a0..25039941d 100644 --- a/server/core/internal/session.hh +++ b/server/core/internal/session.hh @@ -14,6 +14,8 @@ #include #include +#include +#include namespace maxscale { @@ -37,3 +39,5 @@ struct RegistryTraits }; } + +ResultSet *sessionGetList(); diff --git a/server/modules/routing/maxinfo/maxinfo.h b/server/modules/routing/maxinfo/maxinfo.h index 81905246b..ea27c7757 100644 --- a/server/modules/routing/maxinfo/maxinfo.h +++ b/server/modules/routing/maxinfo/maxinfo.h @@ -32,8 +32,7 @@ #include #include #include - -MXS_BEGIN_DECLS +#include struct maxinfo_session; @@ -137,9 +136,7 @@ extern void maxinfo_free_tree(MAXINFO_TREE *); extern void maxinfo_execute(DCB *, MAXINFO_TREE *); extern void maxinfo_send_error(DCB *, int, const char *); extern void maxinfo_send_parse_error(DCB *, char *, PARSE_ERROR); -extern RESULTSET *maxinfo_variables(); -extern RESULTSET *maxinfo_status(); - -MXS_END_DECLS +extern ResultSet *maxinfo_variables(); +extern ResultSet *maxinfo_status(); #endif