db/DatabasePlugin: add #EventLoop parameter documentation
This commit is contained in:
parent
0b93f52ba4
commit
7e76656a18
@ -28,7 +28,8 @@
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
Database *
|
||||
CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener)
|
||||
CreateConfiguredDatabase(EventLoop &main_event_loop,
|
||||
DatabaseListener &listener)
|
||||
{
|
||||
const auto *param = config_get_block(ConfigBlockOption::DATABASE);
|
||||
const auto *path = config_get_param(ConfigOption::DB_FILE);
|
||||
@ -38,11 +39,13 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener)
|
||||
param->line, path->line);
|
||||
|
||||
if (param != nullptr)
|
||||
return DatabaseGlobalInit(loop, listener, *param);
|
||||
return DatabaseGlobalInit(main_event_loop,
|
||||
listener, *param);
|
||||
else if (path != nullptr) {
|
||||
ConfigBlock block(path->line);
|
||||
block.AddBlockParam("path", path->value.c_str(), path->line);
|
||||
return DatabaseGlobalInit(loop, listener, block);
|
||||
return DatabaseGlobalInit(main_event_loop,
|
||||
listener, block);
|
||||
} else {
|
||||
/* if there is no override, use the cache directory */
|
||||
|
||||
@ -58,6 +61,7 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener)
|
||||
|
||||
ConfigBlock block;
|
||||
block.AddBlockParam("path", db_file_utf8.c_str(), -1);
|
||||
return DatabaseGlobalInit(loop, listener, block);
|
||||
return DatabaseGlobalInit(main_event_loop,
|
||||
listener, block);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ class Database;
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
Database *
|
||||
CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener);
|
||||
CreateConfiguredDatabase(EventLoop &main_event_loop,
|
||||
DatabaseListener &listener);
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include "DatabasePlugin.hxx"
|
||||
|
||||
Database *
|
||||
DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
|
||||
DatabaseGlobalInit(EventLoop &main_event_loop,
|
||||
DatabaseListener &listener,
|
||||
const ConfigBlock &block)
|
||||
{
|
||||
const char *plugin_name =
|
||||
@ -38,7 +39,7 @@ DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
|
||||
plugin_name);
|
||||
|
||||
try {
|
||||
return plugin->create(loop, listener, block);
|
||||
return plugin->create(main_event_loop, listener, block);
|
||||
} catch (...) {
|
||||
std::throw_with_nested(FormatRuntimeError("Failed to initialize database plugin '%s'",
|
||||
plugin_name));
|
||||
|
@ -35,7 +35,8 @@ class Database;
|
||||
* @param block the database configuration block
|
||||
*/
|
||||
Database *
|
||||
DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
|
||||
DatabaseGlobalInit(EventLoop &main_event_loop,
|
||||
DatabaseListener &listener,
|
||||
const ConfigBlock &block);
|
||||
|
||||
#endif
|
||||
|
@ -46,8 +46,12 @@ struct DatabasePlugin {
|
||||
* Allocates and configures a database.
|
||||
*
|
||||
* Throws #std::runtime_error on error.
|
||||
*
|
||||
* @param main_event_loop the #EventLoop running in the same
|
||||
* thread which invokes #Database methods
|
||||
*/
|
||||
Database *(*create)(EventLoop &loop, DatabaseListener &listener,
|
||||
Database *(*create)(EventLoop &main_event_loop,
|
||||
DatabaseListener &listener,
|
||||
const ConfigBlock &block);
|
||||
|
||||
constexpr bool RequireStorage() const {
|
||||
|
Loading…
Reference in New Issue
Block a user