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