1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-04-27 18:56:49 +03:00
wsrep-lib/test/mock_client_state.cpp
Teemu Ollakka 3b3429d8df Work around GCC 12 warning of uninitialized use
Use pointers to pass state objects to service constructors
to work around GCC 12 warning

  error: member ‘wsrep::mock_storage_service::client_state_’
  is used uninitialized
2023-02-27 13:32:55 +02:00

50 lines
1.4 KiB
C++

/*
* Copyright (C) 2018 Codership Oy <info@codership.com>
*
* This file is part of wsrep-lib.
*
* Wsrep-lib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Wsrep-lib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with wsrep-lib. If not, see <https://www.gnu.org/licenses/>.
*/
#include "wsrep/transaction.hpp"
#include "mock_client_state.hpp"
#include "mock_high_priority_service.hpp"
int wsrep::mock_client_service::bf_rollback()
{
int ret(0);
if (client_state_->before_rollback())
{
ret = 1;
}
else if (client_state_->after_rollback())
{
ret = 1;
}
return ret;
}
enum wsrep::provider::status
wsrep::mock_client_service::replay()
{
wsrep::mock_high_priority_service hps(client_state_->server_state(),
client_state_, true);
enum wsrep::provider::status ret(
client_state_->provider().replay(
client_state_->transaction().ws_handle(),
&hps));
++replays_;
return ret;
}