Skip to main content

espresso_api/v1/
status.rs

1//! V1 status API.
2//!
3//! Mirrors the endpoints of the legacy `hotshot-query-service` status API (its tide-disco
4//! `status.toml`, since removed).
5
6use async_trait::async_trait;
7use serde::Serialize;
8
9#[async_trait]
10pub trait StatusApi {
11    type Keys: Serialize + Send + Sync + 'static;
12
13    async fn block_height(&self) -> anyhow::Result<u64>;
14    async fn success_rate(&self) -> anyhow::Result<f64>;
15    async fn time_since_last_decide(&self) -> anyhow::Result<u64>;
16
17    async fn metrics(&self) -> anyhow::Result<String>;
18
19    async fn keys(&self) -> anyhow::Result<Self::Keys>;
20}