diff --git a/leakybucket.go b/leakybucket.go index 124b3c6..4bed13e 100644 --- a/leakybucket.go +++ b/leakybucket.go @@ -38,6 +38,8 @@ type LeakyBucketStateBackend interface { State(ctx context.Context) (LeakyBucketState, error) // SetState sets (persists) the current state of the LeakyBucket. SetState(ctx context.Context, state LeakyBucketState) error + // Reset resets (persists) the current state of the LeakyBucket. + Reset(ctx context.Context) error } // LeakyBucket implements the https://en.wikipedia.org/wiki/Leaky_bucket#As_a_queue algorithm. diff --git a/tokenbucket.go b/tokenbucket.go index 16fc8ec..13186e1 100644 --- a/tokenbucket.go +++ b/tokenbucket.go @@ -40,6 +40,8 @@ type TokenBucketStateBackend interface { State(ctx context.Context) (TokenBucketState, error) // SetState sets (persists) the current state of the TokenBucket. SetState(ctx context.Context, state TokenBucketState) error + // Reset resets (persists) the current state of the TokenBucket. + Reset(ctx context.Context) error } // TokenBucket implements the https://en.wikipedia.org/wiki/Token_bucket algorithm.