From 36be03af9ccb5ede87f7a5bc3d37526cdc9b2bc4 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 5 Dec 2016 21:59:00 +0100 Subject: Avoid pulling in all of slobrok and config everywhere. --- config/src/vespa/config/common/configcontext.h | 34 +++----------------- config/src/vespa/config/common/iconfigcontext.h | 36 ++++++++++++++++++++++ config/src/vespa/config/subscription/configuri.cpp | 1 + config/src/vespa/config/subscription/configuri.h | 10 +++--- 4 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 config/src/vespa/config/common/iconfigcontext.h (limited to 'config') diff --git a/config/src/vespa/config/common/configcontext.h b/config/src/vespa/config/common/configcontext.h index 6ada928fd5f..20cfbe8711e 100644 --- a/config/src/vespa/config/common/configcontext.h +++ b/config/src/vespa/config/common/configcontext.h @@ -1,39 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include +#include "iconfigcontext.h" #include "timingvalues.h" #include "configmanager.h" #include +#include +#include namespace config { -/** - * A ConfigContext is a context object that can be used to consolidate - * multiple ConfigSubscribers to use the same resources. It also gives the - * ability to reload config for unit testing or if using file configs. - */ -class IConfigContext -{ -public: - typedef std::shared_ptr SP; - - /** - * Get an instance of the config manager. - * - * @return reference to a manager instance. - */ - virtual IConfigManager & getManagerInstance() = 0; - - /** - * Reload config for source provided by this context. - */ - virtual void reload() = 0; - - virtual ~IConfigContext() { } -}; - class ConfigContext : public IConfigContext { public: @@ -43,8 +19,8 @@ public: void reload(); private: - TimingValues _timingValues; - int64_t _generation; + TimingValues _timingValues; + int64_t _generation; ConfigManager _manager; }; diff --git a/config/src/vespa/config/common/iconfigcontext.h b/config/src/vespa/config/common/iconfigcontext.h new file mode 100644 index 00000000000..576dbc3c548 --- /dev/null +++ b/config/src/vespa/config/common/iconfigcontext.h @@ -0,0 +1,36 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include + +namespace config { + +class IConfigManager; + +/** + * A ConfigContext is a context object that can be used to consolidate + * multiple ConfigSubscribers to use the same resources. It also gives the + * ability to reload config for unit testing or if using file configs. + */ +class IConfigContext +{ +public: + typedef std::shared_ptr SP; + + /** + * Get an instance of the config manager. + * + * @return reference to a manager instance. + */ + virtual IConfigManager & getManagerInstance() = 0; + + /** + * Reload config for source provided by this context. + */ + virtual void reload() = 0; + + virtual ~IConfigContext() { } +}; + +} // namespace + diff --git a/config/src/vespa/config/subscription/configuri.cpp b/config/src/vespa/config/subscription/configuri.cpp index 0e63920bd63..f458408d851 100644 --- a/config/src/vespa/config/subscription/configuri.cpp +++ b/config/src/vespa/config/subscription/configuri.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "configuri.h" #include "configinstancespec.h" +#include #include namespace { diff --git a/config/src/vespa/config/subscription/configuri.h b/config/src/vespa/config/subscription/configuri.h index 4e327a7db94..ade6b3881b3 100644 --- a/config/src/vespa/config/subscription/configuri.h +++ b/config/src/vespa/config/subscription/configuri.h @@ -1,11 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include -#include +#include +#include namespace config { +class SourceSpec; + /** * A ConfigUri is a single representation of a configId and its source. The * purpose of this class is to make it more convenient to deal with config @@ -97,9 +99,9 @@ public: bool empty() const { return _empty; } private: - vespalib::string _configId; + vespalib::string _configId; IConfigContext::SP _context; - bool _empty; + bool _empty; }; } // namespace config -- cgit v1.2.3