relate_engine_api/
engines.rs1pub const MEMORY_QUERY_ENGINE: &str = "in-memory";
7
8pub const LOCAL_WRITE_ENGINE: &str = "local";
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum QueryEngineId {
13 InMemory,
14}
15
16impl QueryEngineId {
17 pub fn as_str(self) -> &'static str {
18 match self {
19 Self::InMemory => MEMORY_QUERY_ENGINE,
20 }
21 }
22
23 pub fn parse(raw: &str) -> Option<Self> {
24 match raw {
25 MEMORY_QUERY_ENGINE => Some(Self::InMemory),
26 _ => None,
27 }
28 }
29}
30
31#[derive(Debug, Clone, Copy, PartialEq, Eq)]
32pub enum WriteEngineId {
33 Local,
34}
35
36impl WriteEngineId {
37 pub fn as_str(self) -> &'static str {
38 match self {
39 Self::Local => LOCAL_WRITE_ENGINE,
40 }
41 }
42
43 pub fn parse(raw: &str) -> Option<Self> {
44 match raw {
45 LOCAL_WRITE_ENGINE => Some(Self::Local),
46 _ => None,
47 }
48 }
49}
50
51#[derive(Debug, Clone, Copy, PartialEq, Eq)]
53pub struct EngineIds {
54 pub query: QueryEngineId,
55 pub write: WriteEngineId,
56}
57
58impl Default for EngineIds {
59 fn default() -> Self {
60 Self {
61 query: QueryEngineId::InMemory,
62 write: WriteEngineId::Local,
63 }
64 }
65}
66
67impl EngineIds {
68 pub fn parse(query: &str, write: &str) -> Option<Self> {
69 Some(Self {
70 query: QueryEngineId::parse(query)?,
71 write: WriteEngineId::parse(write)?,
72 })
73 }
74}