Add Backup REST API endpoints (Phase 5-6)
REST API Implementation: - 8 backup/snapshot endpoints added to server.rs - BackupScheduler: add get_config()/set_config() methods Endpoints: - GET /api/v2/backup/stats - Scheduler status - GET/POST /api/v2/backup/config - Config management - POST /api/v2/backup/run - Manual backup trigger - GET /api/v2/snapshots - List snapshots - POST/DELETE /api/v2/snapshots/:name - Create/delete snapshot - POST /api/v2/snapshots/:name/restore - Restore snapshot - GET /api/v2/storage/stats - Storage metrics Test Results: - curl /api/v2/backup/stats ✅ - curl /api/v2/backup/config ✅ - curl /api/v2/storage/stats ✅ - curl /api/v2/snapshots ✅ Build: 495 tests pass Server: Port 11438 running with new endpoints
This commit is contained in:
@@ -77,6 +77,17 @@ impl BackupScheduler {
|
||||
self.config.enabled
|
||||
}
|
||||
|
||||
pub fn get_config(&self) -> &BackupScheduleConfig {
|
||||
&self.config
|
||||
}
|
||||
|
||||
pub fn set_config(&mut self, config: BackupScheduleConfig) {
|
||||
self.config = config;
|
||||
if self.config.enabled {
|
||||
self.schedule_next();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn schedule_next(&mut self) {
|
||||
let now = current_time_secs();
|
||||
let interval_secs = self.config.interval_hours * 3600;
|
||||
|
||||
Reference in New Issue
Block a user