sharding

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyForController

func KeyForController(obj client.Object) (string, error)

KeyForController returns a ring key for the controller of the given object. It returns an empty key if the object doesn't have an ownerReference with controller=true".

func KeyForObject

func KeyForObject(obj client.Object) (string, error)

KeyForObject returns a ring key for the given object itself. It needs the TypeMeta (GVK) to be set, which is not set on objects after decoding by default.

Types

type KeyFunc

type KeyFunc func(client.Object) (string, error)

KeyFunc maps objects to hash keys. It returns an error if the prequisities for sharding the given object are not fulfilled. If the returned key is empty, the object should not be assigned.

func KeyFuncForResource

func KeyFuncForResource(gr metav1.GroupResource, ring Ring) (KeyFunc, error)

KeyFuncForResource returns the key function that maps the given resource or its controller dependening on whether the resource is listed as a resource or controlled resource in the given ring.

type Ring

type Ring interface {
	client.Object
	LeaseSelector() labels.Selector
	LabelShard() string
	LabelDrain() string
	RingResources() []shardingv1alpha1.RingResource
}

Ring is the interface that is implemented by all ring objects that the sharder can handle.

Directories

Path Synopsis
Package leases implements logic for determining the state of shards based on their membership Lease object.
Package leases implements logic for determining the state of shards based on their membership Lease object.

Jump to

Keyboard shortcuts

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