target

package
v0.0.0-...-33bb219 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueueLengthTarget

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

QueueLengthTarget is where we ant to keep the number of items in a queue under a certain length

func NewQueueLengthTarget

func NewQueueLengthTarget(length int) *QueueLengthTarget

NewQueueLengthTarget creates a new target for queues

func (*QueueLengthTarget) Delta

func (t *QueueLengthTarget) Delta(currentLength int) (delta int)

Delta returns the nuumber of additional containers we should add (remove if negative) to try to attain the target

func (*QueueLengthTarget) Exceeding

func (t *QueueLengthTarget) Exceeding(current int) bool

Exceeding returns true if the target is currently exceeded

func (*QueueLengthTarget) Meeting

func (t *QueueLengthTarget) Meeting(current int) bool

Meeting returns true if the target is currently met

type RemainderTarget

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

RemainderTarget is what we use as a target when we want to use any remaining capacity for this task

func NewRemainderTarget

func NewRemainderTarget(maxContainers int) *RemainderTarget

NewRemainderTarget creates a new remainder target

func (*RemainderTarget) Delta

func (t *RemainderTarget) Delta(current int) (delta int)

Delta returns the nuumber of additional containers we should add. For a remainder target we always try to get as many as we can.

func (*RemainderTarget) Exceeding

func (t *RemainderTarget) Exceeding(current int) bool

Exceeding returns true if the target is currently exceeded

func (*RemainderTarget) Meeting

func (t *RemainderTarget) Meeting(current int) bool

Meeting returns true if the target is currently met

type SimpleQueueLengthTarget

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

SimpleQueueLengthTarget aims to keep the number of items in a queue under a certain length This version tends to oscillate too much, so we prefer the version that uses a PD controller (queue.go)

func NewSimpleQueueLengthTarget

func NewSimpleQueueLengthTarget(length int) *SimpleQueueLengthTarget

NewSimpleQueueLengthTarget creates a new target based on simply adding or removing one container if we're above or below target

func (*SimpleQueueLengthTarget) Delta

func (t *SimpleQueueLengthTarget) Delta(currentLength int) (delta int)

Delta returns the nuumber of additional containers we should add (remove if negative) to try to attain the target

func (*SimpleQueueLengthTarget) Exceeding

func (t *SimpleQueueLengthTarget) Exceeding(current int) bool

Exceeding returns true if the target is currently exceeded

func (*SimpleQueueLengthTarget) Meeting

func (t *SimpleQueueLengthTarget) Meeting(current int) bool

Meeting returns true if the target is currently met

type Target

type Target interface {
	Meeting(int) bool
	Exceeding(int) bool
	Delta(int) int
}

Target is what we want the Metric to match. Each task has a Metric and a Target.

Jump to

Keyboard shortcuts

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