aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h
blob: f67c26452665fd58c2638515ac8c7f819ca3ba7a (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/config/retriever/configkeyset.h>
#include <mutex>
#include <memory>

namespace config { class ConfigSnapshot; };
namespace proton {

class BootstrapConfig;

/**
 * This class handles subscribing to the proton bootstrap config.
 */
class BootstrapConfigManager
{
public:
    BootstrapConfigManager(const vespalib::string & configId);
    ~BootstrapConfigManager();
    const config::ConfigKeySet createConfigKeySet() const;

    std::shared_ptr<BootstrapConfig> getConfig() const;
    void update(const config::ConfigSnapshot & snapshot);

private:
    std::shared_ptr<BootstrapConfig> _pendingConfigSnapshot;
    vespalib::string                 _configId;
    mutable std::mutex               _pendingConfigMutex;
};

} // namespace proton