nym_api_requests/models/
network_monitor.rs1use crate::pagination::PaginatedResponse;
5use nym_mixnet_contract_common::NodeId;
6use schemars::JsonSchema;
7use serde::{Deserialize, Serialize};
8use std::collections::BTreeMap;
9use utoipa::ToSchema;
10
11#[derive(Clone, Debug, Serialize, Deserialize, schemars::JsonSchema, Default, ToSchema)]
12pub struct TestNode {
13 pub node_id: Option<u32>,
14 pub identity_key: Option<String>,
15}
16
17#[derive(Clone, Debug, Serialize, Deserialize, schemars::JsonSchema, ToSchema)]
18pub struct TestRoute {
19 pub gateway: TestNode,
20 pub layer1: TestNode,
21 pub layer2: TestNode,
22 pub layer3: TestNode,
23}
24
25#[derive(Clone, Debug, Serialize, Deserialize, schemars::JsonSchema, ToSchema)]
26pub struct PartialTestResult {
27 pub monitor_run_id: i64,
28 pub timestamp: i64,
29 pub overall_reliability_for_all_routes_in_monitor_run: Option<u8>,
30 pub test_routes: TestRoute,
31}
32
33pub type MixnodeTestResultResponse = PaginatedResponse<PartialTestResult>;
34pub type GatewayTestResultResponse = PaginatedResponse<PartialTestResult>;
35
36#[derive(Clone, Debug, Serialize, Deserialize, schemars::JsonSchema, ToSchema)]
37pub struct NetworkMonitorRunDetailsResponse {
38 pub monitor_run_id: i64,
39 pub network_reliability: f64,
40 pub total_sent: usize,
41 pub total_received: usize,
42
43 pub mixnode_results: BTreeMap<u8, usize>,
45 pub gateway_results: BTreeMap<u8, usize>,
46}
47
48#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, ToSchema)]
49#[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))]
50#[cfg_attr(
51 feature = "generate-ts",
52 ts(
53 export,
54 export_to = "ts-packages/types/src/types/rust/MixnodeCoreStatusResponse.ts"
55 )
56)]
57pub struct MixnodeCoreStatusResponse {
58 pub mix_id: NodeId,
59 pub count: i64,
60}
61
62#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, ToSchema)]
63#[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))]
64#[cfg_attr(
65 feature = "generate-ts",
66 ts(
67 export,
68 export_to = "ts-packages/types/src/types/rust/GatewayCoreStatusResponse.ts"
69 )
70)]
71pub struct GatewayCoreStatusResponse {
72 pub identity: String,
73 pub count: i64,
74}