Add root parameter to backup/snapshot REST API
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

API Enhancement:
- All snapshot endpoints now accept 'root' query parameter
- Default root: /data (for production)
- Test root: configurable (e.g., /tmp/backup_test)

Endpoints updated:
- GET /api/v2/snapshots?root=<path>
- POST /api/v2/snapshots/:name?root=<path>
- DELETE /api/v2/snapshots/:name?root=<path>
- POST /api/v2/snapshots/:name/restore?root=<path>
- GET /api/v2/storage/stats?root=<path>

Integration Testing Results :
- Create snapshot: test_snap1 created
- List snapshots: ['test_snap1'] returned
- Modify file: 'original content' → 'modified content'
- Restore snapshot: 'modified content' → 'original content' 
- Delete snapshot: test_snap1 removed

Snapshot metadata format:
{
  'name': 'test_snap1',
  'created': {'secs_since_epoch': 1782243041, 'nanos_since_epoch': 344384000},
  'source_path': '/tmp/backup_test'
}

Build: 495 tests pass
Server: Port 11438 running with root parameter support
This commit is contained in:
Warren
2026-06-24 03:31:43 +08:00
parent 26d4199203
commit 55caeabd94
2 changed files with 19 additions and 10 deletions

Binary file not shown.