1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-02 05:22:26 +03:00

DBMS simulator is now able to start and stop one server

Other:
* Added trrep::condition_variable
* Added trrep::view
This commit is contained in:
Teemu Ollakka
2018-04-19 13:09:36 +03:00
parent 557d43657c
commit 3c6eff581c
13 changed files with 463 additions and 11 deletions

View File

@ -7,6 +7,8 @@
#include <wsrep_api.h>
#include <iostream>
trrep::wsrep_provider_v26::wsrep_provider_v26(
const char* path,
struct wsrep_init_args* args)
@ -21,3 +23,47 @@ trrep::wsrep_provider_v26::wsrep_provider_v26(
throw trrep::runtime_error("Failed to initialize wsrep provider");
}
}
trrep::wsrep_provider_v26::~wsrep_provider_v26()
{
wsrep_unload(wsrep_);
}
int trrep::wsrep_provider_v26::connect(
const std::string& cluster_name,
const std::string& cluster_url,
const std::string& state_donor,
bool bootstrap)
{
int ret(0);
wsrep_status_t wret;
if ((wret = wsrep_->connect(wsrep_,
cluster_name.c_str(),
cluster_url.c_str(),
state_donor.c_str(),
bootstrap)) != WSREP_OK)
{
std::cerr << "Failed to connect cluster: "
<< wret << "\n";
ret = 1;
}
return ret;
}
int trrep::wsrep_provider_v26::disconnect()
{
int ret(0);
wsrep_status_t wret;
if ((wret = wsrep_->disconnect(wsrep_)) != WSREP_OK)
{
std::cerr << "Failed to disconnect from cluster: "
<< wret << "\n";
ret = 1;
}
return ret;
}
wsrep_status_t trrep::wsrep_provider_v26::run_applier(void *applier_ctx)
{
return wsrep_->recv(wsrep_, applier_ctx);
}