Skip to content

Commit

Permalink
Several code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
renecannao committed Mar 21, 2024
1 parent 9d788c0 commit 1bc9d9e
Show file tree
Hide file tree
Showing 8 changed files with 1,744 additions and 91 deletions.
39 changes: 36 additions & 3 deletions include/MySQL_Session.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* @file MySQL_Session.h
* @brief Declaration of the MySQL_Session class and associated types and enums.
*/


#ifndef __CLASS_MYSQL_SESSION_H
#define __CLASS_MYSQL_SESSION_H

Expand All @@ -13,6 +19,10 @@ using json = nlohmann::json;

extern class MySQL_Variables mysql_variables;

/**
* @enum proxysql_session_type
* @brief Defines the types of ProxySQL sessions.
*/
enum proxysql_session_type {
PROXYSQL_SESSION_MYSQL,
PROXYSQL_SESSION_ADMIN,
Expand All @@ -24,6 +34,10 @@ enum proxysql_session_type {
PROXYSQL_SESSION_NONE
};

/**
* @enum ps_type
* @brief Defines types for prepared statement handling.
*/
enum ps_type : uint8_t {
ps_type_not_set = 0x0,
ps_type_prepare_stmt = 0x1,
Expand All @@ -32,9 +46,14 @@ enum ps_type : uint8_t {

std::string proxysql_session_type_str(enum proxysql_session_type session_type);

// these structs will be used for various regex hardcoded
// their initial use will be for sql_log_bin , sql_mode and time_zone
// issues #509 , #815 and #816
/**
* @class Session_Regex
* @brief Encapsulates regex operations for session handling.
*
* This class is used for matching patterns in SQL queries, specifically for
* settings like sql_log_bin, sql_mode, and time_zone.
* See issues #509 , #815 and #816
*/
class Session_Regex {
private:
void *opt;
Expand All @@ -46,6 +65,13 @@ class Session_Regex {
bool match(char *m);
};

/**
* @class Query_Info
* @brief Holds information about a SQL query within a session.
*
* This class encapsulates various details about a query such as its text,
* execution times, affected rows, and more, to facilitate query processing and logging.
*/
class Query_Info {
public:
SQP_par_t QueryParserArgs;
Expand Down Expand Up @@ -84,6 +110,13 @@ class Query_Info {
bool is_select_NOT_for_update();
};

/**
* @class MySQL_Session
* @brief Manages a client session, including query parsing, backend connections, and state transitions.
*
* This class is central to ProxySQL's handling of client connections. It manages the lifecycle
* of a session, processes queries, and communicates with backend MySQL servers.
*/
class MySQL_Session
{
private:
Expand Down
359 changes: 336 additions & 23 deletions lib/MySQL_HostGroups_Manager.cpp

Large diffs are not rendered by default.

Loading

0 comments on commit 1bc9d9e

Please sign in to comment.