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
- func CubeProxyHeartbeat() string
- func CubeProxyRegistry() string
- func DeleteKeys(newKey, legacyKey string) []string
- func DescribeTask(taskID string) string
- func InstanceInfo(insID string) string
- func InstanceMeta(objs ...string) string
- func LegacyDescribeTask(taskID string) string
- func LegacyInstanceInfo(insID string) string
- func LegacyInstanceMeta(objs ...string) string
- func LegacyNodeMetric(nodeID string) string
- func LegacySandboxProxy(sandboxID string) string
- func LockSandbox(sandboxID string) string
- func NodeMetric(nodeID string) string
- func ReadKeysWithFallback(newKey, legacyKey string) []string
- func SandboxLifecycleEvents() string
- func SandboxLifecycleMeta() string
- func SandboxLifecycleState(sandboxID string) string
- func SandboxProxy(sandboxID string) string
Constants ¶
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 = "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 ¶
DeleteKeys returns both the new and legacy keys so teardown removes residue from either naming generation.
func DescribeTask ¶
DescribeTask is the async describe-task result Hash key.
func InstanceInfo ¶
InstanceInfo is the instance metadata Hash key.
func InstanceMeta ¶
InstanceMeta is the generic instance metadata key (string/list).
func LegacyDescribeTask ¶
LegacyDescribeTask is the pre-standardization describe-task key.
func LegacyInstanceInfo ¶
LegacyInstanceInfo is the pre-standardization instance info key.
func LegacyInstanceMeta ¶
LegacyInstanceMeta is the pre-standardization metadata key.
func LegacyNodeMetric ¶
LegacyNodeMetric is the bare node ID used before namespacing.
func LegacySandboxProxy ¶
LegacySandboxProxy is the pre-standardization sandbox proxy key.
func LockSandbox ¶
LockSandbox is the Master op lock for pause / resume / delete on one sandbox. Format: cube:v1:master:lock:sandbox:{sandboxID}
func NodeMetric ¶
NodeMetric is the per-node resource metric Hash key.
func ReadKeysWithFallback ¶
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 ¶
SandboxLifecycleState is the per-sandbox pause/resume coordination key.
func SandboxProxy ¶
SandboxProxy is the sandbox proxy routing Hash key, shared with CubeProxy.
Types ¶
This section is empty.