fix(upload): 分片上传 - 先预留配额并原子提交容量 (#679)

Co-authored-by: ddcat666 <26564566+ddcat666@users.noreply.github.com>
This commit is contained in:
Catlaxy AI
2026-10-06 09:42:48 +08:00
committed by GitHub
parent 398f8e36f5
commit 2cc53fa25c
16 changed files with 661 additions and 36 deletions

View File

@@ -0,0 +1,13 @@
package model
import "time"
// UploadReservation survives process restarts; expiry, not process ownership,
// bounds its lifetime. Day records the UTC quota bucket charged at admission.
type UploadReservation struct {
ID string `gorm:"primaryKey;size:64"`
UserID string `gorm:"index;size:64;not null"`
Size int64 `gorm:"not null"`
Day string `gorm:"size:10;not null"`
ExpiresAt time.Time `gorm:"index;not null"`
}