-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify Limiter and update implementations
The Limiter now only has a Limit method that accepts a channel. Implementations now have been updated to reflect this interface and to rename the original "Limit(int, duration)" to "SimpleLimit".
- Loading branch information
1 parent
78eb782
commit f0077bb
Showing
6 changed files
with
150 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
package limio | ||
|
||
import ( | ||
"io" | ||
"time" | ||
) | ||
import "io" | ||
|
||
//A Limiter is an interface that meters some underlying discretely quantifiable | ||
//operation with respect to time. | ||
type Limiter interface { | ||
Limit(n int, t time.Duration) <-chan bool //The channel is useful for knowing that the channel has been unlimited | ||
LimitChan(chan int) <-chan bool | ||
Limit(chan int) <-chan bool //The channel is useful for knowing that the channel has been unlimited | ||
Unlimit() | ||
io.Closer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters