kubernetes/pkg/scheduler/util/assumecache/assume_cache.go

type Informer

// AddTestObject adds an object to the assume cache.
// Only use this for unit testing!
func AddTestObject(cache *AssumeCache, obj interface{}

// UpdateTestObject updates an object in the assume cache.
// Only use this for unit testing!
func UpdateTestObject(cache *AssumeCache, obj interface{}

// DeleteTestObject deletes object in the assume cache.
// Only use this for unit testing!
func DeleteTestObject(cache *AssumeCache, obj interface{}

var ErrWrongType

var ErrNotFound

var ErrObjectName

type WrongTypeError

func (e WrongTypeError) Error() string {}

func (e WrongTypeError) Is(err error) bool {}

type NotFoundError

func (e NotFoundError) Error() string {}

func (e NotFoundError) Is(err error) bool {}

type ObjectNameError

func (e ObjectNameError) Error() string {}

func (e ObjectNameError) Is(err error) bool {}

type AssumeCache

type objInfo

func objInfoKeyFunc(obj interface{}

func (c *AssumeCache) objInfoIndexFunc(obj interface{}

// NewAssumeCache creates an assume cache for general objects.
func NewAssumeCache(logger klog.Logger, informer Informer, description, indexName string, indexFunc cache.IndexFunc) *AssumeCache {}

func (c *AssumeCache) add(obj interface{}

func (c *AssumeCache) update(oldObj interface{}

func (c *AssumeCache) delete(obj interface{}

// pushEvent gets called while the mutex is locked for writing.
// It ensures that all currently registered event handlers get
// notified about a change when the caller starts delivering
// those with emitEvents.
//
// For a delete event, newObj is nil. For an add, oldObj is nil.
// An update has both as non-nil.
func (c *AssumeCache) pushEvent(oldObj, newObj interface{}

func (c *AssumeCache) getObjVersion(name string, obj interface{}

func (c *AssumeCache) getObjInfo(key string) (*objInfo, error) {}

// Get the object by its key.
func (c *AssumeCache) Get(key string) (interface{}

// GetAPIObj gets the informer cache's version by its key.
func (c *AssumeCache) GetAPIObj(key string) (interface{}

// List all the objects in the cache.
func (c *AssumeCache) List(indexObj interface{}

func (c *AssumeCache) listLocked(indexObj interface{}

// Assume updates the object in-memory only.
//
// The version of the object must be greater or equal to
// the current object, otherwise an error is returned.
//
// Storing an object with the same version is supported
// by the assume cache, but suffers from a race: if an
// update is received via the informer while such an
// object is assumed, it gets dropped in favor of the
// newer object from the apiserver.
//
// Only assuming objects that were returned by an apiserver
// operation (Update, Patch) is safe.
func (c *AssumeCache) Assume(obj interface{}

// Restore the informer cache's version of the object.
func (c *AssumeCache) Restore(objName string) {}

// AddEventHandler adds an event handler to the cache. Events to a
// single handler are delivered sequentially, but there is no
// coordination between different handlers. A handler may use the
// cache.
//
// The return value can be used to wait for cache synchronization.
func (c *AssumeCache) AddEventHandler(handler cache.ResourceEventHandler) cache.ResourceEventHandlerRegistration {}

// emitEvents delivers all pending events that are in the queue, in the order
// in which they were stored there (FIFO).
func (c *AssumeCache) emitEvents() {}

type syncedHandlerRegistration

func (syncedHandlerRegistration) HasSynced() bool {}