gNode-Client

Geodineum Service Daemon (gNode) Client Implementation Keynotes

Architecture Primer: Modularity • Security • Extensibility • Resilience

Key Stream Connection Pattern

Stream Naming Convention:

{site_id}:gnode:unified:{environment}    # Unified command stream (client → daemon)
{site_id}:res:{request_id}               # Per-request response key (daemon → client, polled)

Braces around site_id are literal (Redis Cluster hash-tag routing). The stream is per-DTAP-environment (testing|staging|acceptance|production), not per-node (src/gNodeClient.php:297-302).

Multi-Node Architecture

Multi-Site Support

Security Model

Command Format

Commands travel as XADD fields with canonical short names and full command names (src/gNodeClient.php:3341-3365):

{
  "t": "c",                        // Type: command
  "id": "example.com:6864...",     // Request id (uniqid, site-prefixed)
  "c": "geometric_discover",       // Full command name (no abbreviation on the wire)
  "p": "{\"capabilities\":[...],\"_request_id\":\"...\"}", // JSON-encoded params
  "ss": "example.com",             // Source site
  "sn": "client",                  // Source node
  "ts": "1751500000000.123"        // Unix timestamp, MILLISECONDS
}

Long-form aliases (command, params, site_id, ...) are accepted daemon-side (gNode daemon/src/utils.rs::field_names) but this client always emits the short forms.

Response Format

The daemon writes the response JSON to the per-request response key; the client polls it via FCALL GNODE_CACHE_GET with exponential backoff (src/gNodeClient.php:3466+):

{
  "status": "ok",              // "ok" or "error"
  "result": {},                // Result data (present on success)
  "error": null                // Error message (present on failure)
}

Command Processing Flow

  1. Client XADDs command to the unified stream
  2. Daemon reads command via consumer group gnode-daemon
  3. Command processor validates and routes command
  4. Handler processes command and produces result
  5. Daemon writes response to {site_id}:res:{request_id}
  6. Client polls the response key until hit or timeout

ValKey Functions vs Direct Commands

Batch Processing

Command Library

System Commands

Geometric Commands

Stream Commands

Node/Site Commands

Client-level Commands

Error Handling Strategy

Client Implementation Guidelines

  1. Modularity: Separate connection, command, response handling
  2. Extensibility: Command handler registry pattern
  3. Error Recovery: Implement proper fallback mechanisms
  4. Connection Pooling: Reuse connections
  5. Asynchronous Support: Non-blocking operations
  6. Logging: Consistent logging with configurable levels
  7. Validation: Validate all parameters before sending

Design Principles

Implementation Checklist

Benchmarking Expectations


SPR Tags: #service-discovery #capability-space #geometric-topology #n-dimensional #valkey-functions #stream-processing #modular-architecture #resilient-design #valkey-streams

SPR Vectors: [service_mesh, 0.87], [distributed_systems, 0.92], [microservices, 0.78], [capability_mapping, 0.95], [topology_management, 0.89]

SPR Prompt: Consider service capability as coordinates in n-dimensional space for O(1) discovery.