internal

package
v3.2.0-M4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package internal should be considered as an internal subpackage of labelsutil. It should not be used directly.

This package contains a set of functions and types that are public for use by reflexion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComparableOperator

type ComparableOperator struct {
	Type  string  `parser:"@CompOperators"`
	Value float64 `parser:"@Number"`
	Unit  *string `parser:"[@(Ident|String|Number)]"`
}

ComparableOperator is public for use by reflexion but it should be considered as this whole package as internal and not used directly

type ComparisonFilter

type ComparisonFilter struct {
	LabelKey string
	Cop      ComparisonOperator
	Value    float64
	Unit     string
}

ComparisonFilter is a filter checking if a label is higher than a certain value

func (*ComparisonFilter) Matches

func (f *ComparisonFilter) Matches(labels map[string]string) (bool, error)

Matches implementation of labelsutil.Filter.Matches()

type ComparisonOperator

type ComparisonOperator int

ComparisonOperator is used to define the type of comparison used into comparison filter

const (
	//Inf represents the less than operator <
	Inf ComparisonOperator = iota
	//Sup represents the sup than operator >
	Sup ComparisonOperator = iota
	//Infeq represents the inferior or equal operator =<
	Infeq ComparisonOperator = iota
	//Supeq represents the superior or equal operator >=
	Supeq ComparisonOperator = iota
	//Eq represents the equal operator ==
	Eq ComparisonOperator = iota
	//Neq represents the not equal operator !=
	Neq ComparisonOperator = iota
)

type CompositeFilter

type CompositeFilter struct {
	Strat CompositionStrategy //combination operator, AND or OR
	// contains filtered or unexported fields
}

CompositeFilter is a filter made of other filters, combined using AND method

func (*CompositeFilter) Matches

func (f *CompositeFilter) Matches(labels map[string]string) (bool, error)

Matches implementation of labelsutil.Filter.Matches()

type CompositionStrategy

type CompositionStrategy int

CompositionStrategy is used to define the type of combination used into composite filter

const (
	//And represents the AND combination, all component filters have to match for the composite filter to match.
	And CompositionStrategy = iota
	//Or represents the OR combination, at least one  component filter have to match for the composite filter to match.
	Or CompositionStrategy = iota
)

type EqOperator

type EqOperator struct {
	Type   string   `parser:"@EqOperator"`
	ValueS *string  `parser:"@(String"`
	ValueN *float64 `parser:"| Number"`
	ValueU *string  `parser:"[(Ident|String|Number)])"`
}

EqOperator is public for use by reflexion but it should be considered as this whole package as internal and not used directly

type Filter

type Filter interface {
	Matches(labels map[string]string) (bool, error)
}

Filter is a general abstract filtering type

func FilterFromString

func FilterFromString(input string) (Filter, error)

FilterFromString generates a Filter from a given input string

type KeyFilter

type KeyFilter struct {
	LabelKey string
	Strat    KeyFilterStrat
}

KeyFilter is a filter checking if a label is existing or not

func (*KeyFilter) Matches

func (f *KeyFilter) Matches(labels map[string]string) (bool, error)

Matches implementation of labelsutil.Filter.Matches()

type KeyFilterStrat

type KeyFilterStrat int

KeyFilterStrat is used to define the type of combination used into LabelExists filter

const (
	//Present is used to check if the label exists
	Present KeyFilterStrat = iota
	//Absent is used to check if the label does not exists
	Absent KeyFilterStrat = iota
)

type ParsedFilter

type ParsedFilter struct {
	NotExists          *string             `parser:"[@NotExists]"`
	LabelName          string              `parser:"@(Ident|String)"`
	EqOperator         *EqOperator         `parser:"[ @@ "`
	SetOperator        *SetOperator        `parser:"| @@ "`
	ComparableOperator *ComparableOperator `parser:"| @@ "`
	RegexOperator      *RegexOperator      `parser:"| @@ ]"`
}

ParsedFilter is public for use by reflexion but it should be considered as this whole package as internal and not used directly

type RegexFilter

type RegexFilter struct {
	LabelKey string
	Strat    RegexStrategy
	Regex    string
}

RegexFilter is a filter checking if a label matches a regular expression

func (*RegexFilter) Matches

func (f *RegexFilter) Matches(labels map[string]string) (bool, error)

Matches implementation of labelsutil.Filter.Matches()

type RegexOperator

type RegexOperator struct {
	Type  string `parser:"@RegexOperator"`
	Value string `parser:"@String"`
}

RegexOperator is public for use by reflexion but it should be considered as this whole package as internal and not used directly

type RegexStrategy

type RegexStrategy int

RegexStrategy is used to define the type of search used into regexp filter

const (
	//Contains is used to check if the label contains the regex of the filter
	Contains RegexStrategy = iota
	//Excludes is used to check whether the label does not contains the regex of the filter
	Excludes RegexStrategy = iota
	//Matches is used to check whether the label matches strictly the regex
	Matches RegexStrategy = iota
	//Differs is used to check whether the label differs from the regex
	Differs RegexStrategy = iota
)

type SetOperator

type SetOperator struct {
	Type   string   `parser:"@Keyword '(' "`
	Values []string `parser:"@(Ident|String|Number) {','  @(Ident|String|Number)}')'"`
}

SetOperator is public for use by reflexion but it should be considered as this whole package as internal and not used directly

Jump to

Keyboard shortcuts

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