Skip to main content

core_api/host/
mod.rs

1//! Host observations and local OS authorization contracts. No Space identities.
2pub mod auth;
3pub mod management;
4pub mod network;
5pub mod permissions;
6use serde::{Deserialize, Serialize};
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct Service {
10    pub service_id: String,
11    pub version: String,
12    pub kind: String,
13    pub status: String,
14}
15#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
16#[serde(rename_all = "camelCase")]
17pub struct ServiceInventory {
18    pub host_id: String,
19    pub observed_at_ms: i64,
20    pub services: Vec<Service>,
21}
22#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
23#[serde(rename_all = "camelCase")]
24pub struct Cpu {
25    pub arch: String,
26    pub logical_cores: u64,
27    pub model: String,
28}
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30#[serde(rename_all = "camelCase")]
31pub struct Capacity {
32    pub total_bytes: u64,
33}
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35#[serde(rename_all = "camelCase")]
36pub struct Gpu {
37    pub vendor: String,
38    pub name: String,
39    pub memory_bytes: Option<u64>,
40}
41#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
42#[serde(rename_all = "camelCase")]
43pub struct HostInfo {
44    pub host_id: String,
45    pub host_name: String,
46    pub host_type: String,
47    pub os: String,
48    pub os_version: Option<String>,
49    pub cpu: Cpu,
50    pub memory: Capacity,
51    pub disk: Option<Capacity>,
52    pub gpus: Vec<Gpu>,
53}
54#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
55#[serde(rename_all = "camelCase")]
56pub struct ServiceMetrics {
57    pub service_id: String,
58    pub status: String,
59    pub sample_state: String,
60    pub process_count: u64,
61    pub cpu_usage_percent: Option<f64>,
62    pub memory_resident_bytes: Option<u64>,
63    pub disk_read_bytes_per_second: Option<f64>,
64    pub disk_written_bytes_per_second: Option<f64>,
65}
66#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
67#[serde(rename_all = "camelCase")]
68pub struct HostMetrics {
69    pub host_id: String,
70    pub sampled_at_ms: i64,
71    pub cpu_usage_percent: Option<f64>,
72    pub memory_available_bytes: Option<u64>,
73    pub disk_available_bytes: Option<u64>,
74    pub network_received_bytes_per_second: Option<f64>,
75    pub network_sent_bytes_per_second: Option<f64>,
76    pub services: Vec<ServiceMetrics>,
77}