mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-10 17:26:38 +08:00
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:
@@ -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 ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user