fix(vfs): Z-04 — implement webdav quota report
This commit is contained in:
+21
-3
@@ -1127,10 +1127,28 @@ impl DavFileSystem for SanctumFs {
|
||||
}
|
||||
|
||||
fn get_quota(&self) -> FsFuture<'_, (u64, Option<u64>)> {
|
||||
if let Some(ref cfs) = self.carrier_fs {
|
||||
return cfs.get_quota();
|
||||
}
|
||||
|
||||
Box::pin(async move {
|
||||
// Virtueller Speicherplatz für Explorer: 1 TB
|
||||
let total_capacity: u64 = 1024 * 1024 * 1024 * 1024;
|
||||
Ok((0, Some(total_capacity)))
|
||||
self.touch();
|
||||
// Z-04: Echte Containergröße (physisch auf Disk) und freier Host-Speicher
|
||||
let container_size = self.db.get_container_file_size().unwrap_or(0);
|
||||
let used_bytes = if container_size > 0 {
|
||||
container_size
|
||||
} else {
|
||||
self.db.get_total_used_size().unwrap_or(0)
|
||||
};
|
||||
|
||||
let free_host_space = self
|
||||
.db
|
||||
.container_path()
|
||||
.and_then(|p| crate::windows::get_available_disk_space(&p))
|
||||
.unwrap_or(1024 * 1024 * 1024 * 1024); // Fallback: 1 TB
|
||||
|
||||
let total_capacity = used_bytes.saturating_add(free_host_space);
|
||||
Ok((used_bytes, Some(total_capacity)))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user