datastore

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllPodsPredicate = func(_ fwkdl.Endpoint) bool { return true }
)

Functions

This section is empty.

Types

type Datastore

type Datastore interface {
	// InferencePool operations
	// PoolSet sets the given pool in datastore. If the given pool has different label selector than the previous pool
	// that was stored, the function triggers a resync of the pods to keep the datastore updated. If the given pool
	// is nil, this call triggers the datastore.Clear() function.
	PoolSet(ctx context.Context, reader client.Reader, endpointPool *datalayer.EndpointPool) error
	PoolGet() (*datalayer.EndpointPool, error)
	PoolHasSynced() bool
	PoolLabelsMatch(podLabels map[string]string) bool
	WithEndpointPool(pool *datalayer.EndpointPool) Datastore

	// InferenceObjective operations
	ObjectiveSet(infObjective *v1alpha2.InferenceObjective)
	ObjectiveGet(objectiveName string) *v1alpha2.InferenceObjective
	ObjectiveDelete(namespacedName types.NamespacedName)
	ObjectiveGetAll() []*v1alpha2.InferenceObjective

	// InferenceModelRewrite operations
	ModelRewriteSet(infModelRewrite *v1alpha2.InferenceModelRewrite)
	ModelRewriteDelete(namespacedName types.NamespacedName)
	// ModelRewriteGet returns the highest-precedence rewrite rule for a given
	// model name (prioritizing exact matches over generic wildcard rules) and
	// the name of the InferenceModelRewrite object.
	ModelRewriteGet(modelName string) (*v1alpha2.InferenceModelRewriteRule, string)
	ModelRewriteGetAll() []*v1alpha2.InferenceModelRewrite

	// PodList lists pods matching the given predicate.
	PodList(predicate func(fwkdl.Endpoint) bool) []fwkdl.Endpoint
	PodUpdateOrAddIfNotExist(ctx context.Context, pod *corev1.Pod) bool
	PodDelete(podName string)

	// EndpointUpsert adds or updates an endpoint from a non-Kubernetes discovery source.
	EndpointUpsert(ctx context.Context, meta *fwkdl.EndpointMetadata)
	// EndpointDelete removes the endpoint with the given namespaced name.
	EndpointDelete(id types.NamespacedName)

	// Clears the store state, happens when the pool gets deleted.
	Clear()
}

The datastore is a local cache of relevant data for the given InferencePool (currently all pulled from k8s-api)

func NewDatastore

func NewDatastore(parentCtx context.Context, epFactory datalayer.EndpointFactory, modelServerMetricsPort int32) Datastore

NewDatastore creates a new data store. TODO: modelServerMetricsPort is being deprecated

Jump to

Keyboard shortcuts

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