placement

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const FieldManager = "placement-translator"
View Source
const ProjectedLabelKey string = "edge.kcp.io/projected"
View Source
const ProjectedLabelVal string = "yes"
View Source
const SyncerConfigName = "the-one"
View Source
const WSNameSep = "-mb-"

Variables

View Source
var DefaultResourceMode = ResourceMode{
	PropagationMode: GoesToEdge,
	NatureMode:      NaturalyDenatured,
	BuiltinToEdge:   false,
}

DefaultResourceMode is the handling for every user-defined resource

View Source
var GRsForciblyDenatured = NewMapSet(
	mkgr("admissionregistration.k8s.io", "mutatingwebhookconfigurations"),
	mkgr("admissionregistration.k8s.io", "validatingwebhookconfigurations"),
	mkgr("flowcontrol.apiserver.k8s.io", "flowschemas"),
	mkgr("flowcontrol.apiserver.k8s.io", "prioritylevelconfigurations"),
	mkgr("rbac.authorization.k8s.io", "clusterroles"),
	mkgr("rbac.authorization.k8s.io", "clusterrolebindingss"),
	mkgr("rbac.authorization.k8s.io", "roles"),
	mkgr("rbac.authorization.k8s.io", "rolebindings"),
	mkgr("", "limitranges"),
	mkgr("", "resourcequotas"),
	mkgr("", "serviceaccounts"),
)
View Source
var GRsNaturedInBoth = NewMapSet(
	mkgr("apiextensions.k8s.io", "customresourcedefinitions"),
	mkgr("", "namespaces"),
)
View Source
var GRsNotForEdge = NewMapSet(
	mkgr("apis.kcp.io", "apiexports"),
	mkgr("apis.kcp.io", "apiexportendpointslices"),
	mkgr("apis.kcp.io", "apiresourceschemas"),
	mkgr("apps", "controllerrevisions"),
	mkgr("authentication.k8s.io", "tokenreviews"),
	mkgr("authorization.k8s.io", "localsubjectaccessreviews"),
	mkgr("authorization.k8s.io", "selfsubjectaccessreviews"),
	mkgr("authorization.k8s.io", "selfsubjectrulesreviews"),
	mkgr("authorization.k8s.io", "subjectaccessreviews"),
	mkgr("certificates.k8s.io", "certificatesigningrequests"),
	mkgr("core.kcp.io", "logicalclusters"),
	mkgr("core.kcp.io", "shards"),
	mkgr("events.k8s.io", "events"),
	mkgr("", "bindings"),
	mkgr("", "componentstatuses"),
	mkgr("", "events"),
	mkgr("", "nodes"),
)
View Source
var GRsNotSupported = NewMapSet(
	mkgr("apiregistration.k8s.io", "apiservices"),
	mkgr("apiresource.kcp.io", "apiresourceimports"),
	mkgr("apiresource.kcp.io", "negotiatedapiresources"),
	mkgr("apis.kcp.io", "apiconversions"),
)
View Source
var GroupsNotForEdge = k8ssets.NewString(
	"edge.kcp.io",
	"scheduling.kcp.io",
	"tenancy.kcp.io",
	"topology.kcp.io",
	"workload.kcp.io",
)
View Source
var HashClusterString = PairHashDomain[logicalcluster.Name, string](HashLogicalClusterName, HashDomainString{})
View Source
var HashExternalName = NewTransformHashDomain(factorExternalName.First, HashClusterString)
View Source
var HashLogicalClusterName = NewTransformHashDomain[logicalcluster.Name, string](func(name logicalcluster.Name) string { return string(name) }, HashDomainString{})
View Source
var NaturedInCenterGoToMailbox = NewMapSet(
	mkgr("apis.kcp.io", "apibindings"),
)
View Source
var SliceOfStringDomain = NewSliceHashDomain[string](HashDomainString{})

Functions

func DynamicMapProviderGet

func DynamicMapProviderGet[Key comparable, Val any](prod DynamicMapProvider[Key, Val], key Key) Val

DynamicMapProviderGet does a non-CPS Get. In situations with concurrency, regular clients (as in AddReceiver) get timing splinters if they use this.

func DynamicMapProviderRelease

func DynamicMapProviderRelease[Key comparable, Val any](prod DynamicMapProviderWithRelease[Key, Val], key Key)

func Func11Compose11

func Func11Compose11[Type1, Type2, Type3 any](fn1 func(Type1) Type2, fn2 func(Type2) Type3) func(Type1) Type3

Func11Compose11 composes two 1-arg 1-result functions

func GetNamespacesBuiltIntoEdgeClusters

func GetNamespacesBuiltIntoEdgeClusters() k8ssets.String

func GetNamespacesBuiltIntoMailboxes

func GetNamespacesBuiltIntoMailboxes() k8ssets.String

func HashSetCopy

func HashSetCopy[Elt any](domain HashDomain[Elt]) func(Visitable[Elt]) MutableSet[Elt]

func Identity1

func Identity1[Val any](val Val) Val

Identity1 is useful in reduers where the accumulator has the same type as the result

func MGRWithVersion

func MGRWithVersion(gr metav1.GroupResource, version string) metav1.GroupVersionResource

func MapAddAll

func MapAddAll[Key, Val any](theMap MutableMap[Key, Val], adds Visitable[Pair[Key, Val]])

func MapApply

func MapApply[Key, Val any](theMap Map[Key, Val], receiver MappingReceiver[Key, Val])

func MapEnumerateDifferences

func MapEnumerateDifferences[Key, Val comparable](left, right Map[Key, Val], receiver MapChangeReceiver[Key, Val])

func MapEnumerateDifferencesParametric

func MapEnumerateDifferencesParametric[Key, Val any](isEqual func(Val, Val) bool, left, right Map[Key, Val], receiver MapChangeReceiver[Key, Val])

func MapEqual

func MapEqual[Key, Val comparable](left, right Map[Key, Val]) bool

func MapEqualParametric

func MapEqualParametric[Key comparable, Val any](isEqual func(Val, Val) bool) func(map1, map2 Map[Key, Val]) bool

func MapGetAdd

func MapGetAdd[Key, Val any](theMap MutableMap[Key, Val], key Key, want bool, valGenerator func(Key) Val) Val

MapGetAdd does a Get and an add if the sought mmapping is missing and desired. If the sought mapping is missing and undesired then the result is the zero value of Val.

func MapRemoveAll

func MapRemoveAll[Key, Val any](theMap MutableMap[Key, Val], goners Visitable[Pair[Key, Val]])

func MapSetAddNoResult

func MapSetAddNoResult[Elt comparable](set MapSet[Elt], elt Elt)

func MapSetSymmetricDifference

func MapSetSymmetricDifference[Elt comparable](wantLeftMinusRight, wantIntersection, wantRightMinusLeft bool, left, right Set[Elt]) (MapSet[Elt], MapSet[Elt], MapSet[Elt])

func MapTransformToSlice

func MapTransformToSlice[Key, Val, Transformed any](theMap Map[Key, Val], xform func(Key, Val) Transformed) []Transformed

func MapUpdateToMatch

func MapUpdateToMatch[Key, Val comparable](current MutableMap[Key, Val], target Visitable[Pair[Key, Val]])

func MappingReceiverAsVisitor

func MappingReceiverAsVisitor[Key, Val any](receiver MappingReceiver[Key, Val]) func(Pair[Key, Val]) error

func MappingReceiverNegativeAsVisitor

func MappingReceiverNegativeAsVisitor[Key, Val any](receiver MappingReceiver[Key, Val]) func(Pair[Key, Val]) error

func MetaGroupResourceToSchema

func MetaGroupResourceToSchema(gr metav1.GroupResource) schema.GroupResource

func NewDynamicFullJoin12VWith13

func NewDynamicFullJoin12VWith13[ColX, ColY, ColZ comparable, Val any](logger klog.Logger, receiver MappingReceiver[Triple[ColX, ColY, ColZ], Val]) (MappingReceiver[Pair[ColX, ColY], Val], SetWriter[Pair[ColX, ColZ]])

NewDynamicFullJoin12VWith13 constructs a data structure that incrementally maintains an equijoin of (1) a map from pairs to values with (2) a pair set. The join is on the pair first members. Given a receiver of changes to the result of the equijoin, this function returns receivers of changes to the two ipnputs. In other words, this joins the change streams of two tables to produce the change stream of the join of those two tables --- in a passive stance (i.e., is in terms of the stream receivers).

func NewDynamicFullJoin12with13

func NewDynamicFullJoin12with13[ColX, ColY, ColZ comparable](logger klog.Logger, receiver SetWriter[Triple[ColX, ColY, ColZ]]) (SetWriter[Pair[ColX, ColY]], SetWriter[Pair[ColX, ColZ]])

NewDynamicFullJoin12with13 is like NewDynamicJoin12with13 but passes along the set of joint values too.

func NewDynamicFullJoin12with13Parametric

func NewDynamicFullJoin12with13Parametric[ColX, ColY, ColZ any](logger klog.Logger, hashDomainX HashDomain[ColX], hashDomainY HashDomain[ColY], hashDomainZ HashDomain[ColZ], receiver SetWriter[Triple[ColX, ColY, ColZ]]) (SetWriter[Pair[ColX, ColY]], SetWriter[Pair[ColX, ColZ]])

NewDynamicFullJoin12with13Parametric is like NewDynamicFullJoin12with13 but is based on general hash maps

func NewDynamicJoin12with13

func NewDynamicJoin12with13[ColX, ColY, ColZ comparable](logger klog.Logger, receiver SetWriter[Pair[ColY, ColZ]]) (SetWriter[Pair[ColX, ColY]], SetWriter[Pair[ColX, ColZ]])

NewDynamicJoin12with13 constructs a data structure that incrementally maintains an equijoin. The join is on the first column of the input tables. Given a receiver of changes to the result of the equijoin between two two-column tables, this function returns receivers of changes to the two tables. In other words, this joins the change streams of two tables to produce the change stream of the join of those two tables --- in a passive stance (i.e., is in terms of the stream receivers). Note: the uniformity of the input and output types means that this can be chained.

func NewGenericIndexedSet

func NewGenericIndexedSet[Tuple, Key, Val, ValMutableSet, ValSet any](
	factoring Factorer[Tuple, Key, Val],
	valSetFactory func(Key) ValMutableSet,
	valMutableSetAsSet func(ValMutableSet) MutableSet[Val],
	insulateValSet func(ValMutableSet) ValSet,
	rep MutableMap[Key, ValMutableSet],
) *genericMutableIndexedSet[Tuple, Key, Val, ValMutableSet, ValSet]

NewGenericIndexedSet constructs an index given the constituent functionality. The returned value implements GenericMutableIndexedSet.

func NewHashMap

func NewHashMap[Key, Val any](domain HashDomain[Key]) func(MapChangeReceiver[Key, Val]) MutableMap[Key, Val]

func NewMapMapFactory

func NewMapMapFactory[Key comparable, Val any](observer MapChangeReceiver[Key, Val]) func() MutableMap[Key, Val]

NewMapMapFactory makes a func that returns new Map implemented by a Map, optionally with a given observer. In other words, this is the curried form of NewMapMap.

func NewPair1Then2

func NewPair1Then2[First any, Second any](first First) func(Second) Pair[First, Second]

func NewPair2Then1

func NewPair2Then1[First any, Second any](second Second) func(First) Pair[First, Second]

func NewPlacementTranslator

func NewPlacementTranslator(
	numThreads int,
	ctx context.Context,

	epClusterPreInformer edgev1a1informers.EdgePlacementClusterInformer,

	spsClusterPreInformer edgev1a1informers.SinglePlacementSliceClusterInformer,

	syncfgClusterPreInformer edgev1a1informers.SyncerConfigClusterInformer,

	mbwsPreInformer tenancyv1a1informers.WorkspaceInformer,

	kcpClusterClientset kcpclusterclientset.ClusterInterface,

	discoveryClusterClient clusterdiscovery.DiscoveryClusterInterface,

	crdClusterPreInformer kcpkubeinformers.GenericClusterInformer,

	bindingClusterPreInformer kcpkubeinformers.GenericClusterInformer,

	dynamicClusterClient clusterdynamic.ClusterInterface,

	edgeClusterClientset edgeclusterclientset.ClusterInterface,

	nsClusterPreInformer kcpkubecorev1informers.NamespaceClusterInformer,

	nsClusterClient kcpkubecorev1client.NamespaceClusterInterface,
) *placementTranslator

func NewThunk

func NewThunk[Val any](val Val) func() Val

func NewWorkloadProjector

func NewWorkloadProjector(
	ctx context.Context,
	configConcurrency int,
	resourceModes ResourceModes,
	mbwsInformer k8scache.SharedIndexInformer,
	mbwsLister tenancyv1a1listers.WorkspaceLister,
	syncfgClusterInformer kcpcache.ScopeableSharedIndexInformer,
	syncfgClusterLister edgev1a1listers.SyncerConfigClusterLister,
	edgeClusterClientset edgeclusterclientset.ClusterInterface,
	dynamicClusterClient clusterdynamic.ClusterInterface,
	nsClusterPreInformer kcpkubecorev1informers.NamespaceClusterInformer,
	nsClusterClient kcpkubecorev1client.NamespaceClusterInterface,
) *workloadProjector

NewWorkloadProjector constructs a WorkloadProjector that also implements Runnable. Run it after starting the informer factories.

func ObjectIsSystem

func ObjectIsSystem(objm metav1.Object) bool

func ResourceSupportsInformers

func ResourceSupportsInformers(metarsc *urmetav1a1.APIResource) bool

func SPMailboxWorkspaceName

func SPMailboxWorkspaceName(sp SinglePlacement) string

func SetAddAll

func SetAddAll[Elt any](set MutableSet[Elt], adds Visitable[Elt]) (someNew, allNew bool)

func SetEnumerateDifferences

func SetEnumerateDifferences[Elt any](left, right Set[Elt], receiver SetWriter[Elt])

func SetEqual

func SetEqual[Elt any](set1, set2 Set[Elt]) bool

func SetLessOrEqual

func SetLessOrEqual[Elt any](set1, set2 Set[Elt]) bool

func SetRemoveAll

func SetRemoveAll[Elt any](set MutableSet[Elt], goners Visitable[Elt]) (someNew, allNew bool)

func SetUpdateToMatch

func SetUpdateToMatch[Elt comparable](current MutableSet[Elt], target Visitable[Elt], eltChangeReceiver SetWriter[Elt])

func SliceApply

func SliceApply[Elt any](slice []Elt, fn func(Elt))

func SliceContains

func SliceContains[Elt comparable](slice []Elt, seek Elt) bool

func SliceContainsParametric

func SliceContainsParametric[Elt any](isEqual func(Elt, Elt) bool, slice []Elt, seek Elt) bool

func SliceCopy

func SliceCopy[Elt any](original []Elt) []Elt

func SliceEqual

func SliceEqual[Elt comparable](a, b []Elt) bool

func SliceRemoveFunctional

func SliceRemoveFunctional[Elt comparable](slice []Elt, seek Elt) []Elt

func ToHeap

func ToHeap[Val any](val Val) *Val

func UpsyncSetEqual

func UpsyncSetEqual(left, right edgeapi.UpsyncSet) bool

func VisitableGet

func VisitableGet[Elt any](seq Visitable[Elt], index int) (Elt, bool)

func VisitableHas

func VisitableHas[Elt comparable](set Visitable[Elt], seek Elt) bool

func VisitableLen

func VisitableLen[Elt any](visitable Visitable[Elt]) int

func VisitableMapFnReduceOr

func VisitableMapFnReduceOr[Elt any](visitable Visitable[Elt], test func(Elt) bool) bool

func VisitableToSlice

func VisitableToSlice[Elt any](set Visitable[Elt]) []Elt

func VisitableTransformToSlice

func VisitableTransformToSlice[Original, Transformed any](set Visitable[Original], xform func(Original) Transformed) []Transformed

Types

type APIGroupInfo

type APIGroupInfo struct {
	// Versions are ordered as semantic versions.
	// This slice is immutable.
	Versions []metav1.GroupVersionForDiscovery

	PreferredVersion metav1.GroupVersionForDiscovery
}

type APIMapProvider

type APIMapProvider interface {

	// Neither receiver is invoked synchronously.
	AddReceivers(cluster logicalcluster.Name,
		groupReceiver *MappingReceiverHolder[string, APIGroupInfo],
		resourceReceiver *MappingReceiverHolder[metav1.GroupResource, ResourceDetails])

	// The receiver values have to be comparable.
	// Neither receiver is invoked synchronously.
	RemoveReceivers(cluster logicalcluster.Name,
		groupReceiver *MappingReceiverHolder[string, APIGroupInfo],
		resourceReceiver *MappingReceiverHolder[metav1.GroupResource, ResourceDetails])
}

APIMapProvider provides API information on a cluster-by-cluster basis, as needed by clients. This information comes from runtime monitoring of the API resources of the clusters. In the locking order, an resourceDiscoveryReceiver is _preceded_ by its clients.

type APIWatchMapProvider

type APIWatchMapProvider interface {
	APIMapProvider
	Runnable
}

func NewAPIWatchMapProvider

func NewAPIWatchMapProvider(ctx context.Context,
	numThreads int,
	discoveryClusterClient clusterdiscovery.DiscoveryClusterInterface,
	crdClusterPreInformer kcpinformers.GenericClusterInformer,
	bindingClusterPreInformer kcpinformers.GenericClusterInformer,
) APIWatchMapProvider

NewAPIWatchMapProvider constructs an APIMapProvider that gets its information from apiwatch.

type BindingOrganizer

type BindingOrganizer func(discovery APIMapProvider, resourceModes ResourceModes, eventHandler EventHandler, workloadProjector WorkloadProjector) SingleBinder

BindingOrganizer takes a WorkloadProjector and produces a SingleBinder that takes the atomized bindings and reorganizes them and resolves the API group version issue to feed the WorkloadProjector. A SetBinder implementation will likely use one of these to drive its WorkloadProjector, feeding the SingleBinder atomized changes from the incoming ResolvedWhat and ResolvedWhere values. The given EventHandler is given events that the organizer produces and publishes them somewhere.

func SimpleBindingOrganizer

func SimpleBindingOrganizer(logger klog.Logger) BindingOrganizer

SimpleBindingOrganizer constructs a BindingOrganizer. It is not so simple any more. See the comment on the implementation for the queries and the query plan that implement this thing.

type Client

type Client[T any] interface {
	SetProvider(T)
}

type ClientTracker

type ClientTracker[Provider any] struct {
	// contains filtered or unexported fields
}

ClientTracker keeps track of a set of clients and reports when RemoveClient removed the last of them. NOT safe for concurrent use.

func NewClientTracker

func NewClientTracker[Provider any]() *ClientTracker[Provider]

func (*ClientTracker[Provider]) AddClient

func (ct *ClientTracker[Provider]) AddClient(client Client[Provider])

func (*ClientTracker[Provider]) IsEmpty

func (ct *ClientTracker[Provider]) IsEmpty() bool

func (*ClientTracker[Provider]) RemoveClient

func (ct *ClientTracker[Provider]) RemoveClient(client Client[Provider]) bool

func (*ClientTracker[Provider]) SetProvider

func (ct *ClientTracker[Provider]) SetProvider(provider Provider)

type ClusterWhatWhereFullKey

type ClusterWhatWhereFullKey = Triple[ExternalName, Pair[metav1.GroupResource, string], SinglePlacement]

ClusterWhatWhereFullKey is (EdgePlacement id, (resource, object name), destination)

type Comparison

type Comparison struct{ LessOrEqual, GreaterOrEqual bool }

func SetCompare

func SetCompare[Elt any](set1, set2 Set[Elt]) Comparison

func (Comparison) IsEqual

func (comp Comparison) IsEqual() bool

func (Comparison) IsRelated

func (comp Comparison) IsRelated() bool

func (Comparison) IsStrictlyGreater

func (comp Comparison) IsStrictlyGreater() bool

func (Comparison) IsStrictlyLess

func (comp Comparison) IsStrictlyLess() bool

func (Comparison) Reverse

func (comp Comparison) Reverse() Comparison

type DynamicMapProvider

type DynamicMapProvider[Key comparable, Val any] interface {
	// AddReceiver causes the given receiver to be notified of following
	// changes and, if notifyCurrent, the current map contents.
	// If receivers are comparable: depending on the implementation,
	// successive adds of the same receiver have no more effect than
	// the first add, or lead to duplicated callbacks to the receiver.
	// The producer precedes each receiver in the locking order.
	AddReceiver(receiver MappingReceiver[Key, Val], notifyCurrent bool)

	// Get invokes the given function on the value corresponding to the key.
	// This does not count as informing any particular receiver.
	// The producer precedes the function in the locking order.
	Get(Key, func(Val))
}

DynamicMapProvider holds a mutable map and keeps clients appraised of it. The zero value of Val signals a missing entry in the map.

type DynamicMapProviderWithRelease

type DynamicMapProviderWithRelease[Key comparable, Val any] interface {
	DynamicMapProvider[Key, Val]

	// MaybeRelease invokes the given function on the value corresponding to the
	// given key and, if the function returns true, may release some internal resources
	// associated with that key.
	// The producer precedes the given function in the locking order.
	MaybeRelease(Key, func(Val) bool)
}

type DynamicValueProvider

type DynamicValueProvider[Val any] interface {
	AddReceiver(Receiver[Val])
	Get(func(Val))
}

type Empty

type Empty struct{}

type Emptyable

type Emptyable interface {
	IsEmpty() bool
}

Emptyable is something that can be tested for emptiness. The thing may or may not be mutable. This view of the thing may or may not have a limited scope of validity. This view may or may not have concurrency restrictions.

type EventHandler

type EventHandler interface {
	HandleEvent(*k8sevents.Event)
}

EventHandler can be given Event objects.

type ExternalName

type ExternalName struct {
	// Cluster identifies the cluster.  It is the one-part ID, not a path.
	Cluster logicalcluster.Name

	Name string
}

ExternalName identifies a cluster-scoped object of some implicit kind

func NewExternalName

func NewExternalName(cluster, name string) ExternalName

NewExternalName assumes the given cluster identifier is proper

func (ExternalName) OfSPLocation

func (ExternalName) OfSPLocation(sp SinglePlacement) ExternalName

func (ExternalName) OfSPTarget

func (ExternalName) OfSPTarget(sp SinglePlacement) ExternalName

func (ExternalName) String

func (en ExternalName) String() string

type FactoredMap

type FactoredMap[WholeKey, KeyPartA, KeyPartB comparable, Val any] interface {
	MutableMap[WholeKey, Val]
	GetIndex() FactoredMapIndex[KeyPartA, KeyPartB, Val]
}

FactoredMap is a map implemented by two levels of mapping. It has a general key decomposition/composition rotator.

func NewFactoredMap

func NewFactoredMap[WholeKey, KeyPartA, KeyPartB comparable, Val any](
	keyDecomposer Factorer[WholeKey, KeyPartA, KeyPartB],
	innerMapConstructor func() MutableMap[KeyPartB, Val],
	outerMap MutableMap[KeyPartA, MutableMap[KeyPartB, Val]],
	unifiedObserver MapChangeReceiver[WholeKey, Val],
	outerObserver MappingReceiver[KeyPartA, Map[KeyPartB, Val]],
) FactoredMap[WholeKey, KeyPartA, KeyPartB, Val]

NewFactoredMap creates a factored map implemented by the given outer map and constructor of inner maps.

func NewFactoredMapMap

func NewFactoredMapMap[WholeKey, KeyPartA, KeyPartB comparable, Val any](
	keyDecomposer Factorer[WholeKey, KeyPartA, KeyPartB],
	unifiedObserver MapChangeReceiver[WholeKey, Val],
	outerKeysetObserver SetChangeReceiver[KeyPartA],
	outerObserver2 MappingReceiver[KeyPartA, Map[KeyPartB, Val]],
) FactoredMap[WholeKey, KeyPartA, KeyPartB, Val]

NewFactoredMapMap makes a FactoredMap implements by golang maps.

func NewFactoredMapMapAggregator

func NewFactoredMapMapAggregator[WholeKey, KeyPartA, KeyPartB comparable, Val any, Aggregation any](
	keyDecomposer Factorer[WholeKey, KeyPartA, KeyPartB],
	unifiedObserver MapChangeReceiver[WholeKey, Val],
	outerKeysetObserver SetChangeReceiver[KeyPartA],
	aggregate func(KeyPartA, Map[KeyPartB, Val]) Aggregation,
	aggregationObserver MappingReceiver[KeyPartA, Aggregation],
) FactoredMap[WholeKey, KeyPartA, KeyPartB, Val]

NewFactoredMapMapAggregator makes a FactoredMap that also notifies a receiver of updates to a GROUP BY KeyPartA & aggregate.

type FactoredMapIndex

type FactoredMapIndex[KeyPartA, KeyPartB comparable, Val any] interface {
	Map[KeyPartA, Map[KeyPartB, Val]]
	Visit1to2(KeyPartA, func(Pair[KeyPartB, Val]) error) error
}

FactoredMapIndex is an index into a factored map.

type Factorer

type Factorer[Whole, PartA, PartB any] Rotator[Whole, Pair[PartA, PartB]]

Factorer is a Rotator that converts from some Whole type to some Pair type (and back)

func NewFactorer

func NewFactorer[Whole, PartA, PartB any](forward func(Whole) Pair[PartA, PartB], reverse func(Pair[PartA, PartB]) Whole) Factorer[Whole, PartA, PartB]

func PairFactorer

func PairFactorer[PartA, PartB any]() Factorer[Pair[PartA, PartB], PartA, PartB]

func QuadFactorerTo1and234

func QuadFactorerTo1and234[ColW, ColX, ColY, ColZ any]() Factorer[Quad[ColW, ColX, ColY, ColZ], ColW, Triple[ColX, ColY, ColZ]]

func TripleFactorerTo13and2

func TripleFactorerTo13and2[ColX, ColY, ColZ any]() Factorer[Triple[ColX, ColY, ColZ], Pair[ColX, ColZ], ColY]

func TripleFactorerTo1and23

func TripleFactorerTo1and23[ColX, ColY, ColZ any]() Factorer[Triple[ColX, ColY, ColZ], ColX, Pair[ColY, ColZ]]

func TripleFactorerTo23and1

func TripleFactorerTo23and1[ColX, ColY, ColZ any]() Factorer[Triple[ColX, ColY, ColZ], Pair[ColY, ColZ], ColX]

func TripleFactorerTo3and21

func TripleFactorerTo3and21[ColX, ColY, ColZ any]() Factorer[Triple[ColX, ColY, ColZ], ColZ, Pair[ColY, ColX]]

func (Factorer[Whole, PartA, PartB]) Factor

func (factoring Factorer[Whole, PartA, PartB]) Factor(whole Whole) (PartA, PartB)

func (Factorer[Whole, PartA, PartB]) Unfactor

func (factoring Factorer[Whole, PartA, PartB]) Unfactor(partA PartA, partB PartB) Whole

type GenericIndexedSet

type GenericIndexedSet[Tuple, Key, Val, ValSet any] interface {
	Set[Tuple]
	GetIndex1to2() Index2[Key, Val, ValSet]
}

GenericIndexedSet is a readonly set of Tuple whose representation is based on factoring each Tuple into Key and Val parts and using a map from Key to set of Val. Making the Val set type a type parameter allows the use of this in contexts where the Val set itself has interesting properties beyond just being a set of Val. For example, this construction can be thus nested in a way that makes the inner structure available.

func GenericMutableIndexedSetToReadonly

func GenericMutableIndexedSetToReadonly[Tuple, Key, Val, ValMutableSet, ValSet any](gi *genericMutableIndexedSet[Tuple, Key, Val, ValMutableSet, ValSet]) GenericIndexedSet[Tuple, Key, Val, ValSet]

type GenericMutableIndexedSet

type GenericMutableIndexedSet[Tuple, Key, Val, ValSet any] interface {
	GenericIndexedSet[Tuple, Key, Val, ValSet]
	MutableSet[Tuple]

	// AsReadonly returns a view that does not support writes
	AsReadonly() GenericIndexedSet[Tuple, Key, Val, ValSet]
}

GenericMutableIndexedSet is a GenericIndexedSet that also provides write access.

type GroupResourceInstance

type GroupResourceInstance = Pair[metav1.GroupResource, string]

type HashDomain

type HashDomain[Elt any] interface {
	Equal(Elt, Elt) bool
	Hash(Elt) HashValue
}

func NewSliceHashDomain

func NewSliceHashDomain[Elt any](eltDomain HashDomain[Elt]) HashDomain[[]Elt]

func NewTransformHashDomain

func NewTransformHashDomain[Original, Transformed any](tranform func(Original) Transformed, transformedDomain HashDomain[Transformed]) HashDomain[Original]

func PairHashDomain

func PairHashDomain[First, Second any](first HashDomain[First], second HashDomain[Second]) HashDomain[Pair[First, Second]]

func TripleHashDomain

func TripleHashDomain[First, Second, Third any](first HashDomain[First], second HashDomain[Second], third HashDomain[Third]) HashDomain[Triple[First, Second, Third]]

type HashDomainFuncs

type HashDomainFuncs[Elt any] struct {
	DoEqual func(Elt, Elt) bool
	DoHash  func(Elt) HashValue
}

func NewHashDomainFuncs

func NewHashDomainFuncs[Elt any](equal func(Elt, Elt) bool, hash func(Elt) HashValue) HashDomainFuncs[Elt]

func (HashDomainFuncs[Elt]) Equal

func (hdf HashDomainFuncs[Elt]) Equal(left, right Elt) bool

func (HashDomainFuncs[Elt]) Hash

func (hdf HashDomainFuncs[Elt]) Hash(elt Elt) HashValue

type HashDomainString

type HashDomainString struct{}

func (HashDomainString) Equal

func (HashDomainString) Equal(left, right string) bool

func (HashDomainString) Hash

func (HashDomainString) Hash(arg string) HashValue

type HashSinglePlacement

type HashSinglePlacement struct{}

func (HashSinglePlacement) Equal

func (HashSinglePlacement) Equal(left, right SinglePlacement) bool

func (HashSinglePlacement) Hash

type HashUpsyncSet

type HashUpsyncSet struct{}

func (HashUpsyncSet) Equal

func (HashUpsyncSet) Equal(left, right edgeapi.UpsyncSet) bool

func (HashUpsyncSet) Hash

type HashValue

type HashValue = uint64

func StringHash

func StringHash(arg string) HashValue

type Index2

type Index2[Key, Val, ValSet any] interface {
	Map[Key, ValSet]
	Visit1to2(Key, func(Val) error) error
}

type Map

type Map[Key, Val any] interface {
	Emptyable
	Len() int
	LenIsCheap() bool
	Get(Key) (Val, bool)
	Visitable[Pair[Key, Val]]
}

Map is a finite set of (key,value) pairs that has at most one value for any given key. The collection may or may not be mutable. This view of the collection may or may not have a limited scope of validity. This view may or may not have concurrency restrictions.

func Map12VEquijoinRelation13

func Map12VEquijoinRelation13[First, Second, Third comparable, Val any](left Map[Pair[First, Second], Val], right Relation2[Second, Third]) Map[Triple[First, Second, Third], Val]

func MapEquijoin12With13

func MapEquijoin12With13[Key comparable, ValLeft, ValRight any](left Map[Key, ValLeft], right Map[Key, ValRight]) Map[Key, Pair[ValLeft, ValRight]]

func MapReadonly

func MapReadonly[Key, Val any](inner Map[Key, Val]) Map[Key, Val]

MapReadonly returns a version of the argument that does not support writes

func NewMapToConstant

func NewMapToConstant[Key comparable, Val any](keys Set[Key], val Val) Map[Key, Val]

func RotateKeyMap

func RotateKeyMap[Original, Rotated comparable, Val any](rotator Rotator[Original, Rotated], inner Map[Rotated, Val]) Map[Original, Val]

RotateKeyMap rotates the key space of a Map. The given Map has keys that are rotated forward, according to the given Rotator, from the returned Map.

type MapChangeReceiver

type MapChangeReceiver[Key, Val any] interface {
	Create(Key, Val)

	// Update is given key, old value, new value
	Update(Key, Val, Val)

	// DeleteWithFinal is given key and last value
	DeleteWithFinal(Key, Val)
}

MapChangeReceiver is what a stateful map offers to an observer

func MapKeySetReceiver

func MapKeySetReceiver[Key, Val any](ksr SetWriter[Key]) MapChangeReceiver[Key, Val]

MapKeySetReceiver extends a SetWriter for keys into a MapChangeReceiver that simply ignores the associated values.

func MappingReceiverDiscardsPrevious

func MappingReceiverDiscardsPrevious[Key, Val any](mr MappingReceiver[Key, Val]) MapChangeReceiver[Key, Val]

MappingReceiverDiscardsPrevious produces a MapChangeReceiver that dumbs down its info to pass along to the given MappingReceiver

type MapChangeReceiverFork

type MapChangeReceiverFork[Key, Val any] []MapChangeReceiver[Key, Val]

func (MapChangeReceiverFork[Key, Val]) Create

func (mrf MapChangeReceiverFork[Key, Val]) Create(key Key, val Val)

func (MapChangeReceiverFork[Key, Val]) DeleteWithFinal

func (mrf MapChangeReceiverFork[Key, Val]) DeleteWithFinal(key Key, val Val)

func (MapChangeReceiverFork[Key, Val]) Update

func (mrf MapChangeReceiverFork[Key, Val]) Update(key Key, oldVal, newVal Val)

type MapChangeReceiverFuncs

type MapChangeReceiverFuncs[Key, Val any] struct {
	OnCreate func(Key, Val)
	OnUpdate func(Key, Val, Val)
	OnDelete func(Key, Val)
}

MapChangeReceiverFuncs is a convenient constructor of MapChangeReceiver from three funcs

func (MapChangeReceiverFuncs[Key, Val]) Create

func (mrf MapChangeReceiverFuncs[Key, Val]) Create(key Key, val Val)

func (MapChangeReceiverFuncs[Key, Val]) DeleteWithFinal

func (mrf MapChangeReceiverFuncs[Key, Val]) DeleteWithFinal(key Key, val Val)

func (MapChangeReceiverFuncs[Key, Val]) Update

func (mrf MapChangeReceiverFuncs[Key, Val]) Update(key Key, oldVal, newVal Val)

type MapDifferenceConstructor

type MapDifferenceConstructor[Map any, Key, Val comparable] func(MapChangeReceiver[Key, Val]) Receiver[Map]

MapDifferenceConstructor is a function that is given a receiver of map differences and returns a receiver of maps that keeps track of the latest map and keeps the difference receiver informed of differences as they arrive. The map differencer precedes the map difference receiver in the locking order.

type MapMap

type MapMap[Key comparable, Val any] struct {
	// contains filtered or unexported fields
}

func MapMapCopy

func MapMapCopy[Key comparable, Val any](observer MapChangeReceiver[Key, Val], other Visitable[Pair[Key, Val]]) MapMap[Key, Val]

MapMapCopy creates a new MapMap holding what the given Visitable reported at construction time.

func MintMapMap

func MintMapMap[Key comparable, Val any](theMap map[Key]Val, observer MapChangeReceiver[Key, Val]) MapMap[Key, Val]

MintMapMap takes the given map and obervers puts the MapMap seal of approval on them. It is the user's responsibility to not surprise themself.

func NewMapMap

func NewMapMap[Key comparable, Val any](observer MapChangeReceiver[Key, Val]) MapMap[Key, Val]

NewMapMap makes a new Map implemented by a Map, optionally with a given observer. For providing initial values see AddArgs, AddAllByVisit, MapMapCopy below.

func (MapMap[Key, Val]) AddAllByVisit

func (mm MapMap[Key, Val]) AddAllByVisit(what Visitable[Pair[Key, Val]]) MapMap[Key, Val]

AddAllByVisit enumerates the given Visitable and adds every pair enumerated, in order, and returns the Map itself.

func (MapMap[Key, Val]) AddArgs

func (mm MapMap[Key, Val]) AddArgs(args ...Pair[Key, Val]) MapMap[Key, Val]

AddArgs adds the given pairs and returns the map itself. The pairs are added in the order given.

func (MapMap[Key, Val]) Delete

func (mm MapMap[Key, Val]) Delete(key Key)

func (MapMap[Key, Val]) Get

func (mm MapMap[Key, Val]) Get(key Key) (Val, bool)

func (MapMap[Key, Val]) IsEmpty

func (mm MapMap[Key, Val]) IsEmpty() bool

func (MapMap[Key, Val]) Len

func (mm MapMap[Key, Val]) Len() int

func (MapMap[Key, Val]) LenIsCheap

func (mm MapMap[Key, Val]) LenIsCheap() bool

func (MapMap[Key, Val]) Put

func (mm MapMap[Key, Val]) Put(key Key, val Val)

func (MapMap[Key, Val]) Visit

func (mm MapMap[Key, Val]) Visit(visitor func(Pair[Key, Val]) error) error

type MapSet

type MapSet[Elt comparable] map[Elt]Empty

func MapSetCopy

func MapSetCopy[Elt comparable](source Visitable[Elt]) MapSet[Elt]

func NewEmptyMapSet

func NewEmptyMapSet[Elt comparable]() MapSet[Elt]

func NewMapSet

func NewMapSet[Elt comparable](elts ...Elt) MapSet[Elt]

func (MapSet[Elt]) Add

func (ms MapSet[Elt]) Add(elt Elt) bool

func (MapSet[Elt]) Has

func (ms MapSet[Elt]) Has(elt Elt) bool

func (MapSet[Elt]) IsEmpty

func (ms MapSet[Elt]) IsEmpty() bool

func (MapSet[Elt]) Len

func (ms MapSet[Elt]) Len() int

func (MapSet[Elt]) LenIsCheap

func (ms MapSet[Elt]) LenIsCheap() bool

func (MapSet[Elt]) Remove

func (ms MapSet[Elt]) Remove(elt Elt) bool

func (MapSet[Elt]) Visit

func (ms MapSet[Elt]) Visit(visitor func(Elt) error) error

type MapToConstant

type MapToConstant[Key comparable, Val any] struct {
	// contains filtered or unexported fields
}

func (MapToConstant[Key, Val]) Get

func (mtc MapToConstant[Key, Val]) Get(key Key) (Val, bool)

func (MapToConstant[Key, Val]) IsEmpty

func (mtc MapToConstant[Key, Val]) IsEmpty() bool

func (MapToConstant[Key, Val]) Len

func (mtc MapToConstant[Key, Val]) Len() int

func (MapToConstant[Key, Val]) LenIsCheap

func (mtc MapToConstant[Key, Val]) LenIsCheap() bool

func (MapToConstant[Key, Val]) Visit

func (mtc MapToConstant[Key, Val]) Visit(visitor func(Pair[Key, Val]) error) error

type MappingReceiver

type MappingReceiver[Key, Val any] interface {
	Put(Key, Val)
	Delete(Key)
}

MappingReceiver is something that can be given key/value pairs. This is the writable aspect of a Map. Some DynamicMapProvider implementations require receivers to be comparable.

func MapKeySetReceiverLossy

func MapKeySetReceiverLossy[Key, Val any](ksr SetWriter[Key]) MappingReceiver[Key, Val]

MapKeySetReceiverLossy extends a SetWriter for keys into a MappingReceiver that simply ignores the associated values. It is lossy in that it may make redundant calls to Add.

func MappingReceiverFunc

func MappingReceiverFunc[Key, Val any](fn func() MappingReceiver[Key, Val]) MappingReceiver[Key, Val]

MappingReceiverFunc produces a MappingReceiver that defers to another MappingReceiver computed on each use

func NewLoggingMappingReceiver

func NewLoggingMappingReceiver[Key comparable, Val any](mapName string, logger klog.Logger) MappingReceiver[Key, Val]

func NewMappingReceiverFuncs

func NewMappingReceiverFuncs[Key, Val any](put func(Key, Val), delete func(Key)) MappingReceiver[Key, Val]

func RotateMappingReceiver

func RotateMappingReceiver[Original, Rotated comparable, Val any](rotator Rotator[Original, Rotated], inner MappingReceiver[Rotated, Val]) MappingReceiver[Original, Val]

RotateMappingReceiver rotates the key space of a MappingReceiver.

type MappingReceiverFork

type MappingReceiverFork[Key, Val any] []MappingReceiver[Key, Val]

func NewMappingReceiverFork

func NewMappingReceiverFork[Key, Val any](elts ...MappingReceiver[Key, Val]) MappingReceiverFork[Key, Val]

func (MappingReceiverFork[Key, Val]) Delete

func (mrf MappingReceiverFork[Key, Val]) Delete(key Key)

func (MappingReceiverFork[Key, Val]) Put

func (mrf MappingReceiverFork[Key, Val]) Put(key Key, val Val)

type MappingReceiverFuncs

type MappingReceiverFuncs[Key, Val any] struct {
	OnPut    func(Key, Val)
	OnDelete func(Key)
}

MappingReceiverFuncs is a convenient constructor of MappingReceiver from two funcs

func (MappingReceiverFuncs[Key, Val]) Create

func (mrf MappingReceiverFuncs[Key, Val]) Create(key Key, val Val)

func (MappingReceiverFuncs[Key, Val]) Delete

func (mrf MappingReceiverFuncs[Key, Val]) Delete(key Key)

func (MappingReceiverFuncs[Key, Val]) DeleteWithFinal

func (mrf MappingReceiverFuncs[Key, Val]) DeleteWithFinal(key Key, oldVal Val)

func (MappingReceiverFuncs[Key, Val]) Put

func (mrf MappingReceiverFuncs[Key, Val]) Put(key Key, val Val)

func (MappingReceiverFuncs[Key, Val]) Update

func (mrf MappingReceiverFuncs[Key, Val]) Update(key Key, oldVal, newVal Val)

type MappingReceiverHolder

type MappingReceiverHolder[Key, Val any] struct{ MappingReceiver[Key, Val] }

Pointers to these are comparable, unlike `MappingReceiver` in go 1.19

type MappingReceiverHolderFork

type MappingReceiverHolderFork[Key, Val any] []*MappingReceiverHolder[Key, Val]

func (MappingReceiverHolderFork[Key, Val]) Delete

func (mrf MappingReceiverHolderFork[Key, Val]) Delete(key Key)

func (MappingReceiverHolderFork[Key, Val]) Put

func (mrf MappingReceiverHolderFork[Key, Val]) Put(key Key, val Val)

type MutableIndex2

type MutableIndex2[Key, Val, ValSet any] interface {
	Index2[Key, Val, ValSet]
	Add(Key, Val) bool
	Remove(Key, Val) bool
}

type MutableMap

type MutableMap[Key, Val any] interface {
	Map[Key, Val]
	MappingReceiver[Key, Val]
}

MutableMap is a Map that can be written to.

func MutableMapWithKeyObserver

func MutableMapWithKeyObserver[Key, Val any](mm MutableMap[Key, Val], observer SetWriter[Key]) MutableMap[Key, Val]

func RotatedKeyMutableMap

func RotatedKeyMutableMap[Original, Rotated comparable, Val any](rotator Rotator[Original, Rotated], inner MutableMap[Rotated, Val]) MutableMap[Original, Val]

func WrapMapWithMutex

func WrapMapWithMutex[Key comparable, Val any](theMap MutableMap[Key, Val]) MutableMap[Key, Val]

type MutableRelation2

type MutableRelation2[First, Second any] interface {
	Relation2[First, Second]
	MutableSet[Pair[First, Second]]
}

func Relation2WithObservers

func Relation2WithObservers[First, Second any](inner MutableRelation2[First, Second], observers ...SetWriter[Pair[First, Second]]) MutableRelation2[First, Second]

type MutableSet

type MutableSet[Elt any] interface {
	Set[Elt]
	SetWriter[Elt]
}

func NewHashSet

func NewHashSet[Elt any](domain HashDomain[Elt], elts ...Elt) MutableSet[Elt]

NewHashSet creates a new set based on a hash map

func NewSetByMapToEmpty

func NewSetByMapToEmpty[Elt any](theMap MutableMap[Elt, Empty]) MutableSet[Elt]

NewSetByMapToEmpty takes a mutable map to Empty and returns the behavior of its key set. For the readonly version, see MapKeySet.

func WrapSetWithMutex

func WrapSetWithMutex[Elt any](inner MutableSet[Elt]) MutableSet[Elt]

type NamespaceAndDestination

type NamespaceAndDestination = Pair[NamespaceName, SinglePlacement]

type NamespaceDistributionTuple

type NamespaceDistributionTuple = Triple[logicalcluster.Name, NamespaceName, SinglePlacement]

type NamespaceName

type NamespaceName string

type NamespacedJoinKeyLessnS

type NamespacedJoinKeyLessnS = Triple[logicalcluster.Name, metav1.GroupResource, SinglePlacement]

type NamespacedResourceDistributionTuple

type NamespacedResourceDistributionTuple struct {
	SourceCluster logicalcluster.Name
	ProjectionModeKey
}

type NatureMode

type NatureMode string

NatureMode describes the stance regarding whether a resource is denatured in the center. All resources that go to the edge are natured (not denatured) at the edge.

const (
	// NaturalyDenatured is a resource that is denatured in the center without any special
	// effort in this code.
	NaturalyDenatured NatureMode = "NaturallyDenatured"

	// NaturallyNatured is a resource that is natured in the center and should be that way.
	NaturallyNatured NatureMode = "NaturallyNatured"

	// ForciblyDenatured is a resource that would be given an undesired interpretation in the center
	// if stored normally in the center, so has to be stored differently in the center (but not
	// at the edge).
	ForciblyDenatured NatureMode = "ForciblyDenatured"
)

type NonNamespacedDistributionTuple

type NonNamespacedDistributionTuple = Pair[ProjectionModeKey, ExternalName]

type Pair

type Pair[First, Second any] struct {
	First  First
	Second Second
}

func NewPair

func NewPair[First, Second any](first First, second Second) Pair[First, Second]

func PairReverse

func PairReverse[First, Second comparable](forward Pair[First, Second]) Pair[Second, First]

func (Pair[First, Second]) Reverse

func (tup Pair[First, Second]) Reverse() Pair[Second, First]

func (Pair[First, Second]) String

func (tup Pair[First, Second]) String() string

type ProjectionKey

type ProjectionKey struct {
	metav1.GroupResource
	Destination SinglePlacement
}

ProjectionKey identifies the topmost level of organization, the combinatin of the destination and the API group and resource.

type ProjectionModeKey

type ProjectionModeKey struct {
	GroupResource metav1.GroupResource
	Destination   SinglePlacement
}

type ProjectionModeVal

type ProjectionModeVal struct {
	APIVersion string // just the version, no group
}

type PropagationMode

type PropagationMode string

PropagationMode describes the relationship between present-in-center and present-in-edge

const (
	ErrorInCenter    PropagationMode = "error"
	TolerateInCenter PropagationMode = "tolerate"
	GoesToMailbox    PropagationMode = "tomail"
	GoesToEdge       PropagationMode = "propagate"
)

type Quad

type Quad[First, Second, Third, Fourth any] struct {
	First  First
	Second Second
	Third  Third
	Fourth Fourth
}

func NewQuad

func NewQuad[First, Second, Third, Fourth any](first First, second Second, third Third, fourth Fourth) Quad[First, Second, Third, Fourth]

type Receiver

type Receiver[Val any] interface {
	Receive(Val)
}

func NewMapDifferenceByMapAndEnum

func NewMapDifferenceByMapAndEnum[MapType any, Key, Val comparable](visitablize func(MapType) Visitable[Pair[Key, Val]], mappingChangeReceiver MapChangeReceiver[Key, Val]) Receiver[MapType]

func NewResolvedWhereDifferencer

func NewResolvedWhereDifferencer(eltChangeReceiver SetWriter[SinglePlacement]) Receiver[ResolvedWhere]

func NewSetDifferenceByMapAndEnum

func NewSetDifferenceByMapAndEnum[SetType any, Elt comparable](visitablize func(SetType) Visitable[Elt], eltChangeReceiver SetWriter[Elt]) Receiver[SetType]

func NewSliceDifferencerParametric

func NewSliceDifferencerParametric[Elt any](isEqual func(Elt, Elt) bool, changeReceiver SetChangeReceiver[Elt], initial []Elt) Receiver[[]Elt]

func NewUpsyncDifferencer

func NewUpsyncDifferencer(eltReceiver SetChangeReceiver[edgeapi.UpsyncSet]) Receiver[[]edgeapi.UpsyncSet]

type Reducer

type Reducer[Elt any, Ans any] func(Visitable[Elt]) Ans

Reducer is something that crunches a collection down into one value

func MapSetCopier

func MapSetCopier[Elt comparable]() Reducer[Elt, MapSet[Elt]]

func StatefulReducer

func StatefulReducer[Elt any, Accum any, Ans any](initialize func() Accum, add func(Accum, Elt), finish func(Accum) Ans) Reducer[Elt, Ans]

StatefulReducer makes a Reducer that works with a stateful accumulator

func ValueReducer

func ValueReducer[Elt any, Accum any, Ans any](initialize func() Accum, add func(Accum, Elt) Accum, finish func(Accum) Ans) Reducer[Elt, Ans]

NewReducer makes Reducer that works with accumulator values

type Relation2

type Relation2[First, Second any] interface {
	Set[Pair[First, Second]]
	GetIndex1to2() Index2[First, Second, Set[Second]]
}

Relation2 is a set of 2-tuples.

func Relation2Equijoin12with13

func Relation2Equijoin12with13[First, Second, Third comparable](left Relation2[First, Second], right Relation2[First, Third]) Relation2[Second, Third]

type RelayMap

type RelayMap[Key comparable, Val any] TransformingRelayMap[Key, Val, Val]

func NewRelayMap

func NewRelayMap[Key comparable, Val any](dedupReceivers bool) RelayMap[Key, Val]

func RelayWhatResolver

func RelayWhatResolver() RelayMap[ExternalName, WorkloadParts]

func RelayWhereResolver

func RelayWhereResolver() RelayMap[ExternalName, ResolvedWhere]

type ResolvedWhat

type ResolvedWhat struct {
	Downsync WorkloadParts
	Upsync   []edgeapi.UpsyncSet
}

ResolvedWhat describes what to downsync and what to upsync for a given (workload management workspace, edge cluster) pair.

type ResolvedWhere

type ResolvedWhere []*edgeapi.SinglePlacementSlice

ResolvedWhere identifies the set of SyncTargets that match a certain EdgePlacement's "where" predicate. Each `*edgeapi.SinglePlacementSlice` points to an immutable object.

func (ResolvedWhere) Has

func (rw ResolvedWhere) Has(seek SinglePlacement) bool

func (ResolvedWhere) IsEmpty

func (rw ResolvedWhere) IsEmpty() bool

func (ResolvedWhere) Len

func (rw ResolvedWhere) Len() int

func (ResolvedWhere) LenIsCheap

func (rw ResolvedWhere) LenIsCheap() bool

func (ResolvedWhere) String

func (where ResolvedWhere) String() string

func (ResolvedWhere) Visit

func (rw ResolvedWhere) Visit(visitor func(SinglePlacement) error) error

type ResourceDetails

type ResourceDetails struct {
	Namespaced        bool
	SupportsInformers bool
	PreferredVersion  string
}

ResourceDetails holds the information needed here about a resource

type ResourceDiscoveryKey

type ResourceDiscoveryKey = Pair[logicalcluster.Name, metav1.GroupResource]

type ResourceMode

type ResourceMode struct {
	PropagationMode PropagationMode
	NatureMode      NatureMode
	BuiltinToEdge   bool
}

ResourceMode describes how a given resource is handled regarding propagation and denaturing.

func DefaultResourceModes

func DefaultResourceModes(mgr metav1.GroupResource) ResourceMode

func (ResourceMode) GoesToEdge

func (rscMode ResourceMode) GoesToEdge() bool

GoesToEdge tells whether objects of this sort can downsync all the way to the edge cluster

func (ResourceMode) GoesToMailbox

func (rscMode ResourceMode) GoesToMailbox() bool

GoesToMailbox tells whether objects of this sort can downsync at least as far as the mailbox workspace

type ResourceModes

type ResourceModes func(metav1.GroupResource) ResourceMode

ResourceModes tells the handling of the given resource. This information comes from platform configuration and code. Immutable.

type Rotator

type Rotator[Original, Rotated any] Pair[func(Original) Rotated, func(Rotated) Original]

Rotator is something that can change one value into an equivalent value and back again. To understand the name, think of something that can rotate (forward and back) a point in some coordinate system.

func NewRotator

func NewRotator[Original, Rotated any](forward func(Original) Rotated, reverse func(Rotated) Original) Rotator[Original, Rotated]

func NoRotation

func NoRotation[Original any]() Rotator[Original, Original]

func PairReverser

func PairReverser[PartA, PartB any]() Rotator[Pair[PartA, PartB], Pair[PartB, PartA]]

func TripleReverser

func TripleReverser[PartA, PartB, PartC any]() Rotator[Triple[PartA, PartB, PartC], Triple[PartC, PartB, PartA]]

func (Rotator[Original, Rotated]) Reverse

func (rr Rotator[Original, Rotated]) Reverse() Rotator[Rotated, Original]

type RunAll

type RunAll []Runnable

RunAll is a Runnable that runs all the constituent Runnables

func (RunAll) Run

func (ra RunAll) Run(ctx context.Context)

type Runnable

type Runnable interface {
	Run(context.Context)
}

Runnable is something that can run until a given context is closed

func AssemplePlacementTranslator

func AssemplePlacementTranslator(
	whatResolver WhatResolver,
	whereResolver WhereResolver,
	setBinder SetBinder,
	workloadProjector WorkloadProjector,
) Runnable

AssemplePlacementTranslator puts together the top-level pieces.

type Set

type Set[Elt any] interface {
	Emptyable
	Len() int
	LenIsCheap() bool
	Has(Elt) bool
	Visitable[Elt]
}

func MapKeySet

func MapKeySet[Key comparable, Val any](theMap Map[Key, Val]) Set[Key]

MapKeySet produces a readonly view of a given Map's key set. For the passive version, see MapKeySetReceiver and MapKeySetReceiverLossy. For the writable version, see NewSetByMapToEmpty.

func NewSetReadonly

func NewSetReadonly[Elt any](set MutableSet[Elt]) Set[Elt]

func SetIntersection

func SetIntersection[Elt any](set1, set2 Set[Elt]) Set[Elt]

func SetRotate

func SetRotate[Original, Rotated any](originalSet Set[Original], rotator Rotator[Original, Rotated]) Set[Rotated]

type SetBinder

type SetBinder func(workloadProjector WorkloadProjector) (
	whatReceiver MappingReceiver[ExternalName, ResolvedWhat],
	whereReceiver MappingReceiver[ExternalName, ResolvedWhere])

SetBinder is a component that is kept appraised of the "what" and "where" resolutions and reorganizing and picking API versions to guide the workload projector. The implementation may atomize the resolved "what" and "where" using differencers constructed by a SetDifferencerConstructor. The implementation may use a BindingOrganizer to get from the atomized "what" and "where" to the ProjectionMappingReceiver behavior.

func NewSetBinder

func NewSetBinder(
	logger klog.Logger,
	downsyncPartsDifferencerConstructor DownsyncsDifferencerConstructor,
	upsyncsDifferenceConstructor UpsyncsDifferenceConstructor,
	resolvedWhereDifferencerConstructor ResolvedWhereDifferencerConstructor,
	bindingOrganizer BindingOrganizer,
	discovery APIMapProvider,
	resourceModes ResourceModes,
	eventHandler EventHandler,
) SetBinder

type SetBinderConstructor

type SetBinderConstructor func(
	logger klog.Logger,
	downsyncsDifferencerConstructor DownsyncsDifferencerConstructor,
	upsyncsDifferenceConstructor UpsyncsDifferenceConstructor,
	resolvedWhereDifferencerConstructor ResolvedWhereDifferencerConstructor,
	bindingOrganizer BindingOrganizer,
	discovery APIMapProvider,
	resourceModes ResourceModes,
	eventHandler EventHandler,
) SetBinder

SetBinderConstructor is a likely signature for the final assembly of a SetBinder. The differencer constructors will be called to create differencers that translate new whole values of ResolvedWhat and ResolvedWhere into elemental differences. The BindingOrganizer produces a pipe stage that is given those elemental differences and re-organizes them and solves the workload conflicts to supply input to a ProjectionMappingReceiver.

type SetChangeReceiver

type SetChangeReceiver[Elt any] func(bool, Elt)

SetChangeReceiver is SetWriter shorn of returned information and refactored to a simpler signature. The `bool` is `true` for additions to the set, `false` for removals.

type SetDifferencerConstructor

type SetDifferencerConstructor[Set any, Element comparable] func(SetWriter[Element]) Receiver[Set]

SetDifferencerConstructor is a function that is given a receiver of set differences and returns a receiver of sets that keeps track of the latest set and keeps the difference receiver informed of differences as they arrive. The set differencer precedes the set difference receiver in the locking order.

type SetReadonly

type SetReadonly[Elt any] struct {
	// contains filtered or unexported fields
}

SetReadonly is a wrapper that removes the ability to write to the set

func (SetReadonly[Elt]) Has

func (sr SetReadonly[Elt]) Has(elt Elt) bool

func (SetReadonly[Elt]) IsEmpty

func (sr SetReadonly[Elt]) IsEmpty() bool

func (SetReadonly[Elt]) Len

func (sr SetReadonly[Elt]) Len() int

func (SetReadonly[Elt]) LenIsCheap

func (sr SetReadonly[Elt]) LenIsCheap() bool

func (SetReadonly[Elt]) Visit

func (sr SetReadonly[Elt]) Visit(visitor func(Elt) error) error

type SetWriter

type SetWriter[Elt any] interface {
	Add(Elt) bool    /* changed */
	Remove(Elt) bool /* changed */
}

SetWriter is the write aspect of a Set

func NewLoggingSetWriter

func NewLoggingSetWriter[Elt any](setName string, logger klog.Logger) SetWriter[Elt]

func NewSetChangeProjector

func NewSetChangeProjector[Whole, PartA, PartB any](
	factoring Factorer[Whole, PartA, PartB],
	partAReceiver SetWriter[PartA],
	repMaker func(MapChangeReceiver[PartA, MutableSet[PartB]]) MutableMap[PartA, MutableSet[PartB]],
	innerSetFactory func(PartA) MutableSet[PartB],
) SetWriter[Whole]

NewSetChangeProjector transforms a receiver of PartA into a receiver of Whole, given a Factorer of Whole into PartA and PartB. This buffers the set in an index created by the given maker. The booleans returned by partAReceiver are ignored.

func NewSetChangeProjectorByHashMap

func NewSetChangeProjectorByHashMap[Whole, PartA, PartB any](
	factoring Factorer[Whole, PartA, PartB],
	partAReceiver SetWriter[PartA],
	hashDomainA HashDomain[PartA],
	hashDomainB HashDomain[PartB],
) SetWriter[Whole]

func NewSetChangeProjectorByMapMap

func NewSetChangeProjectorByMapMap[Whole any, PartA, PartB comparable](
	factoring Factorer[Whole, PartA, PartB],
	partAReceiver SetWriter[PartA],
) SetWriter[Whole]

NewSetChangeProjector transforms a receiver of PartA into a receiver of Whole, given a Factorer of Whole into PartA and PartB. This buffers the set in a MapMap used as an index. The booleans returned by partAReceiver are ignored.

func NewSetWriterFuncs

func NewSetWriterFuncs[Elt any](OnAdd, OnRemove func(Elt) bool) SetWriter[Elt]

func SetWriterFork

func SetWriterFork[Elt any](combineWithAnd bool, receivers ...SetWriter[Elt]) SetWriter[Elt]

SetWriterFork constructs a SetWriter that broadcasts incoming changes to the given receivers. Each change is passed on to every receiver, and combineWithAnd says whether to combine the returned values with AND (the alternative is OR).

func SetWriterReverse

func SetWriterReverse[Elt any](forward SetWriter[Elt]) SetWriter[Elt]

SetWriterReverse returns a receiver that acts in the opposite way as the given receiver. That is, Add and Remove are swapped.

func TransformSetWriter

func TransformSetWriter[Type1, Type2 any](
	transform func(Type1) Type2,
	inner SetWriter[Type2]) SetWriter[Type1]

type SetWriterFuncs

type SetWriterFuncs[Elt any] struct {
	OnAdd    func(Elt) bool
	OnRemove func(Elt) bool
}

SetWriterFuncs puts the SetWriter stamp of approval on a pair of funcs. Either may be `nil“, in which case the corresponding SetWriter method returns `false`.

func (SetWriterFuncs[Elt]) Add

func (scrf SetWriterFuncs[Elt]) Add(elt Elt) bool

func (SetWriterFuncs[Elt]) Remove

func (scrf SetWriterFuncs[Elt]) Remove(elt Elt) bool

type SingleBinder

type SingleBinder interface {
	// Transact does a collection of adds and removes.
	Transact(func(SingleBindingOps, UpsyncOps))
}

SingleBinder is appraised of individual bindings and unbindings, but they may come in batches. Add calls are ordered by API machinery dependencies. Remove calls are ordered by the reverse of the API machinery dependencies.

type SingleBindingOps

SingleBindingOps is a receiver of downsync tuples

type SingleIndexedRelation2

type SingleIndexedRelation2[First, Second any] struct {
	GenericMutableIndexedSet[Pair[First, Second], First, Second, Set[Second]]
}

SingleIndexedRelation2 is a 2-ary relation represented by an index on the first column. It is mutable. It is not safe for concurrent access.

func NewHashRelation2

func NewHashRelation2[First, Second any](hashDomainFirst HashDomain[First], hashDomainSecond HashDomain[Second], pairs ...Pair[First, Second]) SingleIndexedRelation2[First, Second]

NewHashRelation2 constructs a Relation2 that is represented by an index on the first column. The representation is based on HashMaps.

func NewMapRelation2

func NewMapRelation2[First, Second comparable](pairs ...Pair[First, Second]) SingleIndexedRelation2[First, Second]

NewMapRelation2 constructs a Relation2 that is represented by an index on the first column. The representation is based on golang `map`s.

func NewSingleIndexedRelation2

func NewSingleIndexedRelation2[First, Second any](
	secondSetFactory func(First) MutableSet[Second],
	rep MutableMap[First, MutableSet[Second]],
	pairs ...Pair[First, Second]) SingleIndexedRelation2[First, Second]

NewSingleIndexedRelation2 constructs a SingleIndexedRelation2. The caller supplies the map implementations used in the index.

type SingleIndexedRelation3

type SingleIndexedRelation3[First, Second, Third any] struct {
	GenericMutableIndexedSet[Triple[First, Second, Third], First, Pair[Second, Third],
		GenericIndexedSet[Pair[Second, Third], Second, Third, Set[Third]]]
}

SingleIndexedRelation3 is a 3-ary relation represented by one nested index that maps a First value to an index from Second to Third. It is mutable. It is not safe for concurrent access.

func NewMapRelation3

func NewMapRelation3[First, Second, Third comparable]() SingleIndexedRelation3[First, Second, Third]

type SingleIndexedRelation4

type SingleIndexedRelation4[First, Second, Third, Fourth any] struct {
	GenericMutableIndexedSet[Quad[First, Second, Third, Fourth], First, Triple[Second, Third, Fourth],
		GenericIndexedSet[Triple[Second, Third, Fourth], Second, Pair[Third, Fourth],
			GenericIndexedSet[Pair[Third, Fourth], Third, Fourth, Set[Fourth]]]]
}

SingleIndexedRelation4 is a 4-ary relation represented by one nested index that maps a First value to an index from Second to index from Third to Fourth. It is mutable. It is not safe for concurrent access.

func NewMapRelation4

func NewMapRelation4[First, Second, Third, Fourth comparable]() SingleIndexedRelation4[First, Second, Third, Fourth]

type SinglePlacement

type SinglePlacement = edgeapi.SinglePlacement

type SliceHashDomain

type SliceHashDomain[Elt any] struct{ EltDomain HashDomain[Elt] }

func (SliceHashDomain[Elt]) Equal

func (shd SliceHashDomain[Elt]) Equal(left, right []Elt) bool

func (SliceHashDomain[Elt]) Hash

func (shd SliceHashDomain[Elt]) Hash(slice []Elt) HashValue

type SourceAndDestination

type SourceAndDestination = Pair[logicalcluster.Name, SinglePlacement]

type TestAPIMapProvider

type TestAPIMapProvider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

TestAPIMapProvider is a funky APIMapProvider for testing purposes. It is not fully compliant regarding locking. It exposes internals for test functions to examine and manipulate. A test func can modify a cluster's GroupInfo and/or ResourceInfo and the registered receivers will be synchronously updated, but this should only be done while there is no concurrent acess going on.

func NewTestAPIMapProvider

func NewTestAPIMapProvider(logger klog.Logger) *TestAPIMapProvider

func (*TestAPIMapProvider) AddReceivers

func (tap *TestAPIMapProvider) AddReceivers(cluster logicalcluster.Name,
	groupReceiver *MappingReceiverHolder[string, APIGroupInfo],
	resourceReceiver *MappingReceiverHolder[metav1.GroupResource, ResourceDetails])

func (*TestAPIMapProvider) AsResourceReceiver

func (tap *TestAPIMapProvider) AsResourceReceiver() MappingReceiver[Pair[logicalcluster.Name, metav1.GroupResource], ResourceDetails]

func (*TestAPIMapProvider) RemoveReceivers

func (tap *TestAPIMapProvider) RemoveReceivers(cluster logicalcluster.Name,
	groupReceiver *MappingReceiverHolder[string, APIGroupInfo],
	resourceReceiver *MappingReceiverHolder[metav1.GroupResource, ResourceDetails])

type TestAPIPerCluster

type TestAPIPerCluster struct {
	GroupInfo    MutableMap[string, APIGroupInfo]
	ResourceInfo MutableMap[metav1.GroupResource, ResourceDetails]
	// contains filtered or unexported fields
}

type TransactionalMappingReceiver

type TransactionalMappingReceiver[Key, Val any] interface {
	Transact(func(MappingReceiver[Key, Val]))
}

TransactionalMappingReceiver is one that takes updates in batches

type TransformHashDomain

type TransformHashDomain[Original, Transformed any] struct {
	Transform         func(Original) Transformed
	TransformedDomain HashDomain[Transformed]
}

func (TransformHashDomain[Original, Transformed]) Equal

func (thd TransformHashDomain[Original, Transformed]) Equal(left, right Original) bool

func (TransformHashDomain[Original, Transformed]) Hash

func (thd TransformHashDomain[Original, Transformed]) Hash(arg Original) HashValue

type TransformMappingReceiver

type TransformMappingReceiver[KeyOriginal, KeyTransformed, ValOriginal, ValTransformed any] struct {
	TransformKey func(KeyOriginal) KeyTransformed
	TransformVal func(ValOriginal) ValTransformed
	Inner        MappingReceiver[KeyTransformed, ValTransformed]
}

func (TransformMappingReceiver[KeyOriginal, KeyTransformed, ValOriginal, ValTransformed]) Delete

func (xr TransformMappingReceiver[KeyOriginal, KeyTransformed, ValOriginal, ValTransformed]) Delete(keyOriginal KeyOriginal)

func (TransformMappingReceiver[KeyOriginal, KeyTransformed, ValOriginal, ValTransformed]) Put

func (xr TransformMappingReceiver[KeyOriginal, KeyTransformed, ValOriginal, ValTransformed]) Put(keyOriginal KeyOriginal, valOriginal ValOriginal)

type TransformingRelayMap

type TransformingRelayMap[Key comparable, OuterVal any, InnerVal any] interface {
	MappingReceiver[Key, OuterVal]
	OuterGet(Key) OuterVal
	DynamicMapProviderWithRelease[Key, InnerVal]
	Len() int
	Remove(Key)
}

func NewRelayAndProjectMap

func NewRelayAndProjectMap[Key comparable, OuterVal any, InnerVal any](dedupReceivers bool, transform func(OuterVal) InnerVal) TransformingRelayMap[Key, OuterVal, InnerVal]

type Triple

type Triple[First, Second, Third any] struct {
	First  First
	Second Second
	Third  Third
}

func NewTriple

func NewTriple[First, Second, Third any](first First, second Second, third Third) Triple[First, Second, Third]

func (Triple[PartA, PartB, PartC]) Reverse

func (tup Triple[PartA, PartB, PartC]) Reverse() Triple[PartC, PartB, PartA]

func (Triple[First, Second, Third]) String

func (tup Triple[First, Second, Third]) String() string

type TripleSetWriterReverse23

type TripleSetWriterReverse23[Left, Middle, Right any] struct {
	// contains filtered or unexported fields
}

func (TripleSetWriterReverse23[Left, Middle, Right]) Add

func (prr TripleSetWriterReverse23[Left, Middle, Right]) Add(tup Triple[Left, Right, Middle]) bool

func (TripleSetWriterReverse23[Left, Middle, Right]) Remove

func (prr TripleSetWriterReverse23[Left, Middle, Right]) Remove(tup Triple[Left, Right, Middle]) bool

type TrivialTransactor

type TrivialTransactor[OpsType any] struct{ Ops OpsType }

func (TrivialTransactor[OpsType]) Transact

func (tt TrivialTransactor[OpsType]) Transact(xn func(OpsType))

type UpsyncOps

UpsyncOps is a receiver of upsync tuples. Each call conveys one UpsyncSet that a particular EdgePlacement object calls for, and where it is to be upsynced from. Some day we might recognize that an UpsyncSet is a predicate and we combine predicates when one implies the other, but today is not that day. Today we simply treat each as a syntactic expression and look at syntactic equality.

type UpsyncsDifferenceConstructor

type UpsyncsDifferenceConstructor = func(SetChangeReceiver[edgeapi.UpsyncSet]) Receiver[[]edgeapi.UpsyncSet]

UpsyncsDifferenceConstructor constructs a difference for slices of UpsyncSet. Note that there are two levels of "set" here: a `[]UpsyncSet` is an OR-of-ANDs expression of how to identify objects to upsync, and an `UpsyncSet` has "set" in its name because it includes some fields that are logically sets. The differencer here differences successive OR-of-ANDs expressions to deliver changes in which ANDs are present.

type Visitable

type Visitable[Elt any] interface {
	// Visit calls the given function on every member, aborting on error
	Visit(func(Elt) error) error
}

Visitable is a collection that can do an interruptable enumeration of its members. The collection may or may not be mutable. This view of the collection may or may not have a limited scope of validity. This view may or may not have concurrency restrictions.

func JoinByVisitSquared

func JoinByVisitSquared[Left, Right, Joint any](
	left Visitable[Left],
	right Visitable[Right],
	match func(Left, Right) (Joint, bool),
) Visitable[Joint]

func MapSetAsVisitable

func MapSetAsVisitable[Elt comparable](ms MapSet[Elt]) Visitable[Elt]

func ResolvedWhereAsVisitable

func ResolvedWhereAsVisitable(rw ResolvedWhere) Visitable[SinglePlacement]

func TransformVisitable

func TransformVisitable[Original, Transformed any](originalVisitable Visitable[Original], transform func(Original) Transformed) Visitable[Transformed]

type VisitableStringerVal

type VisitableStringerVal[Elt any] struct {
	// contains filtered or unexported fields
}

func VisitableStringer

func VisitableStringer[Elt any](set Visitable[Elt]) VisitableStringerVal[Elt]

VisitableStringer wraps a given set with particular String() behavior. NB: you only want to apply this to a set that is safe for concurrent access, and you probably only want to apply it to an immutable set.

func (VisitableStringerVal[Elt]) String

func (vs VisitableStringerVal[Elt]) String() string

type WhatResolver

WhatResolver is responsible for keeping its receiver eventually consistent with the resolution of the "what" predicate and the upsync prescription of each EdgePlacement (identified by cluster ane name).

func NewWhatResolver

func NewWhatResolver(
	ctx context.Context,
	edgePlacementPreInformer edgev1alpha1informers.EdgePlacementClusterInformer,
	discoveryClusterClient clusterdiscovery.DiscoveryClusterInterface,
	crdClusterPreInformer kcpinformers.GenericClusterInformer,
	bindingClusterPreInformer kcpinformers.GenericClusterInformer,
	dynamicClusterClient clusterdynamic.ClusterInterface,
	numThreads int,
) WhatResolver

NewWhatResolver returns a WhatResolver; invoke that function after the namespace informer has synced.

type WhatResolverClusterHandler

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

func (WhatResolverClusterHandler) Get

func (wr WhatResolverClusterHandler) Get(placement ExternalName, kont func(WorkloadParts))

func (WhatResolverClusterHandler) OnAdd

func (wrh WhatResolverClusterHandler) OnAdd(obj any)

func (WhatResolverClusterHandler) OnDelete

func (wrh WhatResolverClusterHandler) OnDelete(obj any)

func (WhatResolverClusterHandler) OnUpdate

func (wrh WhatResolverClusterHandler) OnUpdate(oldObj, newObj any)

func (WhatResolverClusterHandler) Run

func (wr WhatResolverClusterHandler) Run(ctx context.Context)

type WhatResolverScopedHandler

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

func (WhatResolverScopedHandler) Get

func (wr WhatResolverScopedHandler) Get(placement ExternalName, kont func(WorkloadParts))

func (WhatResolverScopedHandler) OnAdd

func (wrh WhatResolverScopedHandler) OnAdd(obj any)

func (WhatResolverScopedHandler) OnDelete

func (wrh WhatResolverScopedHandler) OnDelete(obj any)

func (WhatResolverScopedHandler) OnUpdate

func (wrh WhatResolverScopedHandler) OnUpdate(oldObj, newObj any)

func (WhatResolverScopedHandler) Run

func (wr WhatResolverScopedHandler) Run(ctx context.Context)

type WhereResolver

type WhereResolver func(MappingReceiver[ExternalName, ResolvedWhere]) Runnable

WhereResolver is responsible for keeping given receiver eventually consistent with the resolution of the "where" predicate for each EdgePlacement (identified by cluster and name).

func NewWhereResolver

func NewWhereResolver(
	ctx context.Context,
	spsPreInformer edgev1alpha1informers.SinglePlacementSliceClusterInformer,
	numThreads int,
) WhereResolver

NewWhereResolver returns a WhereResolver.

type WhereResolverClusterHandler

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

func (WhereResolverClusterHandler) AddReceiver

func (wr WhereResolverClusterHandler) AddReceiver(receiver MappingReceiver[ExternalName, ResolvedWhere], notifyCurrent bool)

func (WhereResolverClusterHandler) Get

func (wr WhereResolverClusterHandler) Get(placement ExternalName, kont func(ResolvedWhere))

func (WhereResolverClusterHandler) OnAdd

func (wrh WhereResolverClusterHandler) OnAdd(obj any)

func (WhereResolverClusterHandler) OnDelete

func (wrh WhereResolverClusterHandler) OnDelete(obj any)

func (WhereResolverClusterHandler) OnUpdate

func (wrh WhereResolverClusterHandler) OnUpdate(oldObj, newObj any)

func (WhereResolverClusterHandler) Run

func (wr WhereResolverClusterHandler) Run(ctx context.Context)

type WorkloadPartDetails

type WorkloadPartDetails struct {
	// APIVersion is version (no group) that the source workspace prefers to serve.
	// In the case of a namespace object: this field only applies to the namespace
	// object itself, not the namespace contents, and is the empty string if
	// IncludeNamespaceObject is false.
	APIVersion string

	// IncludeNamespaceObject is only interesting for a Namespace part, and
	// indicates whether to include the details of the Namespace object;
	// the objects in the namespace are certainly included.
	// For other parts, this field holds `false`.
	IncludeNamespaceObject bool
}

WorkloadPartDetails provides additional details about how the WorkloadPart is to be included.

type WorkloadPartID

type WorkloadPartID struct {
	APIGroup string

	// Resource is the lowercase plural way of identifying the kind of object
	Resource string

	Name string
}

WorkloadPartID identifies part of a workload.

func (WorkloadPartID) GroupResource

func (partID WorkloadPartID) GroupResource() metav1.GroupResource

type WorkloadPartX

type WorkloadPartX struct {
	WorkloadPartID
	WorkloadPartDetails
}

type WorkloadParts

type WorkloadParts map[WorkloadPartID]WorkloadPartDetails

WorkloadParts identifies what to downsync and provides ephemeral details for that process. A workload prescription is the things that match the "what" predicate of an EdgePlacement.

Every WorkloadParts that appears in the interfaces here is immutable.

In the case of a Namespace object, this implies that all the objects in that namespace are included.

A workload may include objects of kinds that are built into the edge cluster. By built-in we mean that these kinds are both already known (regardless of whether it is via being built into the apiserver or added to it by either form of aggregation) and not managed by edge workload management. It is the user's responsibility to make the "what" predicate match the corresponding CRD when the workload includes an object of a kind that is not built into the edge cluster.

type WorkloadProjectionSections

type WorkloadProjectionSections struct {
	NamespaceDistributions          SetWriter[NamespaceDistributionTuple]
	NamespacedResourceDistributions SetWriter[NamespacedResourceDistributionTuple]
	NamespacedModes                 MappingReceiver[ProjectionModeKey, ProjectionModeVal]
	NonNamespacedDistributions      SetWriter[NonNamespacedDistributionTuple]
	NonNamespacedModes              MappingReceiver[ProjectionModeKey, ProjectionModeVal]
	Upsyncs                         SetWriter[Pair[SinglePlacement, edgeapi.UpsyncSet]]
}

WorkloadProjectionSections is given, incrementally, instructions for what goes where how, organized for consumption by syncers. The FooDistributions are proper sets, while the FooModes add dependent information for set members. The booleans returned from the SetWriters may not be meaningful.

type WorkloadProjector

type WorkloadProjector interface {
	Transact(func(WorkloadProjectionSections))
}

WorkloadProjector is kept appraised of what goes where and is responsible for maintaining (a) the customized workload copies in the mailbox workspaces and (b) the syncer configuration objects.

func NewLoggingWorkloadProjector

func NewLoggingWorkloadProjector(logger klog.Logger) WorkloadProjector

Jump to

Keyboard shortcuts

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