func (bs *BucketStore) ResetBucket(name string) bool {
	bs.BucketsMu.RLock()
	bucket, exists := bs.Buckets[name]
	bs.BucketsMu.RUnlock()
	if !exists {
		return false
	}
	bucket.Reset()
	return true
}
ResetBucket resets the bucket.
package bucketstore
import (
	"errors"
	"sync"
	"time"
	"github.com/TheRockettek/Sandwich-Daemon/pkg/limiter"
)
var ErrNoSuchBucket = errors.New("bucket does not exist. Use CreateWaitForBucket instead")
type BucketStore struct {
	Buckets   map[string]*limiter.DurationLimiter
	BucketsMu sync.RWMutex
}
func NewBucketStore() (bs *BucketStore) {
	return &BucketStore{
		Buckets:   make(map[string]*limiter.DurationLimiter),
		BucketsMu: sync.RWMutex{},
	}
}
func (bs *BucketStore) CreateBucket(name string, limit int32, duration time.Duration) *limiter.DurationLimiter {
	bs.BucketsMu.RLock()
	bucket, exists := bs.Buckets[name]
	bs.BucketsMu.RUnlock()
	if exists {
		return bucket
	}
	bucket = limiter.NewDurationLimiter(name, limit, duration)
	bs.BucketsMu.Lock()
	bs.Buckets[name] = bucket
	bs.BucketsMu.Unlock()
	return bucket
}
func (bs *BucketStore) WaitForBucket(name string) (err error) {
	bs.BucketsMu.RLock()
	bucket, exists := bs.Buckets[name]
	bs.BucketsMu.RUnlock()
	if !exists {
		return ErrNoSuchBucket
	}
	bucket.Lock()
	return
}