-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathengine_servicei.h
65 lines (54 loc) · 1.75 KB
/
engine_servicei.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <json/value.h>
#include <string>
#include <vector>
#include "database/engines.h"
#include "utils/result.hpp"
// TODO: namh think of the other name
struct DefaultEngineVariant {
std::string engine;
std::string version;
std::string variant;
Json::Value ToJson() const {
Json::Value root;
root["engine"] = engine;
root["version"] = version;
root["variant"] = variant;
return root;
}
};
// TODO: namh think of the other name
struct EngineVariantResponse {
std::string name;
std::string version;
std::string engine;
std::string type;
Json::Value ToJson() const {
Json::Value root;
root["name"] = name;
root["version"] = version;
root["engine"] = engine;
root["type"] = type.empty() ? "local" : type;
return root;
}
};
class EngineServiceI {
public:
virtual ~EngineServiceI() {}
virtual cpp::result<DefaultEngineVariant, std::string>
SetDefaultEngineVariant(const std::string& engine, const std::string& version,
const std::string& variant) = 0;
virtual cpp::result<DefaultEngineVariant, std::string>
GetDefaultEngineVariant(const std::string& engine) = 0;
virtual cpp::result<std::vector<EngineVariantResponse>, std::string>
GetInstalledEngineVariants(const std::string& engine) const = 0;
virtual cpp::result<void, std::string> LoadEngine(
const std::string& engine_name) = 0;
virtual cpp::result<void, std::string> UnloadEngine(
const std::string& engine_name) = 0;
virtual cpp::result<cortex::db::EngineEntry, std::string>
GetEngineByNameAndVariant(
const std::string& engine_name,
const std::optional<std::string> variant = std::nullopt) const = 0;
virtual bool IsRemoteEngine(const std::string& engine_name) const = 0;
};