lib

package
v0.0.0-...-a8c38d1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

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

func NewBalancer

func NewBalancer(numWorkers int, requestBufferSize int) *Balancer

func (*Balancer) Balance

func (b *Balancer) Balance(work chan *Request)

type Pool

type Pool []*Worker

A list of workers. We'll use a heap to respond to requests based on the worker that is the least busy.

func (*Pool) Len

func (p *Pool) Len() int

func (Pool) Less

func (p Pool) Less(i, j int) bool

The worker with the smallest number of pending requests will bubble to the top of the heap.

func (*Pool) Pop

func (p *Pool) Pop() interface{}

func (*Pool) Push

func (p *Pool) Push(x interface{})

func (*Pool) Swap

func (p *Pool) Swap(i, j int)

type Request

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

func NewRequest

func NewRequest(http_req *http.Request, r http.ResponseWriter) Request

func (Request) Respond

func (r Request) Respond()

func (*Request) String

func (r *Request) String() string

type Worker

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

func NewWorker

func NewWorker(id, reqBufferSize int, backend url.URL) Worker

func (Worker) String

func (w Worker) String() string

Jump to

Keyboard shortcuts

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