java.lang.Object
org.gcube.informationsystem.resourceregistry.redis.RedisKeySpace

public final class RedisKeySpace extends Object
Central registry of Redis key constants and factory methods for the Resource Registry. All keys are prefixed with RedisConfiguration.KEY_PREFIX to allow safe co-hosting with other applications on the same Redis instance.

Context key schema:

  • {prefix}:ctx:uuid:{uuid} — STRING — canonical context JSON (includes path)
  • {prefix}:ctx:path:{uuid} — STRING — computed path string
  • {prefix}:ctx:fname:{urlEncodedPath} — STRING — URL-encoded path → UUID
  • {prefix}:ctx:prevpath:{urlEncodedPath} — STRING — URL-encoded previous path → UUID
  • {prefix}:ctx:list — ZSET — UUID members with insertion-order score
  • {prefix}:ctx:children:{uuid} — SET — direct child UUIDs
  • {prefix}:ctx:parent:{uuid} — STRING — parent UUID (absent for root)

Type key schema:

  • {prefix}:type:uuid:{uuid} — STRING — canonical type JSON
  • {prefix}:type:name:{urlEncodedTypeName} — STRING — URL-encoded type name → UUID
  • {prefix}:type:list — ZSET — UUID members with insertion-order score
  • {prefix}:type:children:{uuid} — SET — direct subtype UUIDs
  • {prefix}:type:parent:{uuid} — SET — direct supertype UUIDs (multiple inheritance supported; absent for root types)
  • {prefix}:type:linearization:{uuid} — STRING — precomputed C3-linearized JSON array of ancestor type names, internal-only
Author:
Luca Frosini (ISTI - CNR)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Scan/delete pattern matching every key of this registry, whatever its namespace.
    static final String
    Pub/sub channel carrying every cross-instance notification (message payload: a serialized ClusterEvent), so a change handled by one service instance reaches every other one sharing this Redis.
    static final String
    Redis key for the ordered set (ZSET) of all context UUIDs.
    static final String
    Scan/delete pattern matching every context-related key.
    static final String
    Version of the authoritative Context state represented by the complete cache.
    static final String
    Fast-read copy of the authoritative schema version counter held in the database.
    static final String
    Redis key for the ordered set (ZSET) of all type UUIDs.
    static final String
    Scan/delete pattern matching every type-related key.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Key of the SET that holds the direct child UUIDs of the given context.
    static String
    Key that maps a context path to its UUID.
    static String
    Key that stores the parent UUID string for the given context UUID.
    static String
    Key that stores the computed path string for the given context UUID (e.g.
    static String
    Key that maps one of a context's previous paths to its UUID.
    static String
    Key that stores the full canonical JSON for the given context UUID.
    static String
    Key of the SET that holds the direct subtype UUIDs of the given type.
    static String
    Key that stores the precomputed, C3-linearized list of ancestor type names for the given type, in Method-Resolution-Order (most-derived-first) -- internal-only bookkeeping, never part of a type's own returned JSON representation (mirrors type:parent/ type:children: derived structural data kept alongside the type's canonical blob, not inside it).
    static String
    Key of the negative-cache tombstone recording that no Type with this name exists.
    static String
    typeNameKey(String typeName)
    Key that maps a type name to its UUID.
    static String
    Key of the SET that holds the direct supertype UUIDs of the given type (multiple inheritance supported; absent for root types).
    static String
    Key that stores the canonical JSON for the given type UUID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALL_SCAN_PATTERN

      public static final String ALL_SCAN_PATTERN
      Scan/delete pattern matching every key of this registry, whatever its namespace.
    • CTX_LIST_KEY

      public static final String CTX_LIST_KEY
      Redis key for the ordered set (ZSET) of all context UUIDs.
    • CTX_VERSION_KEY

      public static final String CTX_VERSION_KEY
      Version of the authoritative Context state represented by the complete cache.
    • CTX_SCAN_PATTERN

      public static final String CTX_SCAN_PATTERN
      Scan/delete pattern matching every context-related key.
    • TYPE_LIST_KEY

      public static final String TYPE_LIST_KEY
      Redis key for the ordered set (ZSET) of all type UUIDs.
    • TYPE_SCAN_PATTERN

      public static final String TYPE_SCAN_PATTERN
      Scan/delete pattern matching every type-related key.
    • SCHEMA_VERSION_KEY

      public static final String SCHEMA_VERSION_KEY
      Fast-read copy of the authoritative schema version counter held in the database.

      Deliberately outside the type: namespace: TYPE_SCAN_PATTERN is what invalidateAll() sweeps, and a version stamp stored under it would be destroyed by the very invalidation whose effect it exists to detect.

      It is a cache of the counter, never the counter itself — the database remains authoritative, and a missing or unreadable value must be treated as "cannot validate", meaning every cached entry is ignored, never as "unchanged".

    • CLUSTER_EVENT_CHANNEL

      public static final String CLUSTER_EVENT_CHANNEL
      Pub/sub channel carrying every cross-instance notification (message payload: a serialized ClusterEvent), so a change handled by one service instance reaches every other one sharing this Redis. A single channel serves all event kinds; the kind is carried inside the message rather than encoded in the channel name, which keeps one subscription — and, on the backstop side, one reserved OrientDB session — regardless of how many kinds exist.
  • Method Details

    • contextUuidKey

      public static String contextUuidKey(UUID uuid)
      Key that stores the full canonical JSON for the given context UUID. The JSON includes the injected path field.
      Parameters:
      uuid - the UUID of the context
      Returns:
      the Redis key
    • contextPathKey

      public static String contextPathKey(UUID uuid)
      Key that stores the computed path string for the given context UUID (e.g. /gcube/devsec/devVRE).
      Parameters:
      uuid - the UUID of the context
      Returns:
      the Redis key
    • contextFnameKey

      public static String contextFnameKey(String path)
      Key that maps a context path to its UUID. The path is URL-encoded so that / characters do not clash with the : separator used elsewhere in the key structure.
      Parameters:
      path - the fully-qualified context path
      Returns:
      the Redis key
    • contextPreviousPathKey

      public static String contextPreviousPathKey(String path)
      Key that maps one of a context's previous paths to its UUID. Kept apart from contextFnameKey(String), so that a current path is always looked up first.
      Parameters:
      path - the previous path
      Returns:
      the Redis key
    • contextChildrenKey

      public static String contextChildrenKey(UUID uuid)
      Key of the SET that holds the direct child UUIDs of the given context.
      Parameters:
      uuid - the UUID of the context
      Returns:
      the Redis key
    • contextParentKey

      public static String contextParentKey(UUID uuid)
      Key that stores the parent UUID string for the given context UUID. Absent for root contexts.
      Parameters:
      uuid - the UUID of the context
      Returns:
      the Redis key
    • typeUuidKey

      public static String typeUuidKey(UUID uuid)
      Key that stores the canonical JSON for the given type UUID.
      Parameters:
      uuid - the UUID of the type
      Returns:
      the Redis key
    • typeNameKey

      public static String typeNameKey(String typeName)
      Key that maps a type name to its UUID. The name is URL-encoded to avoid collisions with the : separator.
      Parameters:
      typeName - the name of the type
      Returns:
      the Redis key
    • typeChildrenKey

      public static String typeChildrenKey(UUID uuid)
      Key of the SET that holds the direct subtype UUIDs of the given type.
      Parameters:
      uuid - the UUID of the type
      Returns:
      the Redis key
    • typeParentKey

      public static String typeParentKey(UUID uuid)
      Key of the SET that holds the direct supertype UUIDs of the given type (multiple inheritance supported; absent for root types).
      Parameters:
      uuid - the UUID of the type
      Returns:
      the Redis key
    • typeLinearizationKey

      public static String typeLinearizationKey(UUID uuid)
      Key that stores the precomputed, C3-linearized list of ancestor type names for the given type, in Method-Resolution-Order (most-derived-first) -- internal-only bookkeeping, never part of a type's own returned JSON representation (mirrors type:parent/ type:children: derived structural data kept alongside the type's canonical blob, not inside it). Computed once, at type creation / cache warm-up time, so that ordinary reads never have to recompute or re-derive it.
      Parameters:
      uuid - the UUID of the type
      Returns:
      the Redis key
    • typeMissingKey

      public static String typeMissingKey(String typeName)
      Key of the negative-cache tombstone recording that no Type with this name exists.

      Keyed by name rather than by UUID, because a type that does not exist has no UUID — which is precisely the lookup being answered. Shares the type: namespace so that invalidateAll() clears tombstones along with everything else.

      Parameters:
      typeName - the canonical type name
      Returns:
      the Redis key