xet_data/deduplication/
dedup_metrics.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)]
4pub struct DeduplicationMetrics {
5 pub total_bytes: u64,
6 pub deduped_bytes: u64,
7 pub new_bytes: u64,
8 pub deduped_bytes_by_global_dedup: u64,
9 pub defrag_prevented_dedup_bytes: u64,
10
11 pub total_chunks: u64,
12 pub deduped_chunks: u64,
13 pub new_chunks: u64,
14 pub deduped_chunks_by_global_dedup: u64,
15 pub defrag_prevented_dedup_chunks: u64,
16
17 pub xorb_bytes_uploaded: u64,
18 pub shard_bytes_uploaded: u64,
19 pub total_bytes_uploaded: u64,
20}
21
22impl DeduplicationMetrics {
25 pub fn merge_in(&mut self, other: &Self) {
26 self.total_bytes += other.total_bytes;
27 self.deduped_bytes += other.deduped_bytes;
28 self.new_bytes += other.new_bytes;
29 self.deduped_bytes_by_global_dedup += other.deduped_bytes_by_global_dedup;
30 self.defrag_prevented_dedup_bytes += other.defrag_prevented_dedup_bytes;
31
32 self.total_chunks += other.total_chunks;
33 self.deduped_chunks += other.deduped_chunks;
34 self.new_chunks += other.new_chunks;
35 self.deduped_chunks_by_global_dedup += other.deduped_chunks_by_global_dedup;
36 self.defrag_prevented_dedup_chunks += other.defrag_prevented_dedup_chunks;
37
38 self.xorb_bytes_uploaded += other.xorb_bytes_uploaded;
39 self.shard_bytes_uploaded += other.shard_bytes_uploaded;
40 self.total_bytes_uploaded += other.total_bytes_uploaded;
41 }
42}