Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/todd-a-jacobs/token_bucket.rb
A Ruby token bucket for availability-based scheduling.
https://github.com/todd-a-jacobs/token_bucket.rb
Last synced: about 2 months ago
JSON representation
A Ruby token bucket for availability-based scheduling.
- Host: GitHub
- URL: https://github.com/todd-a-jacobs/token_bucket.rb
- Owner: todd-a-jacobs
- License: other
- Created: 2014-10-23T00:06:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-24T17:01:49.000Z (about 10 years ago)
- Last Synced: 2023-03-11T07:43:17.175Z (almost 2 years ago)
- Language: Ruby
- Homepage:
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Project Name: [Ruby Token Bucket Demo][Home]
## Copyright and Licensing
### Copyright Notice
The copyright for the software, documentation, and associated files are held by
the author.Copyright 2014 Todd A. Jacobs
All rights reserved.The AUTHORS file is also included in the source tree.
### Software License
![GPLv3 Logo]
The software is licensed under the [GPLv3 License]. The LICENSE file is included
in the source tree.### README License
![Creative Commons BY-NC-SA Logo][CC Logo]
This README is licensed under the [Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 United States License][CC License].## Purpose
Demonstrate use of a token bucket for availability-based scheduling.
## Synopsis
Basic token bucket for availability-based scheduling. The caller never receives
an actual token; instead, a collaborator object is needed to track the tokens
that have been handed out.See the source code for additional documentation and examples.
## Examples
No screenshots here, just samples of what you can expect to see on a console
when you run the program.### Command Line
$ ./token_bucket.rb
#
[#,
#]John and Jane both try to schedule an appointment.
Who has a token, and is thus eligible to make an appointment?
[#]John cancels an appointment and Jane takes the returned token.
Who has a token, and is thus eligible to make an appointment?
[#]### REPL
require './token_bucket'
bucket = TokenBucket.new 1
#=> #bucket.request_token
#=> truebucket.inspect
#=> #bucket.request_token
#=> falsebucket.send :tokens
#=> 0bucket.release_token
#=> falsebucket.inspect
#=> #----
[Project Home Page][Home]
[Home]: https://github.com/CodeGnome/token_bucket.rb
[CC License]: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
[CC Logo]: http://i.creativecommons.org/l/by-nc-sa/3.0/us/88x31.png
[GPLv3 License]: http://www.gnu.org/copyleft/gpl.html
[GPLv3 Logo]: http://www.gnu.org/graphics/gplv3-88x31.png