docs
Systems
Messaging
QuerySystem
QuerySystem Overview

The QuerySystem provides a typed way to ask the system that owns a Domain for data, without changing any state. Callers build a Query addressed to a Domain, send it through the message bus, and read the answer from the query's result.

The system exists so that any part of SaffronLibrary can read data owned by another system (platform, level time, current level, game speed) without referencing that system directly. Each query carries a target Domain, a QueryVerb, input Params describing what is asked, and result Params filled in by the handling system.

Key responsibilities:

  • Define the query message. Query and the IQuery contract carry the target domain, verb, input params, result params, and status.
  • Define query vocabulary. QueryVerb, QueryStatus, and QuerySubjects describe what is asked, the outcome, and the subject being asked about.
  • Provide typed access helpers. QueryKeys and QueryKeyNames define the param keys, and QueryFactory builds and sends the shared queries and returns their typed values.

Who should use it: gameplay and UI developers who need read-only data from another domain, and developers adding new query subjects or handlers in an owning system.

Dependencies (connections only):

  • Contracts supplies the Domain enum that routes each query.
  • Params supplies the typed ParamKey and Params containers that carry query data.
  • Bus supplies the QueryBus and BusUtility that deliver queries, and the message bus base that queues them.