From 92753fb066e629a51b8043e144f77f3e81242768 Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Sun, 3 Nov 2024 01:26:08 -0500 Subject: [PATCH] Add a small progress indicator Signed-off-by: Jason Cameron --- handlers/filesystem.go | 4 ++++ handlers/handler.go | 1 + handlers/mysql.go | 4 ++++ sentinel/main.go | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/handlers/filesystem.go b/handlers/filesystem.go index 825ea16..5cfdc08 100644 --- a/handlers/filesystem.go +++ b/handlers/filesystem.go @@ -110,3 +110,7 @@ func copyFile(src, dst string) error { _, err = io.Copy(destination, source) return err } + +func (h *FileSystemHandler) Name() string { + return "Filesystem Backup" +} diff --git a/handlers/handler.go b/handlers/handler.go index 9ffae50..9bda844 100644 --- a/handlers/handler.go +++ b/handlers/handler.go @@ -4,4 +4,5 @@ import "context" type BackupHandler interface { Backup(ctx context.Context) (string, error) + Name() string } diff --git a/handlers/mysql.go b/handlers/mysql.go index e1719ad..caf9a63 100644 --- a/handlers/mysql.go +++ b/handlers/mysql.go @@ -41,3 +41,7 @@ func (h *MySQLHandler) Backup(ctx context.Context) (string, error) { return filename, nil } + +func (h *MySQLHandler) Name() string { + return "MySQL Backup" +} diff --git a/sentinel/main.go b/sentinel/main.go index 1e27641..7d6fdbb 100644 --- a/sentinel/main.go +++ b/sentinel/main.go @@ -104,7 +104,7 @@ func performBackup(handlerList []handlers.BackupHandler, uploader *storage.S3Upl wg.Add(1) go func(handler handlers.BackupHandler) { defer wg.Done() - + fmt.Printf("Performing backup: %s\n", handler.Name()) backupFile, err := handler.Backup(ctx) if err != nil { errors <- err