orderings

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0, MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrderingBuilder

func NewOrderingBuilder(builder OrderingBuilder) gPlacement.OrderingBuilder

NewOrderingBuilder creates a new builder for building orderings.

Types

type OrderingBuilder

type OrderingBuilder interface {
	// Generate will generate a custom ordering that depends on the random source and the time.
	Generate(random generation.Random, time time.Duration) placement.Ordering
}

OrderingBuilder is used to generate new orderings for use in tests and benchmarks.

func Concatenate

func Concatenate(subBuilders ...OrderingBuilder) OrderingBuilder

Concatenate creates a custom ordering builder that takes a list of orderings and then make a concatenation that will behave like a lexicographic ordering.

func Constant

func Constant(constant float64) OrderingBuilder

Constant creates a custom ordering builder that returns a tuple score which will always return a tuple of length one with the given constant.

func Inverse

func Inverse(subBuilder OrderingBuilder) OrderingBuilder

Inverse a custom ordering builder that will invert the given tuple.

func Label

func Label(scope, pattern labels.Template) OrderingBuilder

Label creates a custom ordering builder which order groups based on the number of their labels matching the given pattern.

func Map

func Map(mapping *orderings.Mapping, subBuilder OrderingBuilder) OrderingBuilder

Map creates a custom ordering builder that changes the tuple according to which bucket each entry of the tuple falls.

func Metric

func Metric(source orderings.Source, metricType metrics.Type) OrderingBuilder

Metric creates a custom ordering builder which orders groups based on their value of the given metric type.

func Multiply

func Multiply(subBuilders ...OrderingBuilder) OrderingBuilder

Multiply creates a custom ordering builder that takes the tuples of the sub expressions and return a tuple which will have the length of the smallest tuple returned from the sub expressions where each entry is the multiplication of the corresponding entry in the tuple from the sub expressions.

func Negate

func Negate(subBuilder OrderingBuilder) OrderingBuilder

Negate creates a custom ordering builder that negates the given tuple.

func Relation

func Relation(scope, pattern labels.Template) OrderingBuilder

Relation creates a custom ordering builder which orders groups based on the number of their relations matching the given pattern.

func Sum

func Sum(subBuilders ...OrderingBuilder) OrderingBuilder

Sum creates a custom ordering builder that takes the tuples of the sub expressions and return a tuple which will have the length of the smallest tuple returned from the sub expressions where each entry is the summation of the corresponding entry in the tuple from the sub expressions.

Jump to

Keyboard shortcuts

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