vtcode_core/pods/
state.rs1use serde::{Deserialize, Serialize};
2use std::collections::BTreeMap;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct PodsState {
7 pub version: String,
8 #[serde(default)]
9 pub active_pod: Option<PodState>,
10}
11
12impl Default for PodsState {
13 fn default() -> Self {
14 Self {
15 version: env!("CARGO_PKG_VERSION").to_string(),
16 active_pod: None,
17 }
18 }
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct PodState {
24 pub name: String,
25 pub ssh: String,
26 #[serde(default)]
27 pub models_path: Option<String>,
28 #[serde(default)]
29 pub gpus: Vec<PodGpu>,
30 #[serde(default)]
31 pub models: BTreeMap<String, RunningModel>,
32}
33
34impl PodState {
35 pub fn gpu_count(&self) -> usize {
36 self.gpus.len()
37 }
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
42pub struct PodGpu {
43 pub id: u32,
44 pub name: String,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
49pub struct RunningModel {
50 pub model: String,
51 pub port: u16,
52 #[serde(default)]
53 pub gpu_ids: Vec<u32>,
54 pub pid: u32,
55 pub profile: String,
56}
57
58#[derive(Debug, Clone, Copy, PartialEq, Eq)]
60pub enum PodHealth {
61 Running,
62 Starting,
63 Crashed,
64 Dead,
65}
66
67impl PodHealth {
68 pub fn as_str(self) -> &'static str {
69 match self {
70 Self::Running => "running",
71 Self::Starting => "starting",
72 Self::Crashed => "crashed",
73 Self::Dead => "dead",
74 }
75 }
76}