#weighted #robin #round #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 116/week @ 2024-03-11 208/week @ 2024-03-18 218/week @ 2024-03-25 187/week @ 2024-04-01 155/week @ 2024-04-08 272/week @ 2024-04-15 149/week @ 2024-04-22 91/week @ 2024-05-06 53/week @ 2024-05-13 2/week @ 2024-05-20 10/week @ 2024-05-27 49/week @ 2024-06-03 4/week @ 2024-06-24

55 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