versionregistry

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package versionregistry stores short-lived, deployment-scoped Gateway versions.

Index

Constants

View Source
const TTL = 3 * time.Minute

TTL is the window in which a Gateway report remains active.

Variables

This section is empty.

Functions

func Validate

func Validate(node Node, expectedNamespace string) error

Validate checks a wire report against the configured deployment namespace. The wire namespace must be explicit. Empty or unrecognized version text is valid information; version comparison is separate from protocol validation.

Types

type Group

type Group struct {
	Version   string `json:"version"`
	BuildKind string `json:"build_kind"`
	Count     int    `json:"count"`
}

Group contains only aggregate version information, never node identities.

func GroupNodes

func GroupNodes(nodes []Node) []Group

GroupNodes groups canonical stable versions by build kind. Unknown and uncomparable versions remain visible, and output is ordered by version/kind.

type Node

type Node struct {
	SchemaVersion int    `json:"schema_version"`
	Namespace     string `json:"namespace"`
	InstanceID    string `json:"instance_id"`
	Version       string `json:"version"`
	BuildKind     string `json:"build_kind"`
}

Node is the version-report wire protocol, independent of request metrics.

type Store

type Store interface {
	Upsert(context.Context, Node) error
	List(context.Context) ([]Node, error)
	Delete(context.Context, string) error
}

Store manages active reports in one deployment namespace.

func NewMemoryStore

func NewMemoryStore(namespace string, now func() time.Time) Store

NewMemoryStore creates an isolated, in-memory report store. An empty namespace defaults to "default", and a nil clock uses time.Now. Invalid configuration is reported by every operation.

func NewRedisStore

func NewRedisStore(client *redis.Client, namespace string) Store

NewRedisStore borrows client without taking ownership of its lifecycle. Empty namespace defaults to "default"; deployments sharing a Redis DB must configure distinct namespaces. Invalid configuration fails every operation without issuing Redis commands.

Jump to

Keyboard shortcuts

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