db/Configured: use struct ConfigData
This commit is contained in:
parent
4d80419982
commit
426b9672cf
@ -186,7 +186,7 @@ static bool
|
||||
glue_db_init_and_load(const ConfigData &config)
|
||||
{
|
||||
instance->database =
|
||||
CreateConfiguredDatabase(instance->event_loop,
|
||||
CreateConfiguredDatabase(config, instance->event_loop,
|
||||
instance->io_thread.GetEventLoop(),
|
||||
*instance);
|
||||
if (instance->database == nullptr)
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "Configured.hxx"
|
||||
#include "DatabaseGlue.hxx"
|
||||
#include "config/Global.hxx"
|
||||
#include "config/Data.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
@ -28,11 +28,12 @@
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
Database *
|
||||
CreateConfiguredDatabase(EventLoop &main_event_loop, EventLoop &io_event_loop,
|
||||
CreateConfiguredDatabase(const ConfigData &config,
|
||||
EventLoop &main_event_loop, EventLoop &io_event_loop,
|
||||
DatabaseListener &listener)
|
||||
{
|
||||
const auto *param = config_get_block(ConfigBlockOption::DATABASE);
|
||||
const auto *path = config_get_param(ConfigOption::DB_FILE);
|
||||
const auto *param = config.GetBlock(ConfigBlockOption::DATABASE);
|
||||
const auto *path = config.GetParam(ConfigOption::DB_FILE);
|
||||
|
||||
if (param != nullptr && path != nullptr)
|
||||
throw FormatRuntimeError("Found both 'database' (line %d) and 'db_file' (line %d) setting",
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "check.h"
|
||||
|
||||
struct ConfigData;
|
||||
class EventLoop;
|
||||
class DatabaseListener;
|
||||
class Database;
|
||||
@ -34,7 +35,8 @@ class Database;
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
Database *
|
||||
CreateConfiguredDatabase(EventLoop &main_event_loop, EventLoop &io_event_loop,
|
||||
CreateConfiguredDatabase(const ConfigData &config,
|
||||
EventLoop &main_event_loop, EventLoop &io_event_loop,
|
||||
DatabaseListener &listener);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user