MXS-1929: Add Session class

The Session class now contains all of the C++ objects that were previously
in the MXS_SESSION struct. It is also allocated with new but all
initialization is still done outside of the Session in session_alloc_body.

This commit will not compile as it is a part of a set of commits that make
parts of the session private.
This commit is contained in:
Markus Mäkelä
2018-08-03 12:39:54 +03:00
parent 710f2d3c79
commit 945510e735
5 changed files with 58 additions and 86 deletions

View File

@ -13,6 +13,13 @@
*/
#include <maxscale/cppdefs.hh>
#include <deque>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <maxscale/session.h>
#include <maxscale/resultset.hh>
#include <maxscale/utils.hh>
@ -40,4 +47,22 @@ struct RegistryTraits<MXS_SESSION>
}
typedef struct SESSION_VARIABLE
{
session_variable_handler_t handler;
void* context;
} SESSION_VARIABLE;
typedef std::unordered_map<std::string, SESSION_VARIABLE> SessionVarsByName;
typedef std::deque<std::vector<uint8_t>> SessionStmtQueue;
typedef std::unordered_set<DCB*> DCBSet;
class Session: public MXS_SESSION
{
private:
SessionVarsByName m_variables;
SessionStmtQueue m_last_statements; /*< The N last statements by the client */
DCBSet m_dcb_set; /*< Set of associated backend DCBs */
};
std::unique_ptr<ResultSet> sessionGetList();