Skip to main content

link_cli/
query_options.rs

1//! The options one query is processed with.
2
3/// Options for query processing
4pub struct QueryOptions {
5    pub query: String,
6    pub trace: bool,
7}
8
9impl QueryOptions {
10    pub fn new(query: &str, trace: bool) -> Self {
11        Self {
12            query: query.to_string(),
13            trace,
14        }
15    }
16}
17
18/// Admission limits selected by a checked storage adapter. Existing CLI
19/// stores retain their established behavior when no limits are selected.
20#[derive(Clone, Copy, Debug)]
21pub struct QueryLimits {
22    pub max_address: u128,
23    pub max_bytes: usize,
24    pub max_depth: usize,
25    pub max_nodes: usize,
26    pub max_results: usize,
27    pub max_bindings: usize,
28    pub max_binding_bytes: usize,
29}
30
31impl QueryLimits {
32    /// Finite limits for a request over a complete u64 causal projection.
33    pub const fn causal() -> Self {
34        Self {
35            max_address: u64::MAX as u128,
36            max_bytes: 1024 * 1024,
37            max_depth: 64,
38            max_nodes: 4096,
39            max_results: 4096,
40            max_bindings: 16_384,
41            max_binding_bytes: 4 * 1024 * 1024,
42        }
43    }
44}