random

package
v0.0.0-...-f944a7c Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandomBalancer

type RandomBalancer struct {
	// contains filtered or unexported fields
}

func NewRandomBalancer

func NewRandomBalancer(balancees []url.URL, options RandomBalancerOptions, next http.Handler) *RandomBalancer

NewRandomBalancer gives a new ChoiceOfBalancer back

func (*RandomBalancer) Add

func (b *RandomBalancer) Add(u *url.URL) error

Add a url to the loadbalancer

func (*RandomBalancer) ConfiguredRandomInt

func (b *RandomBalancer) ConfiguredRandomInt() string

ConfiguredRandomInt returns the string representation of the random generator assigned to the balancee. Used for testing.

func (*RandomBalancer) NumberOfBalancees

func (b *RandomBalancer) NumberOfBalancees() int

NumberOfBalancees returns the number of balancees that this balancer knows about

func (*RandomBalancer) Remove

func (b *RandomBalancer) Remove(u *url.URL) error

Remove a url from the loadbalancer.

func (*RandomBalancer) RequestCount

func (b *RandomBalancer) RequestCount(u *url.URL) int

RequestCount gives back the number of requests that have come into a particular URL

func (*RandomBalancer) ServeHTTP

func (b *RandomBalancer) ServeHTTP(w http.ResponseWriter, req *http.Request)

type RandomBalancerOptions

type RandomBalancerOptions struct {
	RandomGenerator util.RandomInt
	IsTesting       bool
}

Jump to

Keyboard shortcuts

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