Returns the current runtime configuration entries
(&self)
| 234 | |
| 235 | /// Returns the current runtime configuration entries |
| 236 | pub fn config_entries(&self) -> Vec<ConfigEntry> { |
| 237 | use crate::memory_pool::MemoryLimit; |
| 238 | |
| 239 | /// Convert bytes to a human-readable format |
| 240 | fn format_byte_size(size: u64) -> String { |
| 241 | const GB: u64 = 1024 * 1024 * 1024; |
| 242 | const MB: u64 = 1024 * 1024; |
| 243 | const KB: u64 = 1024; |
| 244 | |
| 245 | match size { |
| 246 | s if s >= GB => format!("{}G", s / GB), |
| 247 | s if s >= MB => format!("{}M", s / MB), |
| 248 | s if s >= KB => format!("{}K", s / KB), |
| 249 | s => format!("{s}"), |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | fn format_duration(duration: Duration) -> String { |
| 254 | let total = duration.as_secs(); |
| 255 | let mins = total / 60; |
| 256 | let secs = total % 60; |
| 257 | |
| 258 | format!("{mins}m{secs}s") |
| 259 | } |
| 260 | |
| 261 | let memory_limit_value = match self.memory_pool.memory_limit() { |
| 262 | MemoryLimit::Finite(size) => Some(format_byte_size( |
| 263 | size.try_into() |
| 264 | .expect("Memory limit size conversion failed"), |
| 265 | )), |
| 266 | MemoryLimit::Infinite => Some("unlimited".to_string()), |
| 267 | MemoryLimit::Unknown => None, |
| 268 | }; |
| 269 | |
| 270 | let max_temp_dir_size = self.disk_manager.max_temp_directory_size(); |
| 271 | let max_temp_dir_value = format_byte_size(max_temp_dir_size); |
| 272 | |
| 273 | let temp_paths = self.disk_manager.temp_dir_paths(); |
| 274 | let temp_dir_value = if temp_paths.is_empty() { |
| 275 | None |
| 276 | } else { |
| 277 | Some( |
| 278 | temp_paths |
| 279 | .iter() |
| 280 | .map(|p| p.display().to_string()) |
| 281 | .collect::<Vec<_>>() |
| 282 | .join(","), |
| 283 | ) |
| 284 | }; |
| 285 | |
| 286 | let metadata_cache_limit = self.cache_manager.get_metadata_cache_limit(); |
| 287 | let metadata_cache_value = format_byte_size( |
| 288 | metadata_cache_limit |
| 289 | .try_into() |
| 290 | .expect("Metadata cache size conversion failed"), |
| 291 | ); |
| 292 | |
| 293 | let list_files_cache_limit = self.cache_manager.get_list_files_cache_limit(); |
no test coverage detected