queue

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequestQueuePortName specifies the port name to use for http requests
	// in queue-proxy container.
	RequestQueuePortName string = "queue-port"

	// RequestQueuePort specifies the port number to use for http requests
	// in queue-proxy container.
	RequestQueuePort = 8012

	// RequestQueueAdminPortName specifies the port name for
	// health check and lifecyle hooks for queue-proxy.
	RequestQueueAdminPortName string = "queueadm-port"

	// RequestQueueAdminPort specifies the port number for
	// health check and lifecyle hooks for queue-proxy.
	RequestQueueAdminPort = 8022

	// RequestQueueQuitPath specifies the path to send quit request to
	// queue-proxy. This is used for preStop hook of queue-proxy. It:
	// - marks the service as not ready, so that requests will no longer
	//   be routed to it,
	// - adds a small delay, so that the container doesn't get killed at
	//   the same time the pod is marked for removal.
	RequestQueueQuitPath = "quitquitquit"

	// RequestQueueHealthPath specifies the path for health checks for
	// queue-proxy.
	RequestQueueHealthPath = "health"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Breaker

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

Breaker is a component that enforces a concurrency limit on the execution of a function. It also maintains a queue of function executions in excess of the concurrency limit. Function call attempts beyond the limit of the queue are failed immediately.

func NewBreaker

func NewBreaker(queueDepth, maxConcurrency int32) *Breaker

NewBreaker creates a Breaker with the desired queue depth and concurrency limit.

func (*Breaker) Maybe

func (b *Breaker) Maybe(thunk func()) bool

Maybe conditionally executes thunk based on the Breaker concurrency and queue parameters. If the concurrency limit and queue capacity are already consumed, Maybe returns immediately without calling thunk. If the thunk was executed, Maybe returns true, else false.

type Channels

type Channels struct {
	// Ticks with every request arrived/completed respectively
	ReqChan chan ReqEvent
	// Ticks with every stat report request
	ReportChan <-chan time.Time
	// Stat reporting channel
	StatChan chan *autoscaler.Stat
}

Channels is a structure for holding the channels for driving Stats. It's just to make the NewStats signature easier to read.

type ReqEvent

type ReqEvent struct {
	Time      time.Time
	EventType ReqEventType
}

ReqEvent represents either an incoming or closed request.

type ReqEventType added in v0.2.0

type ReqEventType int

ReqEventType denotes the type (incoming/closed) of a ReqEvent.

const (
	// ReqIn represents an incoming request
	ReqIn ReqEventType = iota
	// ReqOut represents a finished request
	ReqOut
)

type Stats

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

Stats is a structure for holding channels per pod.

func NewStats

func NewStats(podName string, channels Channels, startedAt time.Time) *Stats

NewStats instantiates a new instance of Stats.

Jump to

Keyboard shortcuts

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