github.com/unionj-cloud/go-doudou@v1.3.8-0.20221011095552-0088008e5b31/framework/ratelimit/limiter.go (about)

     1  package ratelimit
     2  
     3  import (
     4  	"context"
     5  	"time"
     6  )
     7  
     8  type Limiter interface {
     9  	Allow() bool
    10  	AllowE() (bool, error)
    11  	AllowCtx(ctx context.Context) bool
    12  	AllowECtx(ctx context.Context) (bool, error)
    13  
    14  	ReserveE() (time.Duration, bool, error)
    15  	ReserveECtx(ctx context.Context) (time.Duration, bool, error)
    16  
    17  	Wait(ctx context.Context) error
    18  }