Skip to main content

dm_database_sqllog2db/exporter/
stats.rs

1/// 导出统计
2#[derive(Debug, Default, Clone, Copy)]
3pub struct ExportStats {
4    pub exported: usize,
5    pub skipped: usize,
6    pub failed: usize,
7    pub flush_operations: usize,
8    pub last_flush_size: usize,
9}
10
11impl ExportStats {
12    #[must_use]
13    pub fn new() -> Self {
14        Self::default()
15    }
16
17    pub fn record_success(&mut self) {
18        self.exported += 1;
19    }
20
21    #[must_use]
22    pub fn total(&self) -> usize {
23        self.exported + self.skipped + self.failed
24    }
25}