()
| 3566 | } |
| 3567 | |
| 3568 | pub async fn fetch_admin_compaction_runtime_config() -> Result<CompactionRuntimeConfig, String> { |
| 3569 | #[cfg(feature = "mock")] |
| 3570 | { |
| 3571 | Ok(CompactionRuntimeConfig { |
| 3572 | enabled: true, |
| 3573 | scan_interval_seconds: 900, |
| 3574 | fragment_threshold: 128, |
| 3575 | prune_older_than_hours: 1, |
| 3576 | worker_count: 2, |
| 3577 | }) |
| 3578 | } |
| 3579 | |
| 3580 | #[cfg(not(feature = "mock"))] |
| 3581 | { |
| 3582 | let url = format!("{}/admin/compaction-config", admin_base()); |
| 3583 | let response = api_get(&url) |
| 3584 | .send() |
| 3585 | .await |
| 3586 | .map_err(|e| format!("Network error: {:?}", e))?; |
| 3587 | if !response.ok() { |
| 3588 | return Err(format!("HTTP error: {}", response.status())); |
| 3589 | } |
| 3590 | response |
| 3591 | .json() |
| 3592 | .await |
| 3593 | .map_err(|e| format!("Parse error: {:?}", e)) |
| 3594 | } |
| 3595 | } |
| 3596 | |
| 3597 | pub async fn update_admin_compaction_runtime_config( |
| 3598 | config: &CompactionRuntimeConfig, |
no test coverage detected