blob: 5513eaa9d65a8880c0391e3a59d6781ec8c266c1 (
plain) (
blame)
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "configsnapshot.h"
#include <vespa/config/common/configvalue.hpp>
namespace config {
template <typename ConfigType>
std::unique_ptr<ConfigType>
ConfigSnapshot::getConfig(const vespalib::string & configId) const
{
ConfigKey key(ConfigKey::create<ConfigType>(configId));
return find(key)->second.second.newInstance<ConfigType>();
}
template <typename ConfigType>
bool
ConfigSnapshot::isChanged(const vespalib::string & configId, int64_t currentGeneration) const
{
ConfigKey key(ConfigKey::create<ConfigType>(configId));
return currentGeneration < find(key)->second.first;
}
template <typename ConfigType>
bool
ConfigSnapshot::hasConfig(const vespalib::string & configId) const
{
ConfigKey key(ConfigKey::create<ConfigType>(configId));
return (_valueMap.find(key) != _valueMap.end());
}
}
|