aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/common/configcontext.cpp
blob: 6dc3c8ce3aafb59ea7b09ee746170b2bffbaae69 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "configcontext.h"
#include "configmanager.h"

namespace config {

ConfigContext::ConfigContext(const SourceSpec & spec)
    : ConfigContext(TimingValues(), spec)
{ }

ConfigContext::ConfigContext(const TimingValues & timingValues, const SourceSpec & spec)
    : _timingValues(timingValues),
      _generation(1),
      _manager(std::make_unique<ConfigManager>(spec.createSourceFactory(_timingValues), _generation))
{ }

IConfigManager &
ConfigContext::getManagerInstance()
{
    return *_manager;
}

void
ConfigContext::reload()
{
    _generation++;
    _manager->reload(_generation);
}

} // namespace config