EventQueryGateways
The events query model of an aggregate type on the unified engine (revising): a DefaultQueryGateway over the type's events backend, admitted against the schema schemaProvider compiles (me.ahoo.wow.query.schema.EventsQuerySchemas), under the same filters, policies, observers, budgets and count cache as its snapshots.
Record. One event stream, the commit of one command:
aggregateId,tenantId,version,commitTime(epoch milliseconds),commandId,requestId,commandType,ownerIdandspaceId(null when unset),operator({id, tenantId, crossScope}, null for an anonymous caller),access(the aggregate's current access attributes,ownerandspaceamong them; null for a stream not stamped yet) andevents, each{name, revision, body}. Its identity is(aggregateId, version);countcounts streams; an event condition is anELEMENT_MATCHonevents, and per-event analytics expand it (AggregationQuery.elements).Reading. The backend returns streams as stored (EventStreamRecords.stored); each record is read as EventStreamRecords.reader says: every event as the aggregate's model reads it now (reading), an event the aggregate retired left out, and each body masked by its event's schema (masks), for every caller alike.
Visibility. The scope and the access policies filter the streams on what each records, the aggregate's current owner, space and access attributes: an events query need not name its aggregates, unless the store refuses one that does not (UnpinnedEvents.REFUSE), and its descriptor then lists AGGREGATE_REQUIRED.
Counts. counts must be the events model's own cache: a cache is keyed by aggregate type, not by model.
Free filtering reads the write store: the PostgreSQL and MongoDB logs index only (aggregateId, tenantId, version), (tenantId, requestId) and (partition, sequence), so a condition without the aggregate scans the type's log. The entry's QueryBudget (sizes, count limit, timeout) bounds it, the store's QueryBulkhead bounds how many run at once, and unpinned may refuse it (UnpinnedEvents.REFUSE); an analytics-heavy deployment serves the model from ClickHouse or Elasticsearch.