aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/helper/legacysubscriber.h
blob: 306a05379bcb57e53ed7cc6aa7d79406834c25bc (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 "legacy.h"
#include "configfetcher.h"

namespace config {

/**
 * A LegacySubscriber subscribes for a config similar to the old config API.
 */
class LegacySubscriber
{
public:
    LegacySubscriber();
    ~LegacySubscriber();
    const vespalib::string & id() const { return _configId; }

    template <typename ConfigType>
    void subscribe(const std::string & configId, IFetcherCallback<ConfigType> * callback);

    void close();
private:
    std::unique_ptr<ConfigFetcher> _fetcher;
    vespalib::string _configId;
};

} // namespace config