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
66
use crate::shared::{system_config::SystemConfig, wasm_config::WasmConfig};
pub const DEFAULT_MAX_QUERY_DEPTH: u64 = 5;
pub const DEFAULT_MAX_ASSOCIATED_KEYS: u32 = 100;
#[derive(Debug, Copy, Clone)]
pub struct EngineConfig {
pub(crate) max_query_depth: u64,
max_associated_keys: u32,
wasm_config: WasmConfig,
system_config: SystemConfig,
}
impl Default for EngineConfig {
fn default() -> Self {
EngineConfig {
max_query_depth: DEFAULT_MAX_QUERY_DEPTH,
max_associated_keys: DEFAULT_MAX_ASSOCIATED_KEYS,
wasm_config: WasmConfig::default(),
system_config: SystemConfig::default(),
}
}
}
impl EngineConfig {
pub fn new(
max_query_depth: u64,
max_associated_keys: u32,
wasm_config: WasmConfig,
system_config: SystemConfig,
) -> EngineConfig {
EngineConfig {
max_query_depth,
max_associated_keys,
wasm_config,
system_config,
}
}
pub fn max_associated_keys(&self) -> u32 {
self.max_associated_keys
}
pub fn wasm_config(&self) -> &WasmConfig {
&self.wasm_config
}
pub fn system_config(&self) -> &SystemConfig {
&self.system_config
}
}