MXS-1220: Make the parameters of the diagnostic entry points const

The diagnostic entry points should not modify the state of the object
being diagnosed.
This commit is contained in:
Markus Mäkelä 2017-04-19 21:56:05 +03:00 committed by Markus Mäkelä
parent c17c451fb5
commit 076599ee5e
45 changed files with 78 additions and 78 deletions

View File

@ -572,7 +572,7 @@ static MXS_ROUTER_SESSION* newSession(MXS_ROUTER* instance, MXS_SESSION* session
static void closeSession(MXS_ROUTER* instance, MXS_ROUTER_SESSION* session);
static void freeSession(MXS_ROUTER* instance, MXS_ROUTER_SESSION* session);
static int routeQuery(MXS_ROUTER* instance, MXS_ROUTER_SESSION* session, GWBUF* querybuf);
static json_t* diagnostics(MXS_ROUTER* instance);
static json_t* diagnostics(const MXS_ROUTER* instance);
static void clientReply(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session,
GWBUF* resultbuf, DCB* backend_dcb);
static void handleError(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session,
@ -759,9 +759,9 @@ static int routeQuery(MXS_ROUTER* instance, MXS_ROUTER_SESSION* session, GWBUF*
* @param instance The router instance
* @param dcb The DCB for diagnostic output
*/
static json_t* diagnostics(MXS_ROUTER* instance)
static json_t* diagnostics(const MXS_ROUTER* instance)
{
RRRouter* router = static_cast<RRRouter*>(instance);
const RRRouter* router = static_cast<const RRRouter*>(instance);
json_t* rval = json_object();
json_object_set_new(rval, "queries_ok", json_integer(router->m_routing_s));

View File

@ -35,7 +35,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
static void destroyInstance(MXS_FILTER *instance);
@ -221,7 +221,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
* @param fsession Filter session, may be NULL
* @param dcb The DCB for diagnostic output
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
return NULL;
}

View File

@ -21,7 +21,7 @@ static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session);
static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session, GWBUF *queue);
static void clientReply(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session, GWBUF *queue, DCB*);
static json_t* diagnostic(MXS_ROUTER *instance);
static json_t* diagnostic(const MXS_ROUTER *instance);
static uint64_t getCapabilities(MXS_ROUTER* instance);
static void handleError(MXS_ROUTER *instance,
MXS_ROUTER_SESSION *router_session,
@ -145,7 +145,7 @@ void clientReply(MXS_ROUTER* instance, MXS_ROUTER_SESSION* session, GWBUF* queue
* @param instance The router instance
* @param dcb The DCB for diagnostic output
*/
static json_t* diagnostic(MXS_ROUTER *instance)
static json_t* diagnostic(const MXS_ROUTER *instance)
{
return NULL;
}

View File

@ -95,7 +95,7 @@ typedef struct mxs_authenticator
*
* @see jansson.h
*/
json_t* (*diagnostic)(struct servlistener *listener);
json_t* (*diagnostic)(const struct servlistener *listener);
/** This entry point was added to avoid calling authenticator functions
* directly when a COM_CHANGE_USER command is executed. */

View File

@ -180,7 +180,7 @@ typedef struct mxs_filter_object
*
* @see jansson.h
*/
json_t* (*diagnostics)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
json_t* (*diagnostics)(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
/**
* @brief Called to obtain the capabilities of the filter

View File

@ -145,7 +145,7 @@ public:
/**
* Called for obtaining diagnostics about the filter session.
*/
json_t* diagnostics();
json_t* diagnostics() const;
protected:
FilterSession(MXS_SESSION* pSession);
@ -272,19 +272,19 @@ public:
return rv;
}
static json_t* diagnostics(MXS_FILTER* pInstance, MXS_FILTER_SESSION* pData)
static json_t* diagnostics(const MXS_FILTER* pInstance, const MXS_FILTER_SESSION* pData)
{
json_t* rval = NULL;
if (pData)
{
FilterSessionType* pFilterSession = static_cast<FilterSessionType*>(pData);
const FilterSessionType* pFilterSession = static_cast<const FilterSessionType*>(pData);
MXS_EXCEPTION_GUARD(rval = pFilterSession->diagnostics());
}
else
{
FilterType* pFilter = static_cast<FilterType*>(pInstance);
const FilterType* pFilter = static_cast<const FilterType*>(pInstance);
MXS_EXCEPTION_GUARD(rval = pFilter->diagnostics());
}

View File

@ -154,7 +154,7 @@ typedef struct mxs_router_object
*
* @see jansson.h
*/
json_t* (*diagnostics)(MXS_ROUTER *instance);
json_t* (*diagnostics)(const MXS_ROUTER *instance);
/**
* @brief Called for each reply packet

View File

@ -173,9 +173,9 @@ public:
return rv;
}
static json_t* diagnostics(MXS_ROUTER* pInstance)
static json_t* diagnostics(const MXS_ROUTER* pInstance)
{
RouterType* pRouter = static_cast<RouterType*>(pInstance);
const RouterType* pRouter = static_cast<const RouterType*>(pInstance);
json_t* rval = NULL;

View File

@ -117,7 +117,7 @@ int users_default_loadusers(SERV_LISTENER *port);
*
* @param port Port whose data is to be printed
*/
json_t* users_default_diagnostic(SERV_LISTENER *port);
json_t* users_default_diagnostic(const SERV_LISTENER *port);
/**
* Print details of the users storage mechanism

View File

@ -585,7 +585,7 @@ int FilterSession::clientReply(GWBUF* pPacket)
return m_up.clientReply(pPacket);
}
json_t* FilterSession::diagnostics()
json_t* FilterSession::diagnostics() const
{
return NULL;
}

View File

@ -109,7 +109,7 @@ void usersPrint(const USERS *users)
hashtable_stats(users->data);
}
json_t* users_default_diagnostic(SERV_LISTENER *port)
json_t* users_default_diagnostic(const SERV_LISTENER *port)
{
json_t* rval = json_array();

View File

@ -58,7 +58,7 @@ static int mysql_auth_set_client_data(
MySQLProtocol *protocol,
GWBUF *buffer);
json_t* mysql_auth_diagnostic(SERV_LISTENER *port);
json_t* mysql_auth_diagnostic(const SERV_LISTENER *port);
int mysql_auth_reauthenticate(DCB *dcb, const char *user,
uint8_t *token, size_t token_len,
@ -691,7 +691,7 @@ int diag_cb(void *data, int columns, char **row, char **field_names)
return 0;
}
json_t* mysql_auth_diagnostic(SERV_LISTENER *port)
json_t* mysql_auth_diagnostic(const SERV_LISTENER *port)
{
json_t* rval = json_array();

View File

@ -306,7 +306,7 @@ CacheFilterSession* CacheFilter::newSession(MXS_SESSION* pSession)
}
// static
json_t* CacheFilter::diagnostics()
json_t* CacheFilter::diagnostics() const
{
return m_sCache->show();
}

View File

@ -37,7 +37,7 @@ public:
CacheFilterSession* newSession(MXS_SESSION* pSession);
json_t* diagnostics();
json_t* diagnostics() const;
uint64_t getCapabilities();

View File

@ -447,7 +447,7 @@ int CacheFilterSession::clientReply(GWBUF* pData)
return rv;
}
json_t* CacheFilterSession::diagnostics()
json_t* CacheFilterSession::diagnostics() const
{
// Not printing anything. Session of the same instance share the same cache, in
// which case the same information would be printed once per session, or all

View File

@ -83,7 +83,7 @@ public:
/**
* Print diagnostics of the session cache.
*/
json_t* diagnostics();
json_t* diagnostics() const;
private:
int handle_expecting_fields();

View File

@ -55,7 +55,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
#define CCR_DEFAULT_TIME "60"
@ -358,7 +358,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
* @param fsession Filter session, may be NULL
* @param dcb The DCB for diagnostic output
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
CCR_INSTANCE *my_instance = (CCR_INSTANCE *)instance;
json_t* rval = json_object();

View File

@ -101,7 +101,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
/**
@ -2504,7 +2504,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
* @param dcb The DCB for diagnostic output
*/
static json_t*
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
return rules_to_json(thr_rules);
}

View File

@ -32,7 +32,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
/**
@ -222,7 +222,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
* @param fsession Filter session, may be NULL
*/
static json_t*
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
return NULL;
}

View File

@ -37,7 +37,7 @@ static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_UPSTREAM *upstream);
static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER *instance);
static int32_t clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GWBUF *reply);
static bool extract_insert_target(GWBUF *buffer, char* target, int len);
@ -498,7 +498,7 @@ static int32_t clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GW
* @param instance The filter instance
* @param fsession Filter session, may be NULL
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
DS_INSTANCE *my_instance = (DS_INSTANCE*)instance;

View File

@ -63,7 +63,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, M
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int32_t clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER *instance);
/**
@ -624,7 +624,7 @@ static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWB
* @param instance The filter instance
* @param fsession Filter session, may be NULL
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
LUA_INSTANCE *my_instance = (LUA_INSTANCE *)instance;
json_t* rval = json_object();

View File

@ -138,7 +138,7 @@ MaskingFilterSession* MaskingFilter::newSession(MXS_SESSION* pSession)
}
// static
json_t* MaskingFilter::diagnostics()
json_t* MaskingFilter::diagnostics() const
{
return NULL;
}

View File

@ -33,7 +33,7 @@ public:
MaskingFilterSession* newSession(MXS_SESSION* pSession);
json_t* diagnostics();
json_t* diagnostics() const;
uint64_t getCapabilities();

View File

@ -67,8 +67,8 @@ static int routeQuery(MXS_FILTER *instance,
static int clientReply(MXS_FILTER *instance,
MXS_FILTER_SESSION *sdata,
GWBUF *queue);
static json_t* diagnostics(MXS_FILTER *instance,
MXS_FILTER_SESSION *sdata);
static json_t* diagnostics(const MXS_FILTER *instance,
const MXS_FILTER_SESSION *sdata);
static uint64_t getCapabilities(MXS_FILTER *instance);
enum maxrows_return_mode
@ -487,7 +487,7 @@ static int clientReply(MXS_FILTER *instance,
* @param fsession Filter session, may be NULL
* @param dcb The DCB for diagnostic output
*/
static json_t* diagnostics(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata)
static json_t* diagnostics(const MXS_FILTER *instance, const MXS_FILTER_SESSION *sdata)
{
return NULL;
}

View File

@ -94,7 +94,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MX
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER *instance);
/**
@ -1484,7 +1484,7 @@ static int clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GWBUF
* @param fsession Filter session, may be NULL
*/
static json_t*
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
MQ_INSTANCE *my_instance = (MQ_INSTANCE*)instance;
json_t* rval = json_object();

View File

@ -311,7 +311,7 @@ RegexHintFilter::create(const char* name, char** options, MXS_CONFIG_PARAMETER*
*
* @param dcb The DCB for diagnostic output
*/
json_t* RegexHintFSession::diagnostics()
json_t* RegexHintFSession::diagnostics() const
{
json_t* rval = m_fil_inst.diagnostics(); /* Print overall diagnostics */
@ -329,7 +329,7 @@ json_t* RegexHintFSession::diagnostics()
*
* @param dcb The DCB for diagnostic output
*/
json_t* RegexHintFilter::diagnostics()
json_t* RegexHintFilter::diagnostics() const
{
json_t* rval = json_object();
@ -340,12 +340,12 @@ json_t* RegexHintFilter::diagnostics()
{
json_t* arr = json_array();
for (MappingArray::iterator it = m_mapping.begin(); it != m_mapping.end(); it++)
for (MappingArray::const_iterator it = m_mapping.begin(); it != m_mapping.end(); it++)
{
json_t* obj = json_object();
json_t* targets = json_array();
for (StringArray::iterator it2 = it->m_targets.begin(); it2 != it->m_targets.end(); it2++)
for (StringArray::const_iterator it2 = it->m_targets.begin(); it2 != it->m_targets.end(); it2++)
{
json_array_append_new(targets, json_string(it2->c_str()));
}

View File

@ -57,7 +57,7 @@ public:
static RegexHintFilter* create(const char* zName, char** pzOptions,
MXS_CONFIG_PARAMETER* ppParams);
RegexHintFSession* newSession(MXS_SESSION *session);
json_t* diagnostics();
json_t* diagnostics() const;
uint64_t getCapabilities();
const RegexToServers* find_servers(char* sql, int sql_len, pcre2_match_data* mdata);
@ -86,7 +86,7 @@ public:
pcre2_match_data* md);
~RegexHintFSession();
json_t* diagnostics();
json_t* diagnostics() const;
int routeQuery(GWBUF* buffer);
};

View File

@ -142,7 +142,7 @@ NullFilterSession* NullFilter::newSession(MXS_SESSION* pSession)
}
// static
json_t* NullFilter::diagnostics()
json_t* NullFilter::diagnostics() const
{
return NULL;
}

View File

@ -24,7 +24,7 @@ public:
NullFilterSession* newSession(MXS_SESSION* pSession);
json_t* diagnostics();
json_t* diagnostics() const;
uint64_t getCapabilities();

View File

@ -81,7 +81,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
/**
@ -579,7 +579,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
* @param instance The filter instance
* @param fsession Filter session, may be NULL
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
QLA_INSTANCE *my_instance = (QLA_INSTANCE*)instance;
QLA_SESSION *my_session = (QLA_SESSION*)fsession;

View File

@ -48,7 +48,7 @@ static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
static char *regex_replace(const char *sql, pcre2_code *re, pcre2_match_data *study,
@ -377,7 +377,7 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
* @param instance The filter instance
* @param fsession Filter session, may be NULL
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
REGEX_INSTANCE *my_instance = (REGEX_INSTANCE*)instance;
REGEX_SESSION *my_session = (REGEX_SESSION*)fsession;

View File

@ -106,7 +106,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MX
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
/**
@ -698,7 +698,7 @@ clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION *session, GWBUF *reply)
* @param instance The filter instance
* @param fsession Filter session, may be NULL
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
TEE_INSTANCE *my_instance = (TEE_INSTANCE*)instance;
TEE_SESSION *my_session = (TEE_SESSION*)fsession;

View File

@ -58,7 +58,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MX
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
/**
@ -574,7 +574,7 @@ clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *reply)
* @param instance The filter instance
* @param fsession Filter session, may be NULL
*/
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
TOPN_INSTANCE *my_instance = (TOPN_INSTANCE*)instance;
TOPN_SESSION *my_session = (TOPN_SESSION*)fsession;

View File

@ -85,7 +85,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static json_t* diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
static json_t* diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession);
static uint64_t getCapabilities(MXS_FILTER* instance);
static void checkNamedPipe(void *args);
@ -574,7 +574,7 @@ clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *reply)
* @param fsession Filter session, may be NULL
*/
static json_t*
diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession)
diagnostic(const MXS_FILTER *instance, const MXS_FILTER_SESSION *fsession)
{
TPM_INSTANCE *my_instance = (TPM_INSTANCE*)instance;

View File

@ -76,7 +76,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static void clientReply(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue,
DCB *backend_dcb);
static void errorReply(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *message,
@ -807,7 +807,7 @@ routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queu
*
* @param instance Instance of the router
*/
static json_t* diagnostics(MXS_ROUTER *router)
static json_t* diagnostics(const MXS_ROUTER *router)
{
AVRO_INSTANCE *router_inst = (AVRO_INSTANCE *)router;

View File

@ -95,7 +95,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *sessio
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static void clientReply(MXS_ROUTER *instance,
MXS_ROUTER_SESSION *router_session,
GWBUF *queue,
@ -1287,7 +1287,7 @@ spin_reporter(void *dcb, char *desc, int value)
* @param instance Instance of the router
* @param dcb DCB to send diagnostics to
*/
static json_t* diagnostics(MXS_ROUTER *router)
static json_t* diagnostics(const MXS_ROUTER *router)
{
ROUTER_INSTANCE *router_inst = (ROUTER_INSTANCE *)router;
int minno = 0;

View File

@ -48,7 +48,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *sessio
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static int execute(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static uint64_t getCapabilities(MXS_ROUTER* instance);
extern int execute_cmd(CLI_SESSION *cli);
@ -284,7 +284,7 @@ execute(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue)
* @param instance Instance of the router
* @param dcb DCB to send diagnostics to
*/
static json_t* diagnostics(MXS_ROUTER *instance)
static json_t* diagnostics(const MXS_ROUTER *instance)
{
return NULL;
}

View File

@ -47,7 +47,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *sessio
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static int execute(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static uint64_t getCapabilities(MXS_ROUTER* instance);
extern int execute_cmd(CLI_SESSION *cli);
@ -287,7 +287,7 @@ execute(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue)
* @param instance Instance of the router
* @param dcb DCB to send diagnostics to
*/
static json_t* diagnostics(MXS_ROUTER *instance)
static json_t* diagnostics(const MXS_ROUTER *instance)
{
return NULL;
}

View File

@ -144,7 +144,7 @@ HintRouterSession* HintRouter::newSession(MXS_SESSION *pSession)
return rval;
}
json_t* HintRouter::diagnostics()
json_t* HintRouter::diagnostics() const
{
HR_ENTRY();

View File

@ -22,7 +22,7 @@ class HintRouter : public maxscale::Router<HintRouter, HintRouterSession>
public:
static HintRouter* create(SERVICE* pService, char** pzOptions);
HintRouterSession* newSession(MXS_SESSION *pSession);
json_t* diagnostics();
json_t* diagnostics() const;
uint64_t getCapabilities() const
{
return RCAP_TYPE_NONE;

View File

@ -69,7 +69,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *sessio
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static int execute(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static uint64_t getCapabilities(MXS_ROUTER* instance);
static void handleError(MXS_ROUTER *instance,
MXS_ROUTER_SESSION *router_session,
@ -369,7 +369,7 @@ execute(MXS_ROUTER *rinstance, MXS_ROUTER_SESSION *router_session, GWBUF *queue)
* @param dcb DCB to send diagnostics to
*/
static json_t*
diagnostics(MXS_ROUTER *instance)
diagnostics(const MXS_ROUTER *instance)
{
return NULL;
}

View File

@ -93,7 +93,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static void clientReply(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue,
DCB *backend_dcb);
static void handleError(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *errbuf,
@ -615,7 +615,7 @@ return_rc:
* @param instance Instance of the router
* @param dcb DCB to send diagnostics to
*/
static json_t* diagnostics(MXS_ROUTER *router)
static json_t* diagnostics(const MXS_ROUTER *router)
{
ROUTER_INSTANCE *router_inst = (ROUTER_INSTANCE *)router;
json_t* rval = json_object();

View File

@ -74,7 +74,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session);
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session);
static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session, GWBUF *queue);
static json_t* diagnostics(MXS_ROUTER *instance);
static json_t* diagnostics(const MXS_ROUTER *instance);
static void clientReply(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *queue,
DCB *backend_dcb);
static void handleError(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session,
@ -646,7 +646,7 @@ static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session,
* @param instance The router instance
* @param dcb The DCB for diagnostic output
*/
static json_t* diagnostics(MXS_ROUTER *instance)
static json_t* diagnostics(const MXS_ROUTER *instance)
{
ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)instance;

View File

@ -302,7 +302,7 @@ SchemaRouterSession* SchemaRouter::newSession(MXS_SESSION* pSession)
return rval;
}
json_t* SchemaRouter::diagnostics()
json_t* SchemaRouter::diagnostics() const
{
double sescmd_pct = m_stats.n_sescmd != 0 ?
100.0 * ((double)m_stats.n_sescmd / (double)m_stats.n_queries) :

View File

@ -37,7 +37,7 @@ public:
~SchemaRouter();
static SchemaRouter* create(SERVICE* pService, char** pzOptions);
SchemaRouterSession* newSession(MXS_SESSION* pSession);
json_t* diagnostics();
json_t* diagnostics() const;
uint64_t getCapabilities();
private: