Skip to main content

made_core/ports/
execution_recovery_page.rs

1use crate::value_objects::{ExecutionOperation, ExecutionRecoveryCursor};
2
3/// One bounded keyset page of operation roots, including roots with receipts.
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct ExecutionRecoveryPage {
6    operations: Vec<ExecutionOperation>,
7    next_cursor: Option<ExecutionRecoveryCursor>,
8}
9
10impl ExecutionRecoveryPage {
11    #[must_use]
12    pub const fn new(
13        operations: Vec<ExecutionOperation>,
14        next_cursor: Option<ExecutionRecoveryCursor>,
15    ) -> Self {
16        Self {
17            operations,
18            next_cursor,
19        }
20    }
21
22    #[must_use]
23    pub fn operations(&self) -> &[ExecutionOperation] {
24        &self.operations
25    }
26
27    #[must_use]
28    pub const fn next_cursor(&self) -> Option<&ExecutionRecoveryCursor> {
29        self.next_cursor.as_ref()
30    }
31
32    #[must_use]
33    pub fn into_parts(self) -> (Vec<ExecutionOperation>, Option<ExecutionRecoveryCursor>) {
34        (self.operations, self.next_cursor)
35    }
36}