rediskey

package
v0.0.0-...-99a0925 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0, BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package rediskey centralizes Redis key construction so every key shares a unified namespace ("cube:{ver}:{scope}:{resource}[:{sub}]:{id}") instead of scattered string literals.

Writes use the new namespaced keys only. Reads try the new key first and fall back to the legacy key so a simultaneous CubeMaster/CubeProxy upgrade can still see data written before the cutover.

See docs/architecture/redis-key-spec.md for the full convention.

Index

Constants

View Source
const (
	// Prefix is the fixed product namespace guarding against collisions with
	// third-party keys in the shared Redis instance.
	Prefix = "cube"
	// Version is the schema version; bump only on breaking value-structure
	// changes (adding fields / Hash members does not require a bump).
	Version = "v1"

	// ScopeMaster marks data read/written only by CubeMaster.
	ScopeMaster = "master"
	// ScopeProxy marks data private to CubeProxy.
	ScopeProxy = "proxy"
	// ScopeAPI marks data private to CubeAPI (reserved, not yet used).
	ScopeAPI = "api"
	// ScopeShared marks cross-service contracts (renaming needs coordination).
	ScopeShared = "shared"
)

Variables

This section is empty.

Functions

func CubeProxyHeartbeat

func CubeProxyHeartbeat() string

CubeProxyHeartbeat is the Sorted Set of CubeProxy replica heartbeats (score=unix_ms, member=proxy_id).

func CubeProxyRegistry

func CubeProxyRegistry() string

CubeProxyRegistry is the Hash of live CubeProxy replica endpoints (proxy_id → JSON {admin_url,...}). Written by CubeProxy; read by CLM/Master.

func DeleteKeys

func DeleteKeys(newKey, legacyKey string) []string

DeleteKeys returns both the new and legacy keys so teardown removes residue from either naming generation.

func DescribeTask

func DescribeTask(taskID string) string

DescribeTask is the async describe-task result Hash key.

func InstanceInfo

func InstanceInfo(insID string) string

InstanceInfo is the instance metadata Hash key.

func InstanceMeta

func InstanceMeta(objs ...string) string

InstanceMeta is the generic instance metadata key (string/list).

func LegacyDescribeTask

func LegacyDescribeTask(taskID string) string

LegacyDescribeTask is the pre-standardization describe-task key.

func LegacyInstanceInfo

func LegacyInstanceInfo(insID string) string

LegacyInstanceInfo is the pre-standardization instance info key.

func LegacyInstanceMeta

func LegacyInstanceMeta(objs ...string) string

LegacyInstanceMeta is the pre-standardization metadata key.

func LegacyNodeMetric

func LegacyNodeMetric(nodeID string) string

LegacyNodeMetric is the bare node ID used before namespacing.

func LegacySandboxProxy

func LegacySandboxProxy(sandboxID string) string

LegacySandboxProxy is the pre-standardization sandbox proxy key.

func LockSandbox

func LockSandbox(sandboxID string) string

LockSandbox is the Master op lock for pause / resume / delete on one sandbox. Format: cube:v1:master:lock:sandbox:{sandboxID}

func NodeMetric

func NodeMetric(nodeID string) string

NodeMetric is the per-node resource metric Hash key.

func ReadKeysWithFallback

func ReadKeysWithFallback(newKey, legacyKey string) []string

ReadKeysWithFallback returns the key try-order for reads: new first, legacy second. Used while legacy keys may still exist in Redis after upgrade.

func SandboxLifecycleEvents

func SandboxLifecycleEvents() string

SandboxLifecycleEvents is the append-only create/delete event stream.

func SandboxLifecycleMeta

func SandboxLifecycleMeta() string

SandboxLifecycleMeta is the global HSet of sandbox lifecycle snapshots.

func SandboxLifecycleState

func SandboxLifecycleState(sandboxID string) string

SandboxLifecycleState is the per-sandbox pause/resume coordination key.

func SandboxProxy

func SandboxProxy(sandboxID string) string

SandboxProxy is the sandbox proxy routing Hash key, shared with CubeProxy.

Types

This section is empty.

Jump to

Keyboard shortcuts

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