Documentation
¶
Overview ¶
Package factory provides a cache factory for the sql-based cache.
Index ¶
Constants ¶
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
func (f *CacheFactory) Stop(gvk schema.GroupVersionKind) error
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.