From a9fefcf6008cd6dbefdd5bd1b3a49e093ae9dcf5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 9 Feb 2014 07:44:07 +0100 Subject: Main: wrap the Storage instance in CompositeStorage --- src/Instance.hxx | 4 ++++ src/Main.cxx | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Instance.hxx b/src/Instance.hxx index 131a71fc3..fa7711ab9 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -63,6 +63,10 @@ struct Instance final #ifdef ENABLE_DATABASE Database *database; + /** + * This is really a #CompositeStorage. To avoid heavy include + * dependencies, we declare it as just #Storage. + */ Storage *storage; UpdateService *update; diff --git a/src/Main.cxx b/src/Main.cxx index 3a40f0bb0..edd670763 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -71,6 +71,7 @@ #include "db/DatabaseSimple.hxx" #include "db/plugins/SimpleDatabasePlugin.hxx" #include "storage/Configured.hxx" +#include "storage/CompositeStorage.hxx" #endif #ifdef ENABLE_NEIGHBOR_PLUGINS @@ -148,8 +149,16 @@ glue_mapper_init(Error &error) static bool InitStorage(Error &error) { - instance->storage = CreateConfiguredStorage(error); - return !error.IsDefined(); + Storage *storage = CreateConfiguredStorage(error); + if (storage == nullptr) + return !error.IsDefined(); + + assert(!error.IsDefined()); + + CompositeStorage *composite = new CompositeStorage(); + instance->storage = composite; + composite->Mount("", storage); + return true; } /** -- cgit v1.2.3