Replace session command implementation

The schemarouter now uses the new session commands. It uses a standard
library container to manage the execution and storage of session commands.

The session command history is disabled until a more complete refactoring
can be done.
This commit is contained in:
Markus Mäkelä
2017-03-26 11:42:33 +03:00
parent 1ba399a62a
commit bda0fd2db0
4 changed files with 149 additions and 720 deletions

View File

@ -37,6 +37,20 @@ public:
*/
bool is_reply_received() const;
/**
* @brief Get the command type of the session command
*
* @return The type of the command
*/
uint8_t get_command() const;
/**
* @brief Get the position of this session command
*
* @return The position of the session command
*/
uint64_t get_position() const;
/**
* @brief Creates a copy of the internal buffer
* @return A copy of the internal buffer
@ -48,8 +62,9 @@ public:
*
* @param buffer The buffer containing the command. Note that the ownership
* of @c buffer is transferred to this object.
* @param id A unique position identifier used to track replies
*/
SessionCommand(GWBUF *buffer);
SessionCommand(GWBUF *buffer, uint64_t id);
~SessionCommand();
@ -61,8 +76,10 @@ public:
std::string to_string();
private:
Buffer m_buffer; /**< The buffer containing the command */
bool m_replySent; /**< Whether the session command reply has been sent */
Buffer m_buffer; /**< The buffer containing the command */
uint8_t m_command; /**< The command being executed */
uint64_t m_pos; /**< Unique position identifier */
bool m_replySent; /**< Whether the session command reply has been sent */
SessionCommand();
SessionCommand& operator = (const SessionCommand& command);