fast_cache/storage/
stats.rs1use serde::Serialize;
2
3#[derive(Debug, Clone, Default, Serialize)]
4pub struct TierStatsSnapshot {
5 pub name: &'static str,
6 pub len: usize,
7 pub capacity: usize,
8 pub hits: u64,
9 pub misses: u64,
10 pub promotions: u64,
11 pub demotions: u64,
12 pub evictions: u64,
13 pub expirations: u64,
14}
15
16#[derive(Debug, Clone, Default, Serialize)]
17pub struct ShardStatsSnapshot {
18 pub shard_id: usize,
19 pub key_count: usize,
20 pub reads: u64,
21 pub writes: u64,
22 pub deletes: u64,
23 pub expired: u64,
24 pub maintenance_runs: u64,
25 pub hot: TierStatsSnapshot,
26 pub warm: TierStatsSnapshot,
27 pub cold: TierStatsSnapshot,
28}
29
30#[derive(Debug, Clone, Default, Serialize)]
31pub struct WalStatsSnapshot {
32 pub enabled: bool,
33 pub entries_written: u64,
34 pub segments_rotated: u64,
35 pub bytes_written: u64,
36 pub last_flush_ms: u64,
37 pub recoveries: u64,
38 pub snapshots_written: u64,
39 pub tcp_export_enabled: bool,
40 pub tcp_export_frames_queued: u64,
41 pub tcp_export_frames_sent: u64,
42 pub tcp_export_bytes_sent: u64,
43 pub tcp_export_frames_dropped: u64,
44 pub tcp_export_connect_failures: u64,
45 pub tcp_export_write_failures: u64,
46 pub tcp_export_active_subscribers: usize,
47 pub tcp_export_subscribers_accepted: u64,
48 pub tcp_export_subscribers_rejected: u64,
49}
50
51#[derive(Debug, Clone, Default, Serialize)]
52pub struct GlobalStatsSnapshot {
53 pub uptime_ms: u64,
54 pub shard_count: usize,
55 pub total_keys: usize,
56 pub total_reads: u64,
57 pub total_writes: u64,
58 pub total_deletes: u64,
59 pub total_expired: u64,
60 pub shards: Vec<ShardStatsSnapshot>,
61 pub wal: WalStatsSnapshot,
62}