out.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. 
  2. package quota // import "imuslab.com/arozos/mod/quota"
  3. TYPES
  4. type QuotaHandler struct {
  5. TotalStorageQuota int64
  6. UsedStorageQuota int64
  7. // Has unexported fields.
  8. }
  9. func NewUserQuotaHandler(database *db.Database, username string, fsh []*fs.FileSystemHandler, defaultQuota int64) *QuotaHandler
  10. Create a storage quotation handler for this user
  11. func (q *QuotaHandler) AllocateSpace(filesize int64) error
  12. Claim a space for the given file and set the file ownership to this user
  13. func (q *QuotaHandler) CalculateQuotaUsage()
  14. func (q *QuotaHandler) GetUserStorageQuota() int64
  15. func (q *QuotaHandler) HaveSpace(size int64) bool
  16. func (q *QuotaHandler) ReclaimSpace(filesize int64) error
  17. Reclaim file occupied space (Call this before removing it)
  18. func (q *QuotaHandler) RemoveUserQuota()
  19. func (q *QuotaHandler) SetUserStorageQuota(quota int64)
  20. Set and Get the user storage quota
  21. func (q *QuotaHandler) UpdateUserStoragePool(fsh []*fs.FileSystemHandler)
  22. Update the user's storage pool to new one