#weighted #round #robin #wrr

roundrobin

A simple roundrobin implementation

2 releases

0.1.1 Dec 9, 2019
0.1.0 Dec 4, 2019

#2 in #robin

Download history 45/week @ 2023-11-24 74/week @ 2023-12-01 29/week @ 2023-12-08 39/week @ 2023-12-15 14/week @ 2023-12-22 6/week @ 2024-01-05 175/week @ 2024-01-12 124/week @ 2024-01-19 191/week @ 2024-01-26 158/week @ 2024-02-02 152/week @ 2024-02-09 126/week @ 2024-02-16 76/week @ 2024-02-23 96/week @ 2024-03-01 16/week @ 2024-03-08

364 downloads per month

MIT license

10KB
216 lines

Roundrobin

Build Status Latest version License

A weighted roundrobin implementation in Rustlang.

Quick Start

roundrobin-rs is available on crates.io.

Add the following dependency to your Cargo.toml:

[dependencies]
roundrobin = "0.1.0"

Example

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)

Dependencies

~87KB