types.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package backup
  2. import "time"
  3. // Manifest defines the metadata stored inside the backup zip archive.
  4. type Manifest struct {
  5. Version string `json:"version"` // Backup format specification version ("1.0")
  6. DebTikVersion string `json:"debtik_version"` // DebTik version that created the backup
  7. Hostname string `json:"hostname"` // Router hostname at backup time
  8. CreatedAt time.Time `json:"created_at"` // Timestamp of backup generation
  9. Comment string `json:"comment,omitempty"` // Optional user note or comment
  10. Files []FileInfo `json:"files"` // List of files included in the archive
  11. }
  12. // FileInfo contains metadata for an individual file in the backup.
  13. type FileInfo struct {
  14. Path string `json:"path"` // Path relative to zip root (e.g. "debtik/metadata.json")
  15. Size int64 `json:"size"` // File size in bytes
  16. Mode uint32 `json:"mode"` // File permission bits
  17. SHA256 string `json:"sha256"` // SHA-256 checksum of file content
  18. }
  19. // BackupInfo summarizes a stored local backup archive.
  20. type BackupInfo struct {
  21. Filename string `json:"filename"`
  22. Size int64 `json:"size"`
  23. ModTime time.Time `json:"mod_time"`
  24. DebTikVersion string `json:"debtik_version,omitempty"`
  25. Hostname string `json:"hostname,omitempty"`
  26. Comment string `json:"comment,omitempty"`
  27. }
  28. // RestoreResult describes the outcome of a restoration operation.
  29. type RestoreResult struct {
  30. Success bool `json:"success"`
  31. Message string `json:"message"`
  32. Manifest *Manifest `json:"manifest,omitempty"`
  33. SafetyBackup string `json:"safety_backup,omitempty"`
  34. RestoredAt time.Time `json:"restored_at"`
  35. }