bestof

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 ChoiceOfBalancer

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

ChoiceOfBalancer is a bookkeeping struct

func NewChoiceOfBalancer

func NewChoiceOfBalancer(balancees []url.URL, options ChoiceOfBalancerOptions, next http.Handler) *ChoiceOfBalancer

NewChoiceOfBalancer gives a new ChoiceOfBalancer back

func (*ChoiceOfBalancer) Add

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

Add a url to the loadbalancer

func (*ChoiceOfBalancer) ConfiguredChoices

func (b *ChoiceOfBalancer) ConfiguredChoices() int

ConfiguredChoices returns the configured number of choices to randomly choose and then pick the best of

func (*ChoiceOfBalancer) ConfiguredRandomInt

func (b *ChoiceOfBalancer) ConfiguredRandomInt() string

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

func (*ChoiceOfBalancer) HighWatermark

func (b *ChoiceOfBalancer) HighWatermark(u *url.URL) int

HighWatermark returns the most outstanding requests for a particular balancee

func (*ChoiceOfBalancer) NumberOfBalancees

func (b *ChoiceOfBalancer) NumberOfBalancees() int

NumberOfBalancees returns the number of balancees that this balancer knows about

func (*ChoiceOfBalancer) OutstandingRequests

func (b *ChoiceOfBalancer) OutstandingRequests(u *url.URL) int

OutstandingRequests returns the number of outstanding requests for a particular balancee

func (*ChoiceOfBalancer) Remove

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

Remove a url from the loadbalancer.

func (*ChoiceOfBalancer) RequestCount

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

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

func (*ChoiceOfBalancer) ServeHTTP

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

type ChoiceOfBalancerOptions

type ChoiceOfBalancerOptions struct {
	RandomGenerator util.RandomInt
	Choices         int
	IsTesting       bool
}

Jump to

Keyboard shortcuts

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