Commit a9fefcf6 authored by Max Kellermann's avatar Max Kellermann

Main: wrap the Storage instance in CompositeStorage

parent 59ce67e2
...@@ -63,6 +63,10 @@ struct Instance final ...@@ -63,6 +63,10 @@ struct Instance final
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
Database *database; Database *database;
/**
* This is really a #CompositeStorage. To avoid heavy include
* dependencies, we declare it as just #Storage.
*/
Storage *storage; Storage *storage;
UpdateService *update; UpdateService *update;
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include "db/DatabaseSimple.hxx" #include "db/DatabaseSimple.hxx"
#include "db/plugins/SimpleDatabasePlugin.hxx" #include "db/plugins/SimpleDatabasePlugin.hxx"
#include "storage/Configured.hxx" #include "storage/Configured.hxx"
#include "storage/CompositeStorage.hxx"
#endif #endif
#ifdef ENABLE_NEIGHBOR_PLUGINS #ifdef ENABLE_NEIGHBOR_PLUGINS
...@@ -148,8 +149,16 @@ glue_mapper_init(Error &error) ...@@ -148,8 +149,16 @@ glue_mapper_init(Error &error)
static bool static bool
InitStorage(Error &error) InitStorage(Error &error)
{ {
instance->storage = CreateConfiguredStorage(error); Storage *storage = CreateConfiguredStorage(error);
if (storage == nullptr)
return !error.IsDefined(); return !error.IsDefined();
assert(!error.IsDefined());
CompositeStorage *composite = new CompositeStorage();
instance->storage = composite;
composite->Mount("", storage);
return true;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment