roundrobin

package module
v0.0.0-...-c95f2a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 2 Imported by: 0

README

round-robin

round-robin is balancing algorithm written in golang

Requrement

Go (>= 1.8)

Installation

go get github.com/hlts2/round-robin

Example

rr, err := roundrobin.New([]string{
    "server-1",
    "server-2",
    "server-3",
})

rr.Next() // server-1
rr.Next() // server-2
rr.Next() // server-3
rr.Next() // server-1
rr.Next() // server-2
rr.Next() // server-3

Author

hlts2

LICENSE

round-robin released under MIT license, refer LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServersNotExists = errors.New("servers dose not exist")

ErrServersNotExists is the error that servers dose not exists

Functions

This section is empty.

Types

type RoundRobin

type RoundRobin interface {
	Next() string
}

RoundRobin represents base round-robin interface

func New

func New(addrs []string) (RoundRobin, error)

New returns RoundRobin(*roundrobin) object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL