aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/raw/rawsource.cpp
blob: 343c0a8cdaa2d3e49349a5a54ba63cf25579b9b3 (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
37
38
39
40
41
42
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "rawsource.h"
#include <vespa/config/common/misc.h>
#include <vespa/config/common/iconfigholder.h>
#include <vespa/config/common/configvalue.h>
#include <vespa/vespalib/stllike/asciistream.h>

namespace config {

RawSource::~RawSource() = default;

RawSource::RawSource(std::shared_ptr<IConfigHolder> holder, const vespalib::string & payload)
    : _holder(std::move(holder)),
      _payload(payload)
{
}

void
RawSource::getConfig()
{
    _holder->handle(std::make_unique<ConfigUpdate>(ConfigValue(readConfig()), true, 1));
}

void
RawSource::reload(int64_t generation)
{
    (void) generation;
}

void
RawSource::close()
{
}

StringVector
RawSource::readConfig()
{
    vespalib::asciistream is(_payload);
    return getlines(is);
}

}