Skip to main content

made_client/
progress_batch.rs

1use made_proto::v1::{CeremonyEventRecord, StreamCeremonyEndReason};
2
3use crate::ProgressCheckpoint;
4
5/// One bounded G6 replay/watch response and the cursor safe to persist.
6#[derive(Clone, Debug)]
7pub struct ProgressBatch {
8    records: Vec<CeremonyEventRecord>,
9    checkpoint: ProgressCheckpoint,
10    head_sequence: u64,
11    end_reason: StreamCeremonyEndReason,
12}
13
14impl ProgressBatch {
15    pub(crate) fn new(
16        records: Vec<CeremonyEventRecord>,
17        checkpoint: ProgressCheckpoint,
18        head_sequence: u64,
19        end_reason: StreamCeremonyEndReason,
20    ) -> Self {
21        Self {
22            records,
23            checkpoint,
24            head_sequence,
25            end_reason,
26        }
27    }
28
29    #[must_use]
30    pub fn records(&self) -> &[CeremonyEventRecord] {
31        &self.records
32    }
33
34    #[must_use]
35    pub fn checkpoint(&self) -> &ProgressCheckpoint {
36        &self.checkpoint
37    }
38
39    #[must_use]
40    pub fn head_sequence(&self) -> u64 {
41        self.head_sequence
42    }
43
44    #[must_use]
45    pub fn end_reason(&self) -> StreamCeremonyEndReason {
46        self.end_reason
47    }
48}