Documentation
¶
Index ¶
- Variables
- type BucketStore
- func (bs *BucketStore) CreateBucket(name string, limit int32, duration time.Duration) *limiter.DurationLimiter
- func (bs *BucketStore) CreateWaitForBucket(name string, limit int32, duration time.Duration) (err error)
- func (bs *BucketStore) ResetBucket(name string) bool
- func (bs *BucketStore) WaitForBucket(name string) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuchBucket = errors.New("bucket does not exist. Use CreateWaitForBucket instead")
ErrNoSuchBucket is when a Bucket was requested that does not exist. Use CreateWaitForBucket to create a bucket if it does not exist.
Functions ¶
This section is empty.
Types ¶
type BucketStore ¶
type BucketStore struct { Buckets map[string]*limiter.DurationLimiter BucketsMu sync.RWMutex }
BucketStore is used for managing various limiters.
func NewBucketStore ¶
func NewBucketStore() (bs *BucketStore)
NewBucketStore creates a new Buckets map to store different limits.
func (*BucketStore) CreateBucket ¶
func (bs *BucketStore) CreateBucket(name string, limit int32, duration time.Duration) *limiter.DurationLimiter
CreateBucket will create a new bucket or overwrite.
func (*BucketStore) CreateWaitForBucket ¶
func (bs *BucketStore) CreateWaitForBucket(name string, limit int32, duration time.Duration) (err error)
CreateWaitForBucket will create a bucket if it does not exist and then will wait for it.
func (*BucketStore) ResetBucket ¶
func (bs *BucketStore) ResetBucket(name string) bool
ResetBucket resets the bucket.
func (*BucketStore) WaitForBucket ¶
func (bs *BucketStore) WaitForBucket(name string) (err error)
WaitForBucket will wait for a bucket to be ready.
Click to show internal directories.
Click to hide internal directories.