feat: 新增 SAP HANA 数据库备份支持和 FTP 存储后端

后端变更:
- 新增 SAP HANA 备份 Runner (saphana_runner.go),使用 hdbsql CLI 工具执行数据库导出/恢复
- 新增 FTP 存储 Provider (storage/ftp/provider.go),支持 FTP/FTPS 协议上传下载备份文件
- 在 storage/types.go 中添加 FTP 类型常量和 FTPConfig 配置结构
- 在 app.go 中注册 FTP Storage Factory 和 SAP HANA Backup Runner
- 添加 github.com/jlaffaye/ftp 依赖

前端变更:
- BackupTaskType 联合类型新增 'saphana',默认端口 30015
- StorageTargetType 联合类型新增 'ftp'
- 备份任务表单支持 SAP HANA 类型选择及数据库连接配置
- 存储目标表单新增 FTP 配置字段(主机/端口/用户名/密码/基础目录/TLS)

参考:backint_minio1.0.0/ Java 实现
This commit is contained in:
Awuqing
2026-03-21 16:09:14 +08:00
parent 9bfde8c632
commit 0330dd4700
11 changed files with 499 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ import (
"backupx/server/internal/storage/googledrive"
"backupx/server/internal/storage/localdisk"
storageAliyun "backupx/server/internal/storage/aliyun"
storageFTP "backupx/server/internal/storage/ftp"
storageTencent "backupx/server/internal/storage/tencent"
storageQiniu "backupx/server/internal/storage/qiniu"
storageS3 "backupx/server/internal/storage/s3"
@@ -76,12 +77,13 @@ func New(ctx context.Context, cfg config.Config, version string) (*Application,
storageAliyun.NewFactory(),
storageTencent.NewFactory(),
storageQiniu.NewFactory(),
storageFTP.NewFactory(),
)
storageTargetService := service.NewStorageTargetService(storageTargetRepo, oauthSessionRepo, storageRegistry, configCipher)
storageTargetService.SetBackupTaskRepository(backupTaskRepo)
storageTargetService.SetBackupRecordRepository(backupRecordRepo)
backupTaskService := service.NewBackupTaskService(backupTaskRepo, storageTargetRepo, configCipher)
backupRunnerRegistry := backup.NewRegistry(backup.NewFileRunner(), backup.NewSQLiteRunner(), backup.NewMySQLRunner(nil), backup.NewPostgreSQLRunner(nil))
backupRunnerRegistry := backup.NewRegistry(backup.NewFileRunner(), backup.NewSQLiteRunner(), backup.NewMySQLRunner(nil), backup.NewPostgreSQLRunner(nil), backup.NewSAPHANARunner(nil))
logHub := backup.NewLogHub()
retentionService := backupretention.NewService(backupRecordRepo)
notifyRegistry := notify.NewRegistry(notify.NewEmailNotifier(), notify.NewWebhookNotifier(), notify.NewTelegramNotifier())