utils

package
v0.5.9-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ESImporter

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

ESImporter is the struct responsible for importing data to an Elasticsearch storage.

func NewESImporter

func NewESImporter(esClient *elasticsearch.Storage, cluster string, gvr schema.GroupVersionResource) *ESImporter

NewESImporter creates a new instance of the ESImporter struct with the provided Elasticsearch client, cluster name, and GroupVersionResource.

func (*ESImporter) ImportTo

func (e *ESImporter) ImportTo(ctx context.Context, store cache.Store) error

ImportTo implements the Importer interface by importing data to the specified cache.Store within the given context. The method should be implemented to perform the actual data import.

type ESListerGetter

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

func NewESListerGetter

func NewESListerGetter(cluster string, esClient *elasticsearch.Storage, gvr schema.GroupVersionResource) *ESListerGetter

NewESListerGetter creates a new instance of the ESListerGetter with the provided cluster name, Elasticsearch client, and GroupVersionResource.

func (*ESListerGetter) GetByKey

func (e *ESListerGetter) GetByKey(key string) (value interface{}, exists bool, err error)

GetByKey retrieves the value associated with the provided key from the managed resources.

func (*ESListerGetter) ListKeys

func (e *ESListerGetter) ListKeys() []string

ListKeys returns a list of keys for the resources managed by the ESListerGetter.

type ESPurger added in v0.5.5

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

func NewESPurger added in v0.5.5

func NewESPurger(esClient *elasticsearch.Storage, cluster string, gvr schema.GroupVersionResource,
	store cache.Store, onPurge func(obj client.Object),
) *ESPurger

NewESPurger creates an ESPurger which implements the Purger interface.

func (*ESPurger) Purge added in v0.5.5

func (e *ESPurger) Purge(ctx context.Context, syncBefore time.Time) error

Purge calls onPurge for objects that do not exist in the cache but have not been deleted in ES.

type FieldsSelector

type FieldsSelector struct {
	fields.Selector
	ServerSupported bool
}

FieldsSelector represents a selection based on fields.

func (FieldsSelector) Empty

func (fs FieldsSelector) Empty() bool

Empty checks if the FieldsSelector is empty, meaning no fields are specified for selection.

type Importer

type Importer interface {
	ImportTo(ctx context.Context, store cache.Store) error
}

Importer defines the interface for importing data to a specified storage.

type MultiSelectors

type MultiSelectors []Selector

MultiSelectors is a slice of Selectors, allowing for multiple selection criteria to be combined.

func (MultiSelectors) ApplyToList

func (m MultiSelectors) ApplyToList(options *metav1.ListOptions)

ApplyToList applies the MultiSelectors to the provided metav1.ListOptions for use in Kubernetes API list requests.

func (MultiSelectors) Matches

func (m MultiSelectors) Matches(obj Selectable) bool

Matches checks if the provided Selectable object matches any of the selection criteria specified in the MultiSelectors.

func (MultiSelectors) Predicate

func (m MultiSelectors) Predicate(obj interface{}) bool

Predicate returns a function that implements the Predicate interface, allowing the MultiSelectors to be used as a go-restful Predicate.

type Purger added in v0.5.5

type Purger interface {
	Purge(ctx context.Context, syncBefore time.Time) error
}

Purger defines the interface for pruning data in storage.

type Selectable

type Selectable interface {
	GetLabels() labels.Labels
	GetFields() fields.Fields
}

Selectable defines the interface for objects that can be selected by labels and fields.

type Selector

type Selector struct {
	Label labels.Selector
	Field FieldsSelector
}

Selector represents a selection based on labels and fields.

func (Selector) Matches

func (s Selector) Matches(obj Selectable) bool

Matches checks if the provided Selectable object matches the selection criteria specified by the Selector.

func (Selector) ServerSupported

func (s Selector) ServerSupported() bool

ServerSupported checks if the server supports the fields and labels specified in the Selector.

Jump to

Keyboard shortcuts

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