coordination

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnySyncerViewChanged

func AnySyncerViewChanged(old, new metav1.Object) bool

SyncerViewChanged returns true if the syncer view fields changed between old and new for at least one of the SyncTargets on which the resource is synced.

func FilteredSyncerViewsChanged

func FilteredSyncerViewsChanged(old, new metav1.Object, keepSyncTarget func(syncTargetKey string) bool) bool

FilteredSyncerViewsChanged returns true if the syncer view fields changed between old and new for at least one of the SyncTarget filtered by the [keepSynctarget] function.

func SyncerViewChanged

func SyncerViewChanged(old, new metav1.Object, syncTargetKey string) bool

SyncerViewChanged returns true if the syncer view fields changed between old and new for the given SyncTarget.

func UpstreamViewChanged

func UpstreamViewChanged(old, new Object, equality func(old, new interface{}) bool) bool

UpstreamViewChanged check equality between old and new, ignoring the syncer view annotations.

Types

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

type SyncerViewRetriever

type SyncerViewRetriever[T Object] interface {
	// GetFilteredSyncerViews retrieves the syncer views of the resource for
	// all the SyncTargets filtered by the [keepSyncTarget] function
	GetFilteredSyncerViews(ctx context.Context, gvr schema.GroupVersionResource, upstreamResource T, keepSyncTarget func(key string) bool) (map[string]T, error)
	// GetAllSyncerViews retrieves the syncer views of the resource for
	// all the SyncTargets on which the resource is being synced
	GetAllSyncerViews(ctx context.Context, gvr schema.GroupVersionResource, upstreamResource T) (map[string]T, error)
	// GetSyncerView retrieves the syncer view of the resource for
	// the given SyncTarget
	GetSyncerView(ctx context.Context, gvr schema.GroupVersionResource, upstreamResource T, syncTargetKey string) (T, error)
}

SyncerViewRetriever allows retrieving the syncer views on an upstream object. It is designed to use the same transformation and overriding logic as the one used by the Syncer virtual workspace.

func NewDefaultSyncerViewManager

func NewDefaultSyncerViewManager[T Object]() SyncerViewRetriever[T]

NewDefaultSyncerViewManager creates a SyncerViewRetriever based on the default transfomation and summarizing rules providers.

func NewSyncerViewRetriever

func NewSyncerViewRetriever[T Object](transformationProvider transformations.TransformationProvider,
	summarizingRulesprovider transformations.SummarizingRulesProvider) SyncerViewRetriever[T]

NewSyncerViewRetriever creates a SyncerViewRetriever based on a given transformations.TransformationProvider and a given transformations.SummarizingRulesProvider. Retrieving the syncer views on an upstream object should use the same transformation and overriding logic as the one used by the Syncer virtual workspace. So the 2 arguments should be chosen accordingly.

Jump to

Keyboard shortcuts

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