1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-28 20:02:00 +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:
Daniele Sciascia
2025-02-19 13:31:52 +02:00
parent 2dc8339ff1
commit 3965d83968
12 changed files with 195 additions and 56 deletions

View File

@ -214,7 +214,7 @@ namespace wsrep
int flags_;
};
provider_options(wsrep::provider&);
provider_options();
provider_options(const provider_options&) = delete;
provider_options& operator=(const provider_options&) = delete;
@ -225,7 +225,7 @@ namespace wsrep
*
* @return Provider status code.
*/
enum wsrep::provider::status initial_options();
enum wsrep::provider::status initial_options(wsrep::provider& provider);
/**
* Get the option with the given name
@ -241,7 +241,8 @@ namespace wsrep
* @return wsrep::provider::error_size_exceeded if memory could
* not be allocated for the new value.
*/
enum wsrep::provider::status set(const std::string& name,
enum wsrep::provider::status set(wsrep::provider& provider,
const std::string& name,
std::unique_ptr<option_value> value);
/**
@ -252,10 +253,15 @@ namespace wsrep
std::unique_ptr<option_value> value,
std::unique_ptr<option_value> default_value, int flags);
void for_each(const std::function<void(option*)>& fn);
/**
* Invoke the given function with each provider option
* as argument.
*
* @param fn Function to call for each option
*/
void for_each(const std::function<void(option*)>& fn) const;
private:
provider& provider_;
using options_map = std::map<std::string, std::unique_ptr<option>>;
options_map options_;
};