blob: a5e009c7fa39dbd0d9b969d86a555057b0860dab (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/config/configgen/configinstance.h>
namespace config {
class IGenerationCallback
{
public:
virtual void notifyGenerationChange(int64_t generation) = 0;
virtual ~IGenerationCallback() {}
};
class ICallback
{
public:
virtual void configure(std::unique_ptr<const ConfigInstance> config) = 0;
virtual ~ICallback() { }
};
/**
* Interface for callback methods used by ConfigFetcher, ConfigPoller and
* LegacySubscriber.
*/
template <typename ConfigType>
class IFetcherCallback : public ICallback
{
protected:
void configure(std::unique_ptr<const ConfigInstance> config) override {
configure(std::unique_ptr<ConfigType>(static_cast<const ConfigType *>(config.release())));
}
virtual void configure(std::unique_ptr<ConfigType> config) = 0;
};
} // namespace config
|