sklears_compose/resource_management/
storage_manager.rs1use super::resource_types::{IOPriority, StorageAllocation, StoragePermissions, StorageType};
4use sklears_core::error::Result as SklResult;
5
6#[derive(Debug)]
8pub struct StorageResourceManager {
9 devices: Vec<StorageDevice>,
11}
12
13#[derive(Debug, Clone)]
15pub struct StorageDevice {
16 pub path: String,
18 pub total_size: u64,
20 pub available_size: u64,
22 pub storage_type: StorageType,
24}
25
26impl Default for StorageResourceManager {
27 fn default() -> Self {
28 Self::new()
29 }
30}
31
32impl StorageResourceManager {
33 #[must_use]
35 pub fn new() -> Self {
36 Self {
37 devices: Vec::new(),
38 }
39 }
40
41 pub fn allocate_storage(
43 &mut self,
44 size: u64,
45 storage_type: StorageType,
46 ) -> SklResult<StorageAllocation> {
47 Ok(StorageAllocation {
48 size,
49 storage_type,
50 io_priority: IOPriority::Normal,
51 mount_point: None,
52 permissions: StoragePermissions {
53 read: true,
54 write: true,
55 execute: false,
56 },
57 })
58 }
59
60 pub fn release_storage(&mut self, allocation: &StorageAllocation) -> SklResult<()> {
62 Ok(())
63 }
64}