Documentation
¶
Index ¶
- Variables
- func ExtractPodRestartCount(obj *unstructured.Unstructured) (any, error)
- func ExtractPodRestartTimestamp(obj *unstructured.Unstructured) (any, error)
- func SetSyntheticWatchableInterval(interval time.Duration)
- func UnsafeGet(object any, field string) any
- func UnsafeSet(object any, field string, value any)
- type ByOptionsLister
- type ComputedField
- type IndexedField
- 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
- func (i *Informer) AugmentList(ctx context.Context, list *unstructured.UnstructuredList, ...) error
- func (i *Informer) ListByOptions(ctx context.Context, lo *sqltypes.ListOptions, ...) (*unstructured.UnstructuredList, int, *types.APISummary, string, error)
- func (i *Informer) Run(stopCh <-chan struct{})
- func (i *Informer) RunWithContext(ctx context.Context)
- type JSONPathField
- type ListOptionIndexer
- func (l *ListOptionIndexer) AugmentList(ctx context.Context, list *unstructured.UnstructuredList, ...) error
- 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) 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 ¶
var ( ErrInvalidColumn = errors.New("supplied column is invalid") ErrUnknownRevision = errors.New("unknown revision") )
var (
ErrTooOld = errors.New("resourceversion too old")
)
Functions ¶
func ExtractPodRestartCount ¶ added in v0.8.15
func ExtractPodRestartCount(obj *unstructured.Unstructured) (any, error)
ExtractPodRestartCount extracts restart count from Pod metadata.fields[3].
func ExtractPodRestartTimestamp ¶ added in v0.8.15
func ExtractPodRestartTimestamp(obj *unstructured.Unstructured) (any, error)
ExtractPodRestartTimestamp extracts restart timestamp from Pod metadata.fields[3]. Returns the Unix time in milliseconds of the last restart.
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 {
AugmentList(ctx context.Context, list *unstructured.UnstructuredList, childGVK schema.GroupVersionKind, childSchemaName string, useSelectors bool, accessList accesscontrol.AccessListByVerb) error
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
DropAll(context.Context) error
}
type ComputedField ¶ added in v0.8.15
type ComputedField struct {
Name string
Type string
GetValueFunc func(obj *unstructured.Unstructured) (any, error)
}
ComputedField represents a field with custom column name and value extraction
func (*ComputedField) ColumnName ¶ added in v0.8.15
func (f *ComputedField) ColumnName() string
func (*ComputedField) ColumnType ¶ added in v0.8.15
func (f *ComputedField) ColumnType() string
func (*ComputedField) GetValue ¶ added in v0.8.15
func (f *ComputedField) GetValue(obj *unstructured.Unstructured) (any, error)
type IndexedField ¶ added in v0.8.15
type IndexedField interface {
// ColumnName returns the column name.
ColumnName() string
// ColumnType returns the SQL type for this column.
ColumnType() string
// GetValue extracts the value from an unstructured object.
// Returns nil for missing/invalid data.
GetValue(obj *unstructured.Unstructured) (any, error)
}
IndexedField represents a single field that can be indexed in the SQL cache. It provides the column name, SQL type, and value extraction logic.
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 map[string]IndexedField, externalUpdateInfo *sqltypes.ExternalGVKUpdates, selfUpdateInfo *sqltypes.ExternalGVKUpdates, transform cache.TransformFunc, gvk schema.GroupVersionKind, db db.Client, shouldEncrypt bool, namespaced bool, watchable bool, 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) AugmentList ¶ added in v0.8.19
func (i *Informer) AugmentList(ctx context.Context, list *unstructured.UnstructuredList, childGVK schema.GroupVersionKind, childSchemaName string, useSelectors bool, accessList accesscontrol.AccessListByVerb) error
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 JSONPathField ¶ added in v0.8.15
type JSONPathField struct {
Path []string
Type string // Optional: TEXT (default), INTEGER, REAL, etc.
}
JSONPathField represents a standard field accessed via JSON path
func (*JSONPathField) ColumnName ¶ added in v0.8.15
func (f *JSONPathField) ColumnName() string
func (*JSONPathField) ColumnType ¶ added in v0.8.15
func (f *JSONPathField) ColumnType() string
func (*JSONPathField) GetValue ¶ added in v0.8.15
func (f *JSONPathField) GetValue(obj *unstructured.Unstructured) (any, error)
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) AugmentList ¶ added in v0.8.19
func (l *ListOptionIndexer) AugmentList(ctx context.Context, list *unstructured.UnstructuredList, childGVK schema.GroupVersionKind, childSchemaName string, useSelectors bool, accessList accesscontrol.AccessListByVerb) error
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) 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 map of column name to IndexedField for filtering & sorting.
// Each IndexedField specifies its column name, SQL type, and value extraction logic.
Fields map[string]IndexedField
// IsNamespaced determines whether the GVK for this ListOptionIndexer is
// namespaced
IsNamespaced bool
// GCKeepCount is how many events to keep in memory
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
}