label

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package label contains function managing labels and selectors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitSelectors

func SplitSelectors(s string) []string

Types

type Claims

type Claims map[string][]string

Claims provide a facility for prioritizing jobs execution onto consumers with matching claims. Queues can be configured with a claim window, a duration during which only consumers with matching claims can dequeue the job. After the duration elapses, dequeue behavior returns to normal.

func ParseClaims

func ParseClaims(claims []string) (Claims, error)

func (Claims) Format

func (c Claims) Format() []string

func (Claims) Match

func (c Claims) Match(other Claims) bool

type Labels

type Labels map[string]string

Labels can be used to filter queues. Their format is: "KEY=VALUE[,KEY=VALUE...]"

func ParseStringArray

func ParseStringArray(args []string) (Labels, error)

ParseStringArray reads an array of formatted labels, such as commandline flags.

func (Labels) Equals

func (l Labels) Equals(other Labels) bool

func (Labels) String

func (l Labels) String() string

type Selectors

type Selectors struct {
	Names    []string            `json:"names,omitempty"`
	NotNames []string            `json:"not_names,omitempty"`
	In       map[string][]string `json:"in,omitempty"`
	NotIn    map[string][]string `json:"not_in,omitempty"`
}

Selectors can be used to filter queues based on their labels.

func ParseSelectorStringArray

func ParseSelectorStringArray(sels []string) (*Selectors, error)

func ParseSelectors

func ParseSelectors(s string) (*Selectors, error)

func (*Selectors) CacheKey

func (s *Selectors) CacheKey() string

CacheKey returns a string that can be used as a cache key for the selector values.

func (*Selectors) Len

func (s *Selectors) Len() int

func (*Selectors) Match

func (s *Selectors) Match(labels Labels) bool

func (*Selectors) String

func (s *Selectors) String() string

Jump to

Keyboard shortcuts

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