factory

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Overview

Package factory provides a cache factory for the sql-based cache.

Index

Constants

View Source
const EncryptAllEnvVar = "CATTLE_ENCRYPT_CACHE_ALL"

EncryptAllEnvVar is set to "true" if users want all types' data blobs to be encrypted in SQLite otherwise only variables in defaultEncryptedResourceTypes will have their blobs encrypted

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	informer.ByOptionsLister
	// contains filtered or unexported fields
}

func (*Cache) GVK added in v0.6.40

func (c *Cache) GVK() schema.GroupVersionKind

type CacheFactory

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

CacheFactory builds Informer instances and keeps a cache of instances it created

func NewCacheFactory

func NewCacheFactory(opts CacheFactoryOptions) (*CacheFactory, error)

NewCacheFactory returns an informer factory instance This is currently called from steve via initial calls to `s.cacheFactory.CacheFor(...)`

func (*CacheFactory) CacheFor

func (f *CacheFactory) CacheFor(ctx context.Context, fields [][]string, externalUpdateInfo *sqltypes.ExternalGVKUpdates, selfUpdateInfo *sqltypes.ExternalGVKUpdates, transform cache.TransformFunc, client dynamic.ResourceInterface, gvk schema.GroupVersionKind, typeGuidance map[string]string, namespaced bool, watchable bool) (*Cache, error)

CacheFor returns an informer for given GVK, using sql store indexed with fields, using the specified client. For virtual fields, they must be added by the transform function and specified by fields to be used for later fields.

Don't forget to call DoneWithCache with the given informer once done with it.

func (*CacheFactory) DoneWithCache added in v0.6.39

func (f *CacheFactory) DoneWithCache(cache *Cache)

DoneWithCache must be called for every successful CacheFor call. The Cache should no longer be used after DoneWithCache is called.

This ensures that there aren't any inflight list requests while we are resetting the database.

func (*CacheFactory) Stop added in v0.6.39

Stop cancels ctx which stops any running informers, assigns a new ctx, resets the GVK-informer cache, and resets the database connection which wipes any current sqlite database at the default location.

type CacheFactoryOptions added in v0.6.9

type CacheFactoryOptions struct {
	// GCInterval is how often to run the garbage collection
	GCInterval time.Duration
	// GCKeepCount is how many events to keep in _events table when gc runs
	GCKeepCount int
}

Jump to

Keyboard shortcuts

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