Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shonenada/roundrobin-rs
Weighted round robin implementation
https://github.com/shonenada/roundrobin-rs
roundrobin rust
Last synced: 26 days ago
JSON representation
Weighted round robin implementation
- Host: GitHub
- URL: https://github.com/shonenada/roundrobin-rs
- Owner: shonenada
- License: mit
- Created: 2019-11-29T08:35:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-09T03:25:52.000Z (almost 4 years ago)
- Last Synced: 2024-11-21T00:49:12.211Z (about 1 month ago)
- Topics: roundrobin, rust
- Language: Rust
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Roundrobin
[![Build Status](https://travis-ci.com/shonenada/roundrobin-rs.svg?branch=master)](https://travis-ci.com/shonenada/roundrobin-rs)
[![Latest version](https://img.shields.io/crates/v/roundrobin.svg)](https://crates.io/crates/roundrobin)
[![License](https://img.shields.io/crates/l/roundrobin.svg)](https://github.com/rust-lang-nursery/lazy-static.rs#license)A weighted roundrobin implementation in Rustlang.
## Quick Start
[roundrobin-rs](https://crates.io/crates/roundrobin) is available on crates.io.
Add the following dependency to your Cargo.toml:
```
[dependencies]
roundrobin = "0.1.1"
```## Example
```rust
use roundrobin::wrr::*;fn main() {
let url01 = "http://localhost:8081".to_string();
let url02 = "http://localhost:8082".to_string();
let server01 = Server::new(url01.clone(), 1);
let mut rr = WeightedRoundRobinBalancer::new();
rr.insert_server(server01); // default weight 1
rr.insert_url(url02.clone(), 2);
println!("Server: {}", rr.next().unwrap());
}
```## License
Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)