Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved documentation and add the “Available” function explain. #29

Merged
merged 1 commit into from
May 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ rate tokens per second up to the given maximum capacity. Because of limited
clock resolution, at high rates, the actual rate may be up to 1% different from
the specified rate.

#### func (*Bucket) Available

```go
func (tb *Bucket) Available() int64
```
Available returns the number of available tokens. It will be negative
when there are consumers waiting for tokens. Note that if this
returns greater than zero, it does not guarantee that calls that take
tokens from the buffer will succeed, as the number of available
tokens could have changed in the meantime. This method is intended
primarily for metrics reporting and debugging.

#### func (*Bucket) Rate

```go
Expand Down