1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "configgetter.h"
#include <vespa/config/subscription/configsubscriber.hpp>
namespace config {
template <typename ConfigType>
std::unique_ptr<ConfigType>
ConfigGetter<ConfigType>::getConfig(int64_t &generation, const std::string & configId, const SourceSpec & spec)
{
ConfigSubscriber s(spec);
std::unique_ptr< ConfigHandle<ConfigType> > h = s.subscribe<ConfigType>(configId);
s.nextConfigNow();
generation = s.getGeneration();
return h->getConfig();
}
template <typename ConfigType>
std::unique_ptr<ConfigType>
ConfigGetter<ConfigType>::getConfig(int64_t &generation, const std::string & configId, std::shared_ptr<IConfigContext> context, vespalib::duration subscribeTimeout)
{
ConfigSubscriber s(std::move(context));
std::unique_ptr< ConfigHandle<ConfigType> > h = s.subscribe<ConfigType>(configId, subscribeTimeout);
s.nextConfigNow();
generation = s.getGeneration();
return h->getConfig();
}
template <typename ConfigType>
std::unique_ptr<ConfigType>
ConfigGetter<ConfigType>::getConfig(const std::string & configId, const SourceSpec & spec)
{
int64_t ignoreGeneration;
return getConfig(ignoreGeneration, configId, spec);
}
template <typename ConfigType>
std::unique_ptr<ConfigType>
ConfigGetter<ConfigType>::getConfig(const std::string & configId, std::shared_ptr<IConfigContext> context, vespalib::duration subscribeTimeout)
{
int64_t ignoreGeneration;
return getConfig(ignoreGeneration, configId, std::move(context), subscribeTimeout);
}
} // namespace config
|