aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/apps/vespa-configproxy-cmd/methods.cpp
blob: 841bf227fe5ab7657827d484683fefd96b83b395 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "methods.h"
#include <iostream>

namespace methods {

const Method methods[] = {
    { "cache", "listCachedConfig", 0 },
    { "dumpcache", "dumpCache", 1 }, // filename
    { "getConfig", "getConfig", 7 }, // defName defVersion defMD5 configid configXXhash64 timestamp timeout
    { "getmode", "getMode", 0 },
    { "invalidatecache", "invalidateCache", 0 },
    { "cachefull", "listCachedConfigFull", 0 },
    { "sources", "listSourceConnections", 0 },
    { "statistics", "printStatistics", 0 },
    { "setmode", "setMode", 1 }, // { default | memorycache }
    { "updatesources", "updateSources", 1 },
    { 0, 0, 0}
};

const Method find(const vespalib::string &name) {
    for (size_t i = 0; methods[i].shortName != 0; ++i) {
        if (name == methods[i].shortName) {
            return methods[i];
        }
    }
    Method rv = { name.c_str(), name.c_str(), 0 };
    return rv;
}

void dump() {
    std::cerr << "    ";
    size_t i = 0;
    for (;;) {
        std::cerr << methods[i++].shortName;
        if (methods[i].shortName == 0) {
            break;
        }
        std::cerr << ",";
    }
    std::cerr << std::endl;
}

};