selectors

package
v1.28.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BiMultimap

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

BiMultimap is an efficient, bi-directional mapping of object keys. Associations are created by putting keys with a selector.

func NewBiMultimap

func NewBiMultimap() *BiMultimap

NewBiMultimap creates a map.

func (*BiMultimap) Delete

func (m *BiMultimap) Delete(key Key)

Delete removes a labeled object and incoming associations.

func (*BiMultimap) DeleteSelector

func (m *BiMultimap) DeleteSelector(key Key)

DeleteSelector deletes a selecting object and associations created by its selector.

func (*BiMultimap) Exists

func (m *BiMultimap) Exists(key Key) bool

Exists returns true if the labeled object is present in the map.

func (*BiMultimap) KeepOnly

func (m *BiMultimap) KeepOnly(keys []Key)

KeepOnly retains only the specified labeled objects and deletes the rest. Like calling Delete for all keys not specified.

func (*BiMultimap) KeepOnlySelectors

func (m *BiMultimap) KeepOnlySelectors(keys []Key)

KeepOnlySelectors retains only the specified selecting objects and deletes the rest. Like calling DeleteSelector for all keys not specified.

func (*BiMultimap) Put

func (m *BiMultimap) Put(key Key, labels map[string]string)

Put inserts or updates an object and the incoming associations based on the object labels.

func (*BiMultimap) PutSelector

func (m *BiMultimap) PutSelector(key Key, selector pkglabels.Selector)

PutSelector inserts or updates an object with a selector. Associations are created or updated based on the selector.

func (*BiMultimap) ReverseSelect

func (m *BiMultimap) ReverseSelect(key Key) (keys []Key, ok bool)

ReverseSelect finds objects selecting the given object. If the given key was found in the map `ok` will be true. Otherwise false.

func (*BiMultimap) Select

func (m *BiMultimap) Select(key Key) (keys []Key, ok bool)

Select finds objects associated with a selecting object. If the given key was found in the map `ok` will be true. Otherwise false.

func (*BiMultimap) SelectorExists

func (m *BiMultimap) SelectorExists(key Key) bool

SelectorExists returns true if the selecting object is present in the map.

type Key

type Key struct {
	Name      string
	Namespace string
}

Key is a tuple of name and namespace.

func Parse

func Parse(s string) (key Key)

Parse turns a string in the format namespace/name into a Key.

func (Key) String

func (k Key) String() string

Jump to

Keyboard shortcuts

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