Skip to main content

Module query

Module query 

Source
Expand description

Asynchronous query resources and clocks for scenarios.

A Query is the display state of one query subscription: first load, data, refresh and failure, so controls do not stitch booleans together. Every request gets a new parameter version; only the result for the current version is accepted. A slower answer to an older request — the first of two searches typed in a row — is discarded instead of overwriting the newer result, and the older request is cancelled. This “current result only” rule is for queries; engine commands keep their own retry and idempotency policies.

QuerySubscriptions holds the live subscriptions of a UI session. Each belongs to a window instance and ends with it; a subscription whose query reads engine state is requested again when that state changes.

Providers schedule delayed work through a Clock. SystemClock uses real time; ManualClock only moves when a scenario advances it, so the order of asynchronous completions is part of the test, not an accident.

Structs§

Cancellation
Signals a query provider that its answer is no longer wanted: the subscription moved on to newer parameters or ended. Clones share the same flag, so the requester and the provider see one request.
ManualClock
A clock that only moves when a scenario advances it. Timers fire in due order, ties in the order they were scheduled, on the thread that advances the clock.
Query
One query subscription with its parameter versions.
QuerySubscription
A live subscription to one catalog query, owned by a window instance.
QuerySubscriptions
The query subscriptions of one UI session.
SystemClock
Real time. One timer thread runs while timers are pending and ends when none are left.
Ticket
Identity of one request: the parameter version it was made for.

Enums§

Resolution
Whether a result changed what the query shows.
Resource
What a query shows. An empty result is Ready with empty data: success, not failure.

Traits§

Clock
Time source for providers that answer later. Scenarios inject a ManualClock to decide the order of completions.