Documentation
¶
Index ¶
- Variables
- func SetSyntheticWatchableInterval(interval time.Duration)
- func UnsafeGet(object any, field string) any
- func UnsafeSet(object any, field string, value any)
- type ByOptionsLister
- type Indexer
- func (i *Indexer) AddIndexers(newIndexers cache.Indexers) error
- func (i *Indexer) AfterUpsert(key string, obj any, tx db.TxClient) error
- func (i *Indexer) ByIndex(indexName, indexedValue string) ([]any, error)
- func (i *Indexer) GetIndexers() cache.Indexers
- func (i *Indexer) Index(indexName string, obj any) (result []any, err error)
- func (i *Indexer) IndexKeys(indexName, indexedValue string) ([]string, error)
- func (i *Indexer) ListIndexFuncValues(name string) []string
- type Informer
- type ListOptionIndexer
- func (l *ListOptionIndexer) GetLatestResourceVersion() []string
- func (l *ListOptionIndexer) ListByOptions(ctx context.Context, lo *sqltypes.ListOptions, ...) (list *unstructured.UnstructuredList, total int, summary *types.APISummary, ...)
- func (l *ListOptionIndexer) ListSummaryFields(ctx context.Context, lo *sqltypes.ListOptions, ...) (*types.APISummary, error)
- func (l *ListOptionIndexer) ListSummaryForField(ctx context.Context, field []string, fieldNum int, dbName string, ...) (map[string]any, error)
- func (l *ListOptionIndexer) RunGC(ctx context.Context)
- func (l *ListOptionIndexer) Watch(ctx context.Context, opts WatchOptions, eventsCh chan<- watch.Event) error
- type ListOptionIndexerOptions
- type QueryInfo
- type Store
- type SyntheticWatcher
- type WatchFilter
- type WatchOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func SetSyntheticWatchableInterval ¶ added in v0.5.7
SetSyntheticWatchableInterval - call this function to override the default interval time of 5 seconds
Types ¶
type ByOptionsLister ¶
type ByOptionsLister interface {
ListByOptions(ctx context.Context, lo *sqltypes.ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, *types.APISummary, string, error)
Watch(ctx context.Context, options WatchOptions, eventsCh chan<- watch.Event) error
GetLatestResourceVersion() []string
RunGC(context.Context)
DropAll(context.Context) error
}
type Indexer ¶
type Indexer struct {
Store
// contains filtered or unexported fields
}
Indexer is a SQLite-backed cache.Indexer which builds upon Store adding an index table
func NewIndexer ¶
NewIndexer returns a cache.Indexer backed by SQLite for objects of the given example type
func (*Indexer) AddIndexers ¶
AddIndexers adds more indexers to this Store. If you call this after you already have data in the Store, the results are undefined.
func (*Indexer) AfterUpsert ¶
AfterUpsert updates indices of an object
func (*Indexer) ByIndex ¶
ByIndex returns the stored objects whose set of indexed values for the named index includes the given indexed value
func (*Indexer) GetIndexers ¶
GetIndexers returns the indexers
func (*Indexer) Index ¶
Index returns a list of items that match the given object on the index function
func (*Indexer) IndexKeys ¶
IndexKeys returns a list of the Store keys of the objects whose indexed values in the given index include the given indexed value
func (*Indexer) ListIndexFuncValues ¶
ListIndexFuncValues wraps safeListIndexFuncValues and panics in case of I/O errors
type Informer ¶
type Informer struct {
ByOptionsLister
}
Informer is a SQLite-backed cache.SharedIndexInformer that can execute queries on listprocessor structs
func NewInformer ¶
func NewInformer(ctx context.Context, client dynamic.ResourceInterface, fields [][]string, externalUpdateInfo *sqltypes.ExternalGVKUpdates, selfUpdateInfo *sqltypes.ExternalGVKUpdates, transform cache.TransformFunc, gvk schema.GroupVersionKind, db db.Client, shouldEncrypt bool, typeGuidance map[string]string, namespaced bool, watchable bool, gcInterval time.Duration, gcKeepCount int) (*Informer, error)
NewInformer returns a new SQLite-backed Informer for the type specified by schema in unstructured.Unstructured form using the specified client
func (*Informer) ListByOptions ¶
func (i *Informer) ListByOptions(ctx context.Context, lo *sqltypes.ListOptions, partitions []partition.Partition, namespace string) (*unstructured.UnstructuredList, int, *types.APISummary, string, error)
ListByOptions returns objects according to the specified list options and partitions. Specifically:
- an unstructured list of resources belonging to any of the specified partitions
- the total number of resources (returned list might be a subset depending on pagination options in lo)
- a summary object, containing the possible values for each field specified in a summary= subquery
- a continue token, if there are more pages after the returned one
- an error instead of all of the above if anything went wrong
func (*Informer) Run ¶ added in v0.6.39
func (i *Informer) Run(stopCh <-chan struct{})
Run implements cache.SharedIndexInformer
func (*Informer) RunWithContext ¶ added in v0.6.39
RunWithContext implements cache.SharedIndexInformer
type ListOptionIndexer ¶
type ListOptionIndexer struct {
*Indexer
// contains filtered or unexported fields
}
ListOptionIndexer extends Indexer by allowing queries based on ListOption
func NewListOptionIndexer ¶
func NewListOptionIndexer(ctx context.Context, s Store, opts ListOptionIndexerOptions) (*ListOptionIndexer, error)
NewListOptionIndexer returns a SQLite-backed cache.Indexer of unstructured.Unstructured Kubernetes resources of a certain GVK ListOptionIndexer is also able to satisfy ListOption queries on indexed (sub)fields.
func (*ListOptionIndexer) GetLatestResourceVersion ¶ added in v0.6.29
func (l *ListOptionIndexer) GetLatestResourceVersion() []string
func (*ListOptionIndexer) ListByOptions ¶
func (l *ListOptionIndexer) ListByOptions(ctx context.Context, lo *sqltypes.ListOptions, partitions []partition.Partition, namespace string) (list *unstructured.UnstructuredList, total int, summary *types.APISummary, continueToken string, err error)
ListByOptions returns objects according to the specified list options and partitions. Specifically:
- an unstructured list of resources belonging to any of the specified partitions
- the total number of resources (returned list might be a subset depending on pagination options in lo)
- a summary object, containing the possible values for each field specified in a summary= subquery
- a continue token, if there are more pages after the returned one
- an error instead of all of the above if anything went wrong
func (*ListOptionIndexer) ListSummaryFields ¶ added in v0.8.1
func (l *ListOptionIndexer) ListSummaryFields(ctx context.Context, lo *sqltypes.ListOptions, partitions []partition.Partition, dbName string, namespace string) (*types.APISummary, error)
func (*ListOptionIndexer) ListSummaryForField ¶ added in v0.8.1
func (*ListOptionIndexer) RunGC ¶ added in v0.6.39
func (l *ListOptionIndexer) RunGC(ctx context.Context)
func (*ListOptionIndexer) Watch ¶ added in v0.6.7
func (l *ListOptionIndexer) Watch(ctx context.Context, opts WatchOptions, eventsCh chan<- watch.Event) error
type ListOptionIndexerOptions ¶ added in v0.6.9
type ListOptionIndexerOptions struct {
// Fields is a list of fields within the object that we want indexed for
// filtering & sorting. Each field is specified as a slice.
//
// For example, .metadata.resourceVersion should be specified as []string{"metadata", "resourceVersion"}
Fields [][]string
// Used for specifying types of non-TEXT database fields.
// The key is a fully-qualified field name, like 'metadata.fields[1]'.
// The value is a type name, most likely "INT" but could be "REAL". The default type is "TEXT",
// and we don't (currently) use NULL or BLOB types.
TypeGuidance map[string]string
// IsNamespaced determines whether the GVK for this ListOptionIndexer is
// namespaced
IsNamespaced bool
// 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 QueryInfo ¶ added in v0.5.4
type QueryInfo struct {
// contains filtered or unexported fields
}
QueryInfo is a helper-struct that is used to represent the core query and parameters when converting a filter from the UI into a sql query
type Store ¶
type Store interface {
db.Client
cache.Store
GetByKey(key string) (item any, exists bool, err error)
GetName() string
RegisterAfterAdd(f func(key string, obj any, tx db.TxClient) error)
RegisterAfterUpdate(f func(key string, obj any, tx db.TxClient) error)
RegisterAfterDelete(f func(key string, obj any, tx db.TxClient) error)
RegisterAfterDeleteAll(f func(tx db.TxClient) error)
RegisterBeforeDropAll(f func(tx db.TxClient) error)
GetShouldEncrypt() bool
GetType() reflect.Type
DropAll(ctx context.Context) error
}
type SyntheticWatcher ¶ added in v0.5.7
type SyntheticWatcher struct {
// contains filtered or unexported fields
}
func (*SyntheticWatcher) Done ¶ added in v0.5.7
func (rw *SyntheticWatcher) Done() <-chan struct{}
func (*SyntheticWatcher) ResultChan ¶ added in v0.5.7
func (rw *SyntheticWatcher) ResultChan() <-chan watch.Event
ResultChan implements k8s.io/apimachinery/pkg/watch.Interface.
func (*SyntheticWatcher) Stop ¶ added in v0.5.7
func (rw *SyntheticWatcher) Stop()
Stop implements k8s.io/apimachinery/pkg/watch.Interface.
type WatchFilter ¶ added in v0.6.7
type WatchOptions ¶ added in v0.6.7
type WatchOptions struct {
ResourceVersion string
Filter WatchFilter
}