You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
648 B
Go
47 lines
648 B
Go
package domain
|
|
|
|
import (
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
type FileSizeQuota struct {
|
|
AllowanceKB int64
|
|
CurrentUsage int64
|
|
}
|
|
|
|
func (f *FileSizeQuota) Allows(size int64) bool {
|
|
return f.CurrentUsage + size <= f.AllowanceKB
|
|
}
|
|
|
|
func (f *FileSizeQuota) Add(size int64) {
|
|
f.CurrentUsage += size
|
|
}
|
|
|
|
func (f *FileSizeQuota) Remove(size int64) {
|
|
f.CurrentUsage -= size
|
|
}
|
|
|
|
type BogOutFile interface {
|
|
Path() string
|
|
Size() int64
|
|
Modified() time.Time
|
|
io.Reader
|
|
io.Seeker
|
|
io.Closer
|
|
}
|
|
|
|
type BogInFile interface {
|
|
Path() string
|
|
Size() int64
|
|
Modified() time.Time
|
|
io.Writer
|
|
io.Seeker
|
|
io.Closer
|
|
}
|
|
|
|
type FileReference struct {
|
|
Path string
|
|
UserAgent string
|
|
}
|