aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/file/filesourcefactory.h
blob: d751d499d95c485d979162b30e06b5fb0fe249cd (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
43
44
45
46
47
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/config/common/sourcefactory.h>
#include <vespa/config/common/types.h>

namespace config {

class DirSpec;
class FileSpec;

/**
 * Factory creating config payload from config instances.
 */
class FileSourceFactory : public SourceFactory
{
public:
    FileSourceFactory(const FileSpec & fileSpec);

    /**
     * Create source handling config described by key.
     */
    std::unique_ptr<Source> createSource(std::shared_ptr<IConfigHolder> holder, const ConfigKey & key) const override;
private:
    vespalib::string _fileName;
};

/**
 * Factory creating config payload from config instances.
 */
class DirSourceFactory : public SourceFactory
{
public:
    DirSourceFactory(const DirSpec & dirSpec);

    /**
     * Create source handling config described by key.
     */
    std::unique_ptr<Source> createSource(std::shared_ptr<IConfigHolder> holder, const ConfigKey & key) const override;
private:
    vespalib::string _dirName;
    StringVector _fileNames;
};


} // namespace config