1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-30 07:23:07 +03:00

Change provider_options callback to take a const reference

This commit is contained in:
Daniele Sciascia
2025-05-20 08:41:18 +02:00
parent adf464474d
commit 450851a176
5 changed files with 15 additions and 13 deletions

View File

@ -526,12 +526,13 @@ namespace wsrep
* @param provider_options Initial options to provider * @param provider_options Initial options to provider
* @param thread_service Optional thread service implementation. * @param thread_service Optional thread service implementation.
*/ */
static std::unique_ptr<provider> make_provider( static std::unique_ptr<provider>
wsrep::server_state&, make_provider(wsrep::server_state&, const std::string& provider_spec,
const std::string& provider_spec, const std::function<std::string(const provider_options&)>&
const std::function<std::string(provider_options&)>& provider_options_cb, provider_options_cb,
const wsrep::provider::services& services const wsrep::provider::services& services
= wsrep::provider::services()); = wsrep::provider::services());
protected: protected:
wsrep::server_state& server_state_; wsrep::server_state& server_state_;
}; };

View File

@ -297,7 +297,7 @@ namespace wsrep
* @return Zero on success, non-zero on error. * @return Zero on success, non-zero on error.
*/ */
int load_provider(const std::string& provider, int load_provider(const std::string& provider,
const std::function<std::string(provider_options&)>&, const std::function<std::string(const provider_options&)>&,
const wsrep::provider::services& services const wsrep::provider::services& services
= wsrep::provider::services()); = wsrep::provider::services());
@ -320,7 +320,7 @@ namespace wsrep
= wsrep::provider::services()) = wsrep::provider::services())
{ {
return load_provider( return load_provider(
provider, [options](provider_options&) { return options; }, provider, [options](const provider_options&) { return options; },
services); services);
} }

View File

@ -28,9 +28,9 @@
#include <memory> #include <memory>
std::unique_ptr<wsrep::provider> wsrep::provider::make_provider( std::unique_ptr<wsrep::provider> wsrep::provider::make_provider(
wsrep::server_state& server_state, wsrep::server_state& server_state, const std::string& provider_spec,
const std::string& provider_spec, const std::function<std::string(const provider_options&)>&
const std::function<std::string(provider_options&)>& provider_options_cb, provider_options_cb,
const wsrep::provider::services& services) const wsrep::provider::services& services)
{ {
try try

View File

@ -500,7 +500,8 @@ static int apply_toi(wsrep::provider& provider,
int wsrep::server_state::load_provider( int wsrep::server_state::load_provider(
const std::string& provider_spec, const std::string& provider_spec,
const std::function<std::string(provider_options&)>& provider_options_cb, const std::function<std::string(const provider_options&)>&
provider_options_cb,
const wsrep::provider::services& services) const wsrep::provider::services& services)
{ {
wsrep::log_info() << "Loading provider " << provider_spec wsrep::log_info() << "Loading provider " << provider_spec

View File

@ -263,7 +263,7 @@ namespace wsrep
{ {
set_provider_factory( set_provider_factory(
[&](wsrep::server_state&, const std::string&, [&](wsrep::server_state&, const std::string&,
const std::function<std::string(wsrep::provider_options&)>&, const std::function<std::string(const wsrep::provider_options&)>&,
const wsrep::provider::services&) const wsrep::provider::services&)
{ {
// The provider object is destroyed upon server state // The provider object is destroyed upon server state