blob: d3bd87e2795885808f716930438fdc7a9fccf0e9 (
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
35
36
37
38
39
40
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/config/common/source.h>
#include <vespa/config/common/configkey.h>
#include <vespa/config/common/configstate.h>
#include <map>
namespace config {
class ConfigInstance;
class IConfigHolder;
/**
* Class for sending and receiving config request from a raw string.
*/
class ConfigSetSource : public Source {
public:
typedef std::map<ConfigKey, ConfigInstance *> BuilderMap;
typedef std::shared_ptr<BuilderMap> BuilderMapSP;
ConfigSetSource(std::shared_ptr<IConfigHolder> holder, const ConfigKey & key, BuilderMapSP builderMap);
ConfigSetSource(const ConfigSetSource &) = delete;
ConfigSetSource & operator =(const ConfigSetSource &) = delete;
~ConfigSetSource();
void getConfig() override;
void reload(int64_t generation) override;
void close() override;
private:
std::shared_ptr<IConfigHolder> _holder;
const ConfigKey _key;
int64_t _generation;
BuilderMapSP _builderMap;
ConfigState _lastState;
bool validRequest(const ConfigKey & key);
};
}
|