Skip to main content

core_api/host/
mod.rs

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