extendedresourcecache

package
v0.35.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtendedResourceCache

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

ExtendedResourceCache maintains a global cache of extended resource to device class mappings, based on informer events. For that it implements the cache.ResourceEventHandler interface.

func NewExtendedResourceCache

func NewExtendedResourceCache(logger klog.Logger, handlers ...cache.ResourceEventHandler) *ExtendedResourceCache

NewExtendedResourceCache creates a new ExtendedResourceCache instance. The caller is responsible for registering the instance as a handler of DeviceClass events.

Additional event handlers may be registered here or via AddEventHandler.

func (*ExtendedResourceCache) AddEventHandler

func (c *ExtendedResourceCache) AddEventHandler(handler cache.ResourceEventHandler)

AddEventHandler adds an event handler which gets called after the cache has processed some incoming event. More than one additional event handler may be added. They will be called in the order in which they were registered. GetDeviceClass may be called from those event handlers.

Not thread-safe, must be called *before* adding the cache itself to an informer.

func (*ExtendedResourceCache) GetDeviceClass

func (c *ExtendedResourceCache) GetDeviceClass(resourceName v1.ResourceName) *resourceapi.DeviceClass

GetDeviceClass returns the device class for the given extended resource name. Returns nil if the resource name is not found in the cache.

This (and only this) method may be called on a nil ExtendedResourceCache. The nil instance always returns nil.

func (*ExtendedResourceCache) GetExtendedResource

func (c *ExtendedResourceCache) GetExtendedResource(className string) string

GetExtendedResource returns the extended resource name for the given device class name. Returns empty string if the class name is not found in the cache.

func (*ExtendedResourceCache) OnAdd

func (c *ExtendedResourceCache) OnAdd(obj interface{}, isInInitialList bool)

OnAdd handles the addition of a new device class.

func (*ExtendedResourceCache) OnDelete

func (c *ExtendedResourceCache) OnDelete(obj interface{})

OnDelete handles deletion of a device class.

func (*ExtendedResourceCache) OnUpdate

func (c *ExtendedResourceCache) OnUpdate(oldObj, newObj interface{})

OnUpdate handles updates to an existing device class.

Jump to

Keyboard shortcuts

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