tightrope

package module
v0.0.0-...-3b170d0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 3 Imported by: 0

README

tightrope

A concurrency framework that allows for load balancing within a single process.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TimeOut

func TimeOut(timeoutDuration time.Duration, timeout chan<- bool)

TimeOut :

Types

type Balancer

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

func InitBalancer

func InitBalancer(workerCount int, maxWorkBuffer int, execute Execute) *Balancer

func InitBalancer(workerCount int, maxWorkBuffer int, execute Execute) *Balancer {

func (*Balancer) Balance

func (b *Balancer) Balance(req chan Request, printStats bool, timeoutDuration time.Duration)

func (*Balancer) Completed

func (b *Balancer) Completed(w *Worker)

func (*Balancer) Dispatch

func (b *Balancer) Dispatch(req Request)

func (*Balancer) Print

func (b *Balancer) Print()

func (*Balancer) Purge

func (b *Balancer) Purge()

func (*Balancer) StopAllWorkersGraceFully

func (b *Balancer) StopAllWorkersGraceFully()

type Execute

type Execute func(Request)

type Pool

type Pool []*Worker

func (Pool) Len

func (p Pool) Len() int

func (Pool) Less

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

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 {
	Data     interface{}
	Response chan interface{}
}

type Worker

type Worker struct {
	Index    int
	WorkerID int
	Work     chan Request
	Pending  int
	Complete int
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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