package cacher
import "k8s.io/apiserver/pkg/storage/cacher"
Index ¶
- func NewCacherListerWatcher(storage storage.Interface, resourcePrefix string, newListFunc func() runtime.Object) cache.ListerWatcher
- type Cacher
- func NewCacherFromConfig(config Config) (*Cacher, error)
- func (c *Cacher) Count(pathPrefix string) (int64, error)
- func (c *Cacher) Create(ctx context.Context, key string, obj, out runtime.Object, ttl uint64) error
- func (c *Cacher) Delete(ctx context.Context, key string, out runtime.Object, preconditions *storage.Preconditions, validateDeletion storage.ValidateObjectFunc) error
- func (c *Cacher) Get(ctx context.Context, key string, resourceVersion string, objPtr runtime.Object, ignoreNotFound bool) error
- func (c *Cacher) GetToList(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate, listObj runtime.Object) error
- func (c *Cacher) GuaranteedUpdate( ctx context.Context, key string, ptrToType runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, _ ...runtime.Object) error
- func (c *Cacher) LastSyncResourceVersion() (uint64, error)
- func (c *Cacher) List(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate, listObj runtime.Object) error
- func (c *Cacher) Stop()
- func (c *Cacher) Versioner() storage.Versioner
- func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error)
- func (c *Cacher) WatchList(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error)
- type Config
Functions ¶
func NewCacherListerWatcher ¶
func NewCacherListerWatcher(storage storage.Interface, resourcePrefix string, newListFunc func() runtime.Object) cache.ListerWatcher
NewCacherListerWatcher returns a storage.Interface backed ListerWatcher.
Types ¶
type Cacher ¶
Cacher is responsible for serving WATCH and LIST requests for a given resource from its internal cache and updating its cache in the background based on the underlying storage contents. Cacher implements storage.Interface (although most of the calls are just delegated to the underlying storage).
func NewCacherFromConfig ¶
NewCacherFromConfig creates a new Cacher responsible for servicing WATCH and LIST requests from its internal cache and updating its cache in the background based on the given configuration.
func (*Cacher) Count ¶
Count implements storage.Interface.
func (*Cacher) Create ¶
Create implements storage.Interface.
func (*Cacher) Delete ¶
func (c *Cacher) Delete(ctx context.Context, key string, out runtime.Object, preconditions *storage.Preconditions, validateDeletion storage.ValidateObjectFunc) error
Delete implements storage.Interface.
func (*Cacher) Get ¶
func (c *Cacher) Get(ctx context.Context, key string, resourceVersion string, objPtr runtime.Object, ignoreNotFound bool) error
Get implements storage.Interface.
func (*Cacher) GetToList ¶
func (c *Cacher) GetToList(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate, listObj runtime.Object) error
GetToList implements storage.Interface.
func (*Cacher) GuaranteedUpdate ¶
func (c *Cacher) GuaranteedUpdate( ctx context.Context, key string, ptrToType runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, _ ...runtime.Object) error
GuaranteedUpdate implements storage.Interface.
func (*Cacher) LastSyncResourceVersion ¶
LastSyncResourceVersion returns resource version to which the underlying cache is synced.
func (*Cacher) List ¶
func (c *Cacher) List(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate, listObj runtime.Object) error
List implements storage.Interface.
func (*Cacher) Stop ¶
func (c *Cacher) Stop()
Stop implements the graceful termination.
func (*Cacher) Versioner ¶
Versioner implements storage.Interface.
func (*Cacher) Watch ¶
func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error)
Watch implements storage.Interface.
func (*Cacher) WatchList ¶
func (c *Cacher) WatchList(ctx context.Context, key string, resourceVersion string, pred storage.SelectionPredicate) (watch.Interface, error)
WatchList implements storage.Interface.
type Config ¶
type Config struct { // Maximum size of the history cached in memory. CacheCapacity int // An underlying storage.Interface. Storage storage.Interface // An underlying storage.Versioner. Versioner storage.Versioner // The Cache will be caching objects of a given Type and assumes that they // are all stored under ResourcePrefix directory in the underlying database. ResourcePrefix string // KeyFunc is used to get a key in the underlying storage for a given object. KeyFunc func(runtime.Object) (string, error) // GetAttrsFunc is used to get object labels, fields GetAttrsFunc func(runtime.Object) (label labels.Set, field fields.Set, err error) // IndexerFuncs is used for optimizing amount of watchers that // needs to process an incoming event. IndexerFuncs storage.IndexerFuncs // NewFunc is a function that creates new empty object storing a object of type Type. NewFunc func() runtime.Object // NewList is a function that creates new empty object storing a list of // objects of type Type. NewListFunc func() runtime.Object Codec runtime.Codec }
Config contains the configuration for a given Cache.
Source Files ¶
cacher.go caching_object.go time_budget.go util.go watch_cache.go
- Version
- v0.17.5
- Published
- Apr 17, 2020
- Platform
- js/wasm
- Imports
- 33 packages
- Last checked
- 8 minutes ago –
Tools for package owners.