diff --git a/src/api/model.rs b/src/api/model.rs index bea2301..43d4173 100644 --- a/src/api/model.rs +++ b/src/api/model.rs @@ -65,6 +65,59 @@ pub(super) struct SummaryData { pub(super) configured_users: usize, } +#[derive(Serialize)] +pub(super) struct MeWritersSummary { + pub(super) configured_dc_groups: usize, + pub(super) configured_endpoints: usize, + pub(super) available_endpoints: usize, + pub(super) available_pct: f64, + pub(super) required_writers: usize, + pub(super) alive_writers: usize, + pub(super) coverage_pct: f64, +} + +#[derive(Serialize)] +pub(super) struct MeWriterStatus { + pub(super) writer_id: u64, + pub(super) dc: Option, + pub(super) endpoint: String, + pub(super) generation: u64, + pub(super) state: &'static str, + pub(super) draining: bool, + pub(super) degraded: bool, + pub(super) bound_clients: usize, + pub(super) idle_for_secs: Option, + pub(super) rtt_ema_ms: Option, +} + +#[derive(Serialize)] +pub(super) struct MeWritersData { + pub(super) middle_proxy_enabled: bool, + pub(super) generated_at_epoch_secs: u64, + pub(super) summary: MeWritersSummary, + pub(super) writers: Vec, +} + +#[derive(Serialize)] +pub(super) struct DcStatus { + pub(super) dc: i16, + pub(super) endpoints: Vec, + pub(super) available_endpoints: usize, + pub(super) available_pct: f64, + pub(super) required_writers: usize, + pub(super) alive_writers: usize, + pub(super) coverage_pct: f64, + pub(super) rtt_ms: Option, + pub(super) load: usize, +} + +#[derive(Serialize)] +pub(super) struct DcStatusData { + pub(super) middle_proxy_enabled: bool, + pub(super) generated_at_epoch_secs: u64, + pub(super) dcs: Vec, +} + #[derive(Serialize)] pub(super) struct UserInfo { pub(super) username: String,