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:
@ -116,6 +116,11 @@ void Backend::add_session_command(GWBUF* buffer, uint64_t sequence)
|
||||
m_session_commands.push_back(SSessionCommand(new SessionCommand(buffer, sequence)));
|
||||
}
|
||||
|
||||
void Backend::add_session_command(const SSessionCommand& sescmd)
|
||||
{
|
||||
m_session_commands.push_back(sescmd);
|
||||
}
|
||||
|
||||
uint64_t Backend::complete_session_command()
|
||||
{
|
||||
uint64_t rval = m_session_commands.front()->get_position();
|
||||
@ -128,6 +133,12 @@ size_t Backend::session_command_count() const
|
||||
return m_session_commands.size();
|
||||
}
|
||||
|
||||
const SSessionCommand& Backend::next_session_command() const
|
||||
{
|
||||
ss_dassert(session_command_count() > 0);
|
||||
return m_session_commands.front();
|
||||
}
|
||||
|
||||
void Backend::clear_state(backend_state state)
|
||||
{
|
||||
if ((state & WAITING_RESULT) && (m_state & WAITING_RESULT))
|
||||
|
Reference in New Issue
Block a user