mix3 / go-wrr

Weightied RoundRobin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Coverage Status

go-wrr

from cpan module Data::WeightedRoundRobin

SYNOPSIS

package main

import "github.com/mix3/go-wrr"

func main() {
	rr := wrr.New(wrr.DataSlice{
		&wrr.Data{Value: "foo"},
		&wrr.Data{Value: "bar"},
		&wrr.Data{Value: "baz", Weight: 50},
		&wrr.Data{Key: "hoge", Value: []string{"fuga", "piyo"}, Weight: 120},
	})
	rr.Next() // 'foo' : 'bar' : 'baz' : []string{"fuga", "piyo"} = 100 : 100 : 50 : 120
}

About

Weightied RoundRobin


Languages

Language:Go 100.0%