初始化
This commit is contained in:
29
server/model/storage_assignment.go
Normal file
29
server/model/storage_assignment.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// StorageAssignment 存储策略分配
|
||||
// 支持: 用户专属 > 角色 > 系统默认
|
||||
// 同一用户可通过多个角色获得多个存储策略, 按优先级调度
|
||||
type StorageAssignment struct {
|
||||
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||
PolicyID uint64 `json:"policy_id" gorm:"index;not null"` // 存储策略ID
|
||||
|
||||
// 分配目标
|
||||
UserID uint64 `json:"user_id" gorm:"index;default:0"` // 用户专属(0=不按用户)
|
||||
GroupID uint64 `json:"group_id" gorm:"index;default:0"` // 角色(0=不按角色)
|
||||
IsDefault int8 `json:"is_default" gorm:"default:0"` // 系统默认(1=是)
|
||||
|
||||
// 调度配置
|
||||
Priority int `json:"priority" gorm:"default:0"` // 优先级, 数值越大越优先
|
||||
StorageQuota int64 `json:"storage_quota" gorm:"default:0"` // 配额(字节), 0=不限
|
||||
AccessMode string `json:"access_mode" gorm:"size:32"` // 访问模式覆盖
|
||||
|
||||
Status int8 `json:"status" gorm:"default:1"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (StorageAssignment) TableName() string {
|
||||
return "fs_storage_assignment"
|
||||
}
|
||||
Reference in New Issue
Block a user