forked from mtusi2026/mtusi2026lab4
19 lines
565 B
Go
19 lines
565 B
Go
package admission
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
// ErrRate means the request exhausted a shared rate budget.
|
|
var ErrRate = errors.New("shared request rate exceeded")
|
|
|
|
// ErrSlots means the request exhausted a shared concurrency budget.
|
|
var ErrSlots = errors.New("shared execution slots exhausted")
|
|
|
|
// Distributed defines request admission independently of the backing database.
|
|
type Distributed interface {
|
|
// Enter reserves global/group or user/group budgets and returns a release operation.
|
|
Enter(ctx context.Context, group, user string) (func(), error)
|
|
}
|