mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-31 18:24:25 +03:00
Pass callback to get provider options to provider_v26 constructor
Passing a callback allows constructing the options string using config service after loading the provider but before initializing the provider. This way it is possible get options which are given at DBMS startup, in command line or config file.
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
|
||||
#include "wsrep/server_state.hpp"
|
||||
#include "wsrep/server_service.hpp"
|
||||
#include "wsrep/provider_options.hpp"
|
||||
#include "mock_client_state.hpp"
|
||||
#include "mock_high_priority_service.hpp"
|
||||
#include "mock_storage_service.hpp"
|
||||
@ -260,16 +261,17 @@ namespace wsrep
|
||||
, cond_()
|
||||
, provider_()
|
||||
{
|
||||
set_provider_factory([&](wsrep::server_state&,
|
||||
const std::string&,
|
||||
const std::string&,
|
||||
const wsrep::provider::services&)
|
||||
{
|
||||
// The provider object is destroyed upon server state
|
||||
// destruction, so using a raw pointer is safe.
|
||||
provider_ = new wsrep::mock_provider(*this);
|
||||
return std::unique_ptr<wsrep::provider>(provider_);
|
||||
});
|
||||
set_provider_factory(
|
||||
[&](wsrep::server_state&, const std::string&,
|
||||
const std::function<int(const wsrep::provider_options&,
|
||||
std::string&)>&,
|
||||
const wsrep::provider::services&)
|
||||
{
|
||||
// The provider object is destroyed upon server state
|
||||
// destruction, so using a raw pointer is safe.
|
||||
provider_ = new wsrep::mock_provider(*this);
|
||||
return std::unique_ptr<wsrep::provider>(provider_);
|
||||
});
|
||||
|
||||
const int ret WSREP_UNUSED = load_provider("mock", "");
|
||||
assert(ret == 0);
|
||||
|
Reference in New Issue
Block a user