Skip to main content

hawdb_executor/
read_output.rs

1// Copyright 2026 Nowledge
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Public output contracts for bounded and streaming read execution.
16
17use crate::{QueryOutput, ReadExecutionProfile};
18use hawdb_storage::scan::ScanPruningReport;
19
20#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
21pub struct QueryStreamOptions {
22    pub max_rows: Option<usize>,
23    pub max_payload_bytes: Option<usize>,
24}
25
26#[derive(Debug, Clone, PartialEq, Eq)]
27pub struct QueryStreamReport {
28    pub fully_streamed: bool,
29    pub output_rows: usize,
30    pub output_payload_bytes: usize,
31    pub execution_profile: ReadExecutionProfile<ScanPruningReport>,
32}
33
34#[derive(Debug, Clone, PartialEq, Eq)]
35pub struct BoundedReadQueryOutput {
36    pub output: QueryOutput,
37    pub execution_profile: ReadExecutionProfile<ScanPruningReport>,
38}
39
40#[cfg(test)]
41mod tests {
42    use super::QueryStreamOptions;
43
44    #[test]
45    fn stream_options_default_to_unbounded() {
46        assert_eq!(
47            QueryStreamOptions::default(),
48            QueryStreamOptions {
49                max_rows: None,
50                max_payload_bytes: None,
51            }
52        );
53    }
54}