hubcio commented on code in PR #2917:
URL: https://github.com/apache/iggy/pull/2917#discussion_r2936619312
##########
core/server/src/shard/system/stats.rs:
##########
@@ -118,6 +120,20 @@ impl IggyShard {
}
}
+ let data_path = std::path::Path::new(&self.config.system.path);
+ let data_path =
+ std::fs::canonicalize(data_path).unwrap_or_else(|_|
data_path.to_path_buf());
+ let disks = sysinfo::Disks::new_with_refreshed_list();
+ let mut best_mount_len = 0usize;
+ for disk in disks.list() {
+ let mount = disk.mount_point();
+ if data_path.starts_with(mount) && mount.as_os_str().len() >
best_mount_len {
+ best_mount_len = mount.as_os_str().len();
+ stats.free_disk_space = disk.available_space().into();
+ stats.total_disk_space = disk.total_space().into();
+ }
+ }
Review Comment:
alright, thats perfectly fine.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]