rate.go 315 B

12345678910111213141516171819202122
  1. package rate
  2. import (
  3. "context"
  4. )
  5. // Op operations type.
  6. type Op int
  7. const (
  8. // Success opertion type: success
  9. Success Op = iota
  10. // Ignore opertion type: ignore
  11. Ignore
  12. // Drop opertion type: drop
  13. Drop
  14. )
  15. // Limiter limit interface.
  16. type Limiter interface {
  17. Allow(ctx context.Context) (func(Op), error)
  18. }