LeakyBucketClone wraps the underlying bucket on the TestBucket with a LeakyBucket and returns a new TestBucket handle.
(c LeakyBucketConfig)
| 76 | |
| 77 | // LeakyBucketClone wraps the underlying bucket on the TestBucket with a LeakyBucket and returns a new TestBucket handle. |
| 78 | func (tb *TestBucket) LeakyBucketClone(c LeakyBucketConfig) *TestBucket { |
| 79 | return &TestBucket{ |
| 80 | Bucket: NewLeakyBucket(tb.Bucket, c), |
| 81 | BucketSpec: tb.BucketSpec, |
| 82 | closeFn: tb.Close, |
| 83 | t: tb.t, |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // NoCloseClone returns a leaky bucket with a no-op close function for the given bucket. |
| 88 | func NoCloseClone(b Bucket) *LeakyBucket { |