cache

package
v0.0.0-...-2d9dd87 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package cache defines resource group aware Cache.

The Cache implements sync loop and garbage collector inspired from the ones existing in Kubernetes, but in this case only finalizers are respected while currently there is not a concept of ownerReferences.

Note: The cloud runtime is using a Cache for all the resource groups, so it will be possible to implement controllers processing request from all the resources groups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Start(ctx context.Context) error

	AddResourceGroup(name string)
	DeleteResourceGroup(name string)

	Get(resourceGroup string, key client.ObjectKey, obj client.Object) error
	List(resourceGroup string, list client.ObjectList, opts ...client.ListOption) error
	Create(resourceGroup string, obj client.Object) error
	Delete(resourceGroup string, obj client.Object) error
	Update(resourceGroup string, obj client.Object) error
	Patch(resourceGroup string, obj client.Object, patch client.Patch) error

	GetInformer(ctx context.Context, obj client.Object) (Informer, error)
	GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (Informer, error)
}

Cache implements an in-memory cache. TODO: consider if to move to internal.

func NewCache

func NewCache(scheme *runtime.Scheme) Cache

NewCache returns a new Cache.

type InformEventHandler

type InformEventHandler interface {
	OnCreate(resourceGroup string, obj client.Object)
	OnUpdate(resourceGroup string, oldObj, newObj client.Object)
	OnDelete(resourceGroup string, obj client.Object)
	OnGeneric(resourceGroup string, obj client.Object)
}

InformEventHandler handle events originated by a source.

type Informer

type Informer interface {
	AddEventHandler(handler InformEventHandler) error
}

Informer forwards events to event handlers.

Jump to

Keyboard shortcuts

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