Skip to content

Commit c72079c

Browse files
committed
fix(api-types): introduce QosLevelPascalCase enum and update PodInfo to use it
1 parent 6631922 commit c72079c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

crates/api-types/src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,26 @@ use serde::Deserialize;
1010
use serde::Serialize;
1111

1212
#[derive(Debug, Clone, PartialEq, Copy, Serialize, Deserialize)]
13+
pub enum QosLevelPascalCase {
14+
Low,
15+
Medium,
16+
High,
17+
Critical,
18+
}
19+
20+
impl From<QosLevel> for QosLevelPascalCase {
21+
fn from(qos_level: QosLevel) -> Self {
22+
match qos_level {
23+
QosLevel::Low => QosLevelPascalCase::Low,
24+
QosLevel::Medium => QosLevelPascalCase::Medium,
25+
QosLevel::High => QosLevelPascalCase::High,
26+
QosLevel::Critical => QosLevelPascalCase::Critical,
27+
}
28+
}
29+
}
30+
31+
#[derive(Debug, Clone, PartialEq, Copy, Serialize, Deserialize)]
32+
#[serde(rename_all = "camelCase")]
1333
pub enum QosLevel {
1434
Low,
1535
Medium,
@@ -105,7 +125,7 @@ pub struct PodInfo {
105125
/// VRAM limit for the pod in bytes
106126
pub vram_limit: Option<u64>,
107127
/// QoS level for the workload
108-
pub qos_level: Option<QosLevel>,
128+
pub qos_level: Option<QosLevelPascalCase>,
109129
/// Whether the workload is a compute shard
110130
pub compute_shard: bool,
111131
/// Auto-freeze configuration based on QoS level

crates/hypervisor/src/controller/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ where
102102
.unwrap_or_default(),
103103
tflops_limit: pod_entry.tflops_limit,
104104
vram_limit: pod_entry.vram_limit,
105-
qos_level: pod_entry.qos_level,
105+
qos_level: pod_entry.qos_level.map(|qos| qos.into()),
106106
compute_shard: pod_entry.compute_shard,
107107
auto_freeze,
108108
};

0 commit comments

Comments
 (0)