aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/helper/configgetter.h
blob: 802db453e3dac1ddd14c83e7a0a2769ecf3ae24d (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once


#include <vespa/config/subscription/sourcespec.h>
#include <vespa/config/common/timingvalues.h>
#include "ifetchercallback.h"

namespace config {

class IConfigContext;

/**
 * A config fetcher subscribes to a config and notifies a callback when done
 */
template <typename ConfigType>
class ConfigGetter
{
public:
    static std::unique_ptr<ConfigType> getConfig(int64_t &generation, const std::string & configId, const SourceSpec & spec = ServerSpec());
    static std::unique_ptr<ConfigType> getConfig(int64_t &generation, const std::string & configId, std::shared_ptr<IConfigContext> context, vespalib::duration subscribeTimeout = DEFAULT_SUBSCRIBE_TIMEOUT);
    static std::unique_ptr<ConfigType> getConfig(const std::string & configId, const SourceSpec & spec = ServerSpec());
    static std::unique_ptr<ConfigType> getConfig(const std::string & configId, std::shared_ptr<IConfigContext> context, vespalib::duration subscribeTimeout = DEFAULT_SUBSCRIBE_TIMEOUT);
};

} // namespace config