mirror of
https://github.com/block/buzz.git
synced 2026-12-01 05:32:24 +00:00
Signed-off-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co> Signed-off-by: npub17jjz49l9jjmhhk7cac63j8yt9z555n9cw8vk7v5jz4vzw4ppld5qgj57cc <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Tyler Longwell <tlongwell@squareup.com> Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com> Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Co-authored-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub17jjz49l9jjmhhk7cac63j8yt9z555n9cw8vk7v5jz4vzw4ppld5qgj57cc <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
61 lines
1.6 KiB
Rust
61 lines
1.6 KiB
Rust
//! `/_mesh` status data model.
|
|
//!
|
|
//! The relay's axum handler can serialize [`MeshStatus`] directly as JSON.
|
|
|
|
use serde::Serialize;
|
|
|
|
#[derive(Clone, Debug, Default, Serialize)]
|
|
pub struct MeshStatus {
|
|
pub enabled: bool,
|
|
pub local_runtime_id: String,
|
|
pub draining: bool,
|
|
pub peer_count: usize,
|
|
pub peers: Vec<MeshPeerStatus>,
|
|
pub counters: MeshCounters,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
pub struct MeshPeerStatus {
|
|
pub runtime_id: String,
|
|
pub endpoint_addrs: Vec<String>,
|
|
pub proto_version: u16,
|
|
pub draining: bool,
|
|
pub connection_state: ConnectionState,
|
|
pub phi: Option<f64>,
|
|
pub load: f32,
|
|
pub record_version: u64,
|
|
pub last_heartbeat_millis: u64,
|
|
pub counters: MeshPeerCounters,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum ConnectionState {
|
|
#[default]
|
|
Disconnected,
|
|
Connecting,
|
|
Connected,
|
|
Suspect,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default, Serialize)]
|
|
pub struct MeshCounters {
|
|
pub stale_generation_rejections: u64,
|
|
/// Ready-registry seeds rejected because their `relay_pubkey` did not
|
|
/// match this deployment's relay identity (or no anchor was configured).
|
|
pub foreign_relay_rejections: u64,
|
|
pub peers: Vec<MeshPeerCounters>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Default, Serialize)]
|
|
pub struct MeshPeerCounters {
|
|
pub runtime_id: String,
|
|
pub streams_opened: u64,
|
|
pub streams_received: u64,
|
|
pub datagrams_sent: u64,
|
|
pub datagrams_received: u64,
|
|
pub gossip_frames_sent: u64,
|
|
pub gossip_frames_received: u64,
|
|
pub stale_generation_rejections: u64,
|
|
}
|