@@ -7,27 +7,27 @@ import (
77 "strings"
88 "time"
99
10- "github.com/google/uuid "
10+ "emperror.dev/errors "
1111 "github.com/apex/log"
12- "github.com/pyrohost/elytra/src/server/backup"
13- "github.com/pyrohost/elytra/src/server"
12+ "github.com/google/uuid"
1413 "github.com/pyrohost/elytra/src/remote"
15- "emperror.dev/errors"
14+ "github.com/pyrohost/elytra/src/server"
15+ "github.com/pyrohost/elytra/src/server/backup"
1616)
1717
1818// BackupCreateJob handles backup creation operations
1919type BackupCreateJob struct {
20- id string
21- serverID string
22- backupUUID string
23- adapterType string
24- ignore string
25- name string
26- context map [string ]interface {}
27- progress int
28- message string
29- serverManager * server.Manager
30- client remote.Client
20+ id string
21+ serverID string
22+ backupUUID string
23+ adapterType string
24+ ignore string
25+ name string
26+ context map [string ]interface {}
27+ progress int
28+ message string
29+ serverManager * server.Manager
30+ client remote.Client
3131}
3232
3333// BackupDeleteJob handles backup deletion operations
@@ -166,13 +166,13 @@ func NewBackupRestoreJob(data map[string]interface{}, serverManager *server.Mana
166166}
167167
168168// BackupCreateJob implementation
169- func (j * BackupCreateJob ) GetID () string { return j .id }
170- func (j * BackupCreateJob ) GetType () string { return "backup_create" }
171- func (j * BackupCreateJob ) GetProgress () int { return j .progress }
172- func (j * BackupCreateJob ) GetMessage () string { return j .message }
169+ func (j * BackupCreateJob ) GetID () string { return j .id }
170+ func (j * BackupCreateJob ) GetType () string { return "backup_create" }
171+ func (j * BackupCreateJob ) GetProgress () int { return j .progress }
172+ func (j * BackupCreateJob ) GetMessage () string { return j .message }
173173
174174// WebSocketJob interface implementation for real-time backup status updates
175- func (j * BackupCreateJob ) GetServerID () string { return j .serverID }
175+ func (j * BackupCreateJob ) GetServerID () string { return j .serverID }
176176func (j * BackupCreateJob ) GetWebSocketEventType () string { return "backup.status" }
177177func (j * BackupCreateJob ) GetWebSocketEventData () map [string ]interface {} {
178178 return map [string ]interface {}{
@@ -317,13 +317,13 @@ func (j *BackupCreateJob) performBackupWithProgress(ctx context.Context, reporte
317317}
318318
319319// BackupDeleteJob implementation
320- func (j * BackupDeleteJob ) GetID () string { return j .id }
321- func (j * BackupDeleteJob ) GetType () string { return "backup_delete" }
322- func (j * BackupDeleteJob ) GetProgress () int { return j .progress }
323- func (j * BackupDeleteJob ) GetMessage () string { return j .message }
320+ func (j * BackupDeleteJob ) GetID () string { return j .id }
321+ func (j * BackupDeleteJob ) GetType () string { return "backup_delete" }
322+ func (j * BackupDeleteJob ) GetProgress () int { return j .progress }
323+ func (j * BackupDeleteJob ) GetMessage () string { return j .message }
324324
325325// WebSocketJob interface implementation for real-time backup status updates
326- func (j * BackupDeleteJob ) GetServerID () string { return j .serverID }
326+ func (j * BackupDeleteJob ) GetServerID () string { return j .serverID }
327327func (j * BackupDeleteJob ) GetWebSocketEventType () string { return "backup.status" }
328328func (j * BackupDeleteJob ) GetWebSocketEventData () map [string ]interface {} {
329329 return map [string ]interface {}{
@@ -448,7 +448,7 @@ func (j *BackupDeleteJob) deleteRusticLocalBackup(ctx context.Context, reporter
448448 reporter .ReportProgress (90 , "Calculating repository size..." )
449449
450450 result := map [string ]interface {}{
451- "deleted" : true ,
451+ "deleted" : true ,
452452 "type" : "rustic_local" ,
453453 "successful" : true ,
454454 "already_deleted" : true ,
@@ -562,7 +562,7 @@ func (j *BackupDeleteJob) deleteRusticS3Backup(ctx context.Context, reporter Pro
562562 reporter .ReportProgress (90 , "Calculating repository size..." )
563563
564564 result := map [string ]interface {}{
565- "deleted" : true ,
565+ "deleted" : true ,
566566 "type" : "rustic_s3" ,
567567 "successful" : true ,
568568 "already_deleted" : true ,
@@ -652,13 +652,13 @@ func (j *BackupDeleteJob) deleteRusticS3Backup(ctx context.Context, reporter Pro
652652}
653653
654654// BackupRestoreJob implementation
655- func (j * BackupRestoreJob ) GetID () string { return j .id }
656- func (j * BackupRestoreJob ) GetType () string { return "backup_restore" }
657- func (j * BackupRestoreJob ) GetProgress () int { return j .progress }
658- func (j * BackupRestoreJob ) GetMessage () string { return j .message }
655+ func (j * BackupRestoreJob ) GetID () string { return j .id }
656+ func (j * BackupRestoreJob ) GetType () string { return "backup_restore" }
657+ func (j * BackupRestoreJob ) GetProgress () int { return j .progress }
658+ func (j * BackupRestoreJob ) GetMessage () string { return j .message }
659659
660660// WebSocketJob interface implementation for real-time backup status updates
661- func (j * BackupRestoreJob ) GetServerID () string { return j .serverID }
661+ func (j * BackupRestoreJob ) GetServerID () string { return j .serverID }
662662func (j * BackupRestoreJob ) GetWebSocketEventType () string { return "backup.status" }
663663func (j * BackupRestoreJob ) GetWebSocketEventData () map [string ]interface {} {
664664 return map [string ]interface {}{
@@ -1001,7 +1001,7 @@ func (j *BackupDeleteAllJob) GetProgress() int { return j.progress }
10011001func (j * BackupDeleteAllJob ) GetMessage () string { return j .message }
10021002
10031003// WebSocketJob interface implementation
1004- func (j * BackupDeleteAllJob ) GetServerID () string { return j .serverID }
1004+ func (j * BackupDeleteAllJob ) GetServerID () string { return j .serverID }
10051005func (j * BackupDeleteAllJob ) GetWebSocketEventType () string { return "backup.status" }
10061006func (j * BackupDeleteAllJob ) GetWebSocketEventData () map [string ]interface {} {
10071007 return map [string ]interface {}{
@@ -1193,11 +1193,11 @@ func (j *BackupDeleteAllJob) Execute(ctx context.Context, reporter ProgressRepor
11931193 reporter .ReportProgress (100 , "Repository destruction failed" )
11941194
11951195 logger .WithFields (log.Fields {
1196- "deleted_count" : deletedCount ,
1197- "failed_count" : failedCount ,
1198- "destroyed_repos" : destroyedRepos ,
1199- "total_repos" : len (repositories ),
1200- "destroy_errors" : len (destroyErrors ),
1196+ "deleted_count" : deletedCount ,
1197+ "failed_count" : failedCount ,
1198+ "destroyed_repos" : destroyedRepos ,
1199+ "total_repos" : len (repositories ),
1200+ "destroy_errors" : len (destroyErrors ),
12011201 }).Error ("delete all job failed - repository destruction incomplete" )
12021202
12031203 // Combine all errors
@@ -1215,9 +1215,9 @@ func (j *BackupDeleteAllJob) Execute(ctx context.Context, reporter ProgressRepor
12151215 reporter .ReportProgress (100 , "All backups and repositories destroyed" )
12161216
12171217 logger .WithFields (log.Fields {
1218- "deleted_count" : deletedCount ,
1219- "failed_count" : failedCount ,
1220- "destroyed_repos" : destroyedRepos ,
1218+ "deleted_count" : deletedCount ,
1219+ "failed_count" : failedCount ,
1220+ "destroyed_repos" : destroyedRepos ,
12211221 }).Info ("all backups and repositories destroyed successfully" )
12221222
12231223 return map [string ]interface {}{
@@ -1229,4 +1229,4 @@ func (j *BackupDeleteAllJob) Execute(ctx context.Context, reporter ProgressRepor
12291229 "destroyed_repos" : destroyedRepos ,
12301230 "successful" : true ,
12311231 }, nil
1232- }
1232+ }
0 commit comments