1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-27 09:01:50 +03:00

Refactored storage service out of client service interface.

This commit is contained in:
Teemu Ollakka
2018-07-07 18:06:37 +03:00
parent a8be09161c
commit 2ac13100f7
31 changed files with 465 additions and 247 deletions

View File

@ -6,24 +6,22 @@
#include "db_high_priority_service.hpp"
#include "db_client.hpp"
db::client_service::client_service(db::client& client)
: wsrep::client_service()
, client_(client)
, client_state_(client_.client_state())
{ }
int db::client_service::commit(const wsrep::ws_handle&,
const wsrep::ws_meta&)
bool db::client_service::do_2pc() const
{
db::client* client(client_state_.client());
int ret(client_state_.before_commit());
if (ret == 0) client->se_trx_.commit();
ret = ret || client_state_.ordered_commit();
ret = ret || client_state_.after_commit();
return ret;
return client_.do_2pc();
}
int db::client_service::bf_rollback()
{
db::client* client(client_state_.client());
int ret(client_state_.before_rollback());
assert(ret == 0);
client->se_trx_.rollback();
client_.se_trx_.rollback();
ret = client_state_.after_rollback();
assert(ret == 0);
return ret;
@ -34,13 +32,13 @@ db::client_service::replay()
{
wsrep::high_priority_context high_priority_context(client_state_);
db::high_priority_service high_priority_service(
client_state_.client()->server_, client_state_.client());
client_.server_, client_);
auto ret(client_state_.provider().replay(
client_state_.transaction().ws_handle(),
&high_priority_service));
if (ret == wsrep::provider::success)
{
++client_state_.client()->stats_.replays;
++client_.stats_.replays;
}
return ret;
}