clientproxy

package
v0.0.4-0...-de66a47 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResourcePb

func BuildResourcePb(o client.Object, nsnName, specBody, expiryTime string, gvk schema.GroupVersionKind) *resourcepb.ClaimRequest

Types

type Cache

func NewCache

func NewCache() Cache

type Config

type Config struct {
	Name        string
	Address     string
	Group       string // Group of GVK for event handling
	Normalizefn Normalizefn
	ValidateFn  RefreshRespValidatorFn
}

type Informer

type Informer interface {
	Add(schema.GroupVersionKind, chan event.GenericEvent)
	Delete(schema.GroupVersionKind)
	NotifyClient(schema.GroupVersionKind, types.NamespacedName)
	GetGVK() []schema.GroupVersionKind
}

informer works based on the owner GVK

func NewInformer

func NewInformer(EventChannels map[schema.GroupVersionKind]chan event.GenericEvent) Informer

func NewNopInformer

func NewNopInformer() Informer

type Normalizefn

type Normalizefn func(o client.Object, d any) (*resourcepb.ClaimRequest, error)

type ObjectKindKey

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

ObjectKindKey is the key of the Claim, not the ownerKey

type Proxy

type Proxy[T1, T2 client.Object] interface {
	AddEventChs(map[schema.GroupVersionKind]chan event.GenericEvent)
	// Create creates the cache instance in the backend
	CreateIndex(ctx context.Context, cr T1) error
	// Delete deletes the cache instance in the backend
	DeleteIndex(ctx context.Context, cr T1) error
	// Get returns the claimed resource
	GetClaim(ctx context.Context, cr client.Object, d any) (T2, error)
	// Claim claims a resource
	Claim(ctx context.Context, cr client.Object, d any) (T2, error)
	// DeleteClaim deletes the claim
	DeleteClaim(ctx context.Context, cr client.Object, d any) error
}

func New

func New[T1, T2 client.Object](ctx context.Context, cfg Config) Proxy[T1, T2]

type RefreshRespValidatorFn

type RefreshRespValidatorFn func(origResp *resourcepb.ClaimResponse, newResp *resourcepb.ClaimResponse) bool

type ResponseValidator

type ResponseValidator interface {
	Add(string, RefreshRespValidatorFn)
	Get(string) RefreshRespValidatorFn
}

validates the response from the grpc server with the specific validate fn

func NewResponseValidator

func NewResponseValidator() ResponseValidator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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