1234567891011121314151617181920212223242526272829303132333435 |
-
- package quota // import "imuslab.com/arozos/mod/quota"
- TYPES
- type QuotaHandler struct {
- TotalStorageQuota int64
- UsedStorageQuota int64
- // Has unexported fields.
- }
- func NewUserQuotaHandler(database *db.Database, username string, fsh []*fs.FileSystemHandler, defaultQuota int64) *QuotaHandler
- Create a storage quotation handler for this user
- func (q *QuotaHandler) AllocateSpace(filesize int64) error
- Claim a space for the given file and set the file ownership to this user
- func (q *QuotaHandler) CalculateQuotaUsage()
- func (q *QuotaHandler) GetUserStorageQuota() int64
- func (q *QuotaHandler) HaveSpace(size int64) bool
- func (q *QuotaHandler) ReclaimSpace(filesize int64) error
- Reclaim file occupied space (Call this before removing it)
- func (q *QuotaHandler) RemoveUserQuota()
- func (q *QuotaHandler) SetUserStorageQuota(quota int64)
- Set and Get the user storage quota
- func (q *QuotaHandler) UpdateUserStoragePool(fsh []*fs.FileSystemHandler)
- Update the user's storage pool to new one
|