diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-05 21:59:00 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-12 02:55:45 +0100 |
commit | 36be03af9ccb5ede87f7a5bc3d37526cdc9b2bc4 (patch) | |
tree | 4f95a3c666ad80a5e6066dfcf2d75f54e67d6866 /config | |
parent | f94a9a21d6d546868ef2cf63ea3532469450ffd7 (diff) |
Avoid pulling in all of slobrok and config everywhere.
Diffstat (limited to 'config')
-rw-r--r-- | config/src/vespa/config/common/configcontext.h | 34 | ||||
-rw-r--r-- | config/src/vespa/config/common/iconfigcontext.h | 36 | ||||
-rw-r--r-- | config/src/vespa/config/subscription/configuri.cpp | 1 | ||||
-rw-r--r-- | config/src/vespa/config/subscription/configuri.h | 10 |
4 files changed, 48 insertions, 33 deletions
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 <vespa/vespalib/util/sync.h> -#include <vespa/vespalib/stllike/hash_map.h> +#include "iconfigcontext.h" #include "timingvalues.h" #include "configmanager.h" #include <vespa/config/subscription/sourcespec.h> +#include <vespa/vespalib/util/sync.h> +#include <vespa/vespalib/stllike/hash_map.h> 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<IConfigContext> 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 <memory> + +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<IConfigContext> 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 <vespa/config/common/configcontext.h> #include <vespa/config/helper/legacy.h> 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 <string> -#include <vespa/config/common/configcontext.h> +#include <vespa/config/common/iconfigcontext.h> +#include <vespa/config/configgen/configinstance.h> 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 |