factory

package
v0.7.13 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Overview

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

Package factory is a generated GoMock package.

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
}

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, 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)

DoneWithCache must be called for every CacheFor call.

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

TODO: Use the *Cache once we go per-GVK

func (*CacheFactory) Stop added in v0.6.39

func (f *CacheFactory) Stop() 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.

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
}

type MockTXClient added in v0.5.7

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

MockTXClient is a mock of Client interface.

func NewMockTXClient added in v0.5.7

func NewMockTXClient(ctrl *gomock.Controller) *MockTXClient

NewMockTXClient creates a new mock instance.

func (*MockTXClient) EXPECT added in v0.5.7

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTXClient) Exec added in v0.5.7

func (m *MockTXClient) Exec(query string, args ...any) (sql.Result, error)

Exec mocks base method.

func (*MockTXClient) Stmt added in v0.5.7

func (m *MockTXClient) Stmt(stmt *sql.Stmt) transaction.Stmt

Stmt mocks base method.

type MockTXClientMockRecorder added in v0.5.7

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

MockTXClientMockRecorder is the mock recorder for MockTXClient.

func (*MockTXClientMockRecorder) Exec added in v0.5.7

func (mr *MockTXClientMockRecorder) Exec(query any, args ...any) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockTXClientMockRecorder) Stmt added in v0.5.7

func (mr *MockTXClientMockRecorder) Stmt(stmt any) *gomock.Call

Stmt indicates an expected call of Stmt.

Jump to

Keyboard shortcuts

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