sets_v2

package
v0.31.8-gp Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceDelta

type ResourceDelta[T client.Object] struct {
	// the resources inserted into the set
	Inserted ResourceSet[T]
	// the resources removed from the set
	Removed ResourceSet[T]
}

ResourceDelta represents the set of changes between two ResourceSets.

func (*ResourceDelta[T]) DeltaV1

func (r *ResourceDelta[T]) DeltaV1() sk_sets.ResourceDelta

type ResourceSet

type ResourceSet[T client.Object] interface {
	// Get the set stored keys
	Keys() sets.String
	// List of resources stored in the set. Pass an optional filter function to filter on the list.
	List(filterResource ...func(T) bool) []T
	// Unsorted list of resources stored in the set. Pass an optional filter function to filter on the list.
	UnsortedList(filterResource ...func(T) bool) []T
	// Return the Set as a map of key to resource.
	Map() map[string]T
	// Insert a resource into the set.
	Insert(resource ...T)
	// Compare the equality of the keys in two sets (not the resources themselves)
	Equal(set ResourceSet[T]) bool
	// Check if the set contains a key matching the resource (not the resource itself)
	Has(resource T) bool
	// Delete the key matching the resource
	Delete(resource T)
	// Return the union with the provided set
	Union(set ResourceSet[T]) ResourceSet[T]
	// Return the difference with the provided set
	Difference(set ResourceSet[T]) ResourceSet[T]
	// Return the intersection with the provided set
	Intersection(set ResourceSet[T]) ResourceSet[T]
	// Find the resource with the given ID
	Find(id ezkube.ResourceId) (T, error)
	// Get the length of the set
	Length() int
	// returns the generic implementation of the set
	Generic() sk_sets.ResourceSet
	// returns the delta between this and and another ResourceSet[T]
	Delta(newSet ResourceSet[T]) sk_sets.ResourceDelta
	// Clone returns a deep copy of the set
	Clone() ResourceSet[T]
}

func NewResourceSet

func NewResourceSet[T client.Object](resources ...T) ResourceSet[T]

Jump to

Keyboard shortcuts

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