Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBucketCircularAlias = xerrors.New("Bucket references itself")
ErrBucketCircularAlias is raised when a bucket references itself down a stack.
View Source
var ErrBucketDoesNotExist = xerrors.New("Bucket does not exist")
ErrBucketDoesNotExist is raised when attempting to fetch a bucket that does not exist.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct { Mu sync.RWMutex Name string Alias string // When handling the bucket lock, make sure you check the global bucket if it has // been defined. Global string Limit *int32 Duration *int64 ResetsAt *int64 Available *int32 }
Bucket represents a ratelimit bucket.
func CreateBucket ¶
func CreateBucket(name string, limit int32, duration time.Duration, alias string, global string) (b *Bucket)
CreateBucket creates a new bucket.
Click to show internal directories.
Click to hide internal directories.