Add more session command related functions to Backend

The class now allows simpler construction of session commands by
overloading the add_session_command with a version that accepts a const
reference to a shared pointer. This removes the need to copy the
references to the source buffer by calling gwbuf_clone.

Exposed the first session command as a const reference to allow
interaction with it. Currently, it is planned to be used to get the
session command position of each backend.
This commit is contained in:
Markus Mäkelä
2017-06-15 20:10:34 +03:00
parent 15ef274178
commit 1f31cfdfd7
2 changed files with 26 additions and 0 deletions

View File

@ -73,6 +73,7 @@ public:
* the session command is completed
*/
void add_session_command(GWBUF* buffer, uint64_t sequence);
void add_session_command(const SSessionCommand& sescmd);
/**
* @brief Mark the current session command as successfully executed
@ -90,6 +91,20 @@ public:
*/
size_t session_command_count() const;
/**
* @brief Get the first session command
*
* Returns the first session command in the list of session commands
* to be executed.
*
* This should only be called when at least one session command has been
* added to the backend. If no session commands have been added, behavior
* is undefined.
*
* @return The first session command
*/
const SSessionCommand& next_session_command() const;
/**
* @brief Get pointer to server reference
*