sklears_compose/resource_management/
network_manager.rs1use super::resource_types::{NetworkAllocation, QoSClass};
4use sklears_core::error::Result as SklResult;
5
6#[derive(Debug)]
8pub struct NetworkResourceManager {
9 interfaces: Vec<NetworkInterface>,
11}
12
13#[derive(Debug, Clone)]
15pub struct NetworkInterface {
16 pub name: String,
18 pub total_bandwidth: u64,
20 pub available_bandwidth: u64,
22}
23
24impl Default for NetworkResourceManager {
25 fn default() -> Self {
26 Self::new()
27 }
28}
29
30impl NetworkResourceManager {
31 #[must_use]
33 pub fn new() -> Self {
34 Self {
35 interfaces: Vec::new(),
36 }
37 }
38
39 pub fn allocate_network(&mut self, bandwidth: u64) -> SklResult<NetworkAllocation> {
41 Ok(NetworkAllocation {
42 bandwidth,
43 interface: "eth0".to_string(),
44 qos_class: QoSClass::Standard,
45 traffic_shaping: false,
46 vlan_id: None,
47 })
48 }
49
50 pub fn release_network(&mut self, allocation: &NetworkAllocation) -> SklResult<()> {
52 Ok(())
53 }
54}