Feat: use transactions to manipulate user's used storage

This commit is contained in:
HFO4
2022-02-27 14:24:17 +08:00
parent 285e80ba76
commit 521c5c8dc4
11 changed files with 56 additions and 81 deletions

View File

@@ -94,10 +94,15 @@ func (job *ImportTask) Do() {
}
defer fs.Recycle()
fs.Policy = &policy
if err := fs.DispatchHandler(); err != nil {
job.SetErrorMsg("无法分发存储策略", err)
return
}
// 注册钩子
fs.Use("BeforeAddFile", filesystem.HookValidateFile)
fs.Use("BeforeAddFile", filesystem.HookValidateCapacity)
fs.Use("AfterValidateFailed", filesystem.HookGiveBackCapacity)
// 列取目录、对象
job.TaskModel.SetProgress(ListingProgress)