Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FuseOpLimiter ¶
type FuseOpLimiter struct {
// contains filtered or unexported fields
}
FuseOpLimiter enforces multiple classes of limits, plus an optional global limit.
func NewFuseOpLimiter ¶
func NewFuseOpLimiter(perClass map[FuseOpType]int64, global int64) *FuseOpLimiter
NewFuseOpLimiter creates a new MultiLimiter with the given per-class and global limits. A limit of 0 disables that limit.
func (*FuseOpLimiter) WithLimit ¶
func (m *FuseOpLimiter) WithLimit(ctx context.Context, cl FuseOpType, fn func(context.Context) error) error
WithLimit applies the class (and global) limit. Reentrant-safe: if the context already holds the class token, it won't acquire again.
type FuseOpType ¶
type FuseOpType uint8
FuseOpType represents the type of operation for limiting purposes.
e.g. upload vs download operations.
const ( // FuseOpUpload represents upload operations. FuseOpUpload FuseOpType // FuseOpDownload represents download operations. FuseOpDownload // FuseOpOther represents other operations. e.g. list, find, delete, etc. FuseOpOther )
Click to show internal directories.
Click to hide internal directories.