refactor(storage): update Backend.Put to return PutResult and encapsulate bucket mapping

- Update Backend.Put method signature in storage.go to return (PutResult, error).
- Adjust all backend implementations (local, oss, s3, webdav) to return a PutResult enclosing Key and Bucket.
- Refactor storeUploadFile in upload routers.go to extract key/bucket from PutResult, eliminating manual config bucket lookups.
- Remove the unused cfgBucket helper from storage_ops.go.
- Adjust storage_migration_task.go and tests to accommodate the updated method signature.
This commit is contained in:
ryan
2026-06-13 15:48:41 +08:00
parent ce9423f877
commit 1d37242a8b
9 changed files with 37 additions and 57 deletions
+1 -18
View File
@@ -67,21 +67,4 @@ func currentMigrationTargetConfig(ctx context.Context) (storage.Config, bool, er
return target, true, nil
}
func cfgBucket(ctx context.Context, driver storage.Driver) string {
cfg, err := storage.LoadConfig(ctx)
if err != nil {
return ""
}
switch driver {
case storage.DriverS3:
return cfg.S3.Bucket
case storage.DriverR2:
return cfg.R2.Bucket
case storage.DriverMinIO:
return cfg.MinIO.Bucket
case storage.DriverOSS:
return cfg.OSS.Bucket
default:
return ""
}
}