Available on crate feature
client only.Expand description
Layer 1: GPUI QueryClient — global registry for query resources.
QueryClient is a GPUI Global that manages type-partitioned buckets
for queries, mutations, and observers. It provides bulk operations like
invalidate_queries, cancel_queries, and garbage collection.
§Audit 3 fixes
gc()accepts optionalnow_msparameter viagc_with_time()to avoid redundant syscalls (finding 2)expect()on TypeId downcast replaced with graceful recovery + type name in error message (findings 3, 4)cancel_queries()added for bulk in-flight request cancellation (finding 5)get_query_data()/set_query_data()for ergonomic cache access (finding 6)diagnostics()now populates per-resource diagnostic details (finding 7)dehydrate()/hydrate()for state serialization across restarts (finding 8)QueryPersistertrait andpersist()/restore()for pluggable persistence (finding 9)fetch_query()for imperative one-shot fetches (finding 10)prefetch_query()for background cache warming (finding 11)
Structs§
- Cache
Mutation - Marker
gpui::Globalbumped whenever cached query data changes. - Client
Diagnostic - Aggregate diagnostic for the entire QueryClient.
- Dehydrated
Entry - A single entry in a dehydrated query cache snapshot.
- Dehydrated
State - A portable snapshot of all cached query state.
- Infinite
Query Bucket - Type-partitioned storage for infinite query resources of a specific
(T, E)type pair. - Mutation
Bucket - Type-partitioned storage for mutation resources.
- Mutation
Diagnostic - Diagnostic information about a single mutation resource.
- Noop
Persister - A
Persisterthat persists nothing and loads an empty snapshot. - Observer
- Observes a resource and triggers re-renders only on status changes.
- Observer
Config - Configuration for a query observer.
- Persist
Handle - Drop-guard returned by
QueryClient::persist_with. - Persist
Options - Tuning knobs for
QueryClient::persist_with. - Persist
Snapshot - A full snapshot of the persistable cache, ready to hand to a
Persister. - Persisted
Entry - A single persisted cache entry carrying the typed data as an opaque JSON value plus the metadata needed to re-prime and re-validate it.
- Prepared
Fetch - A prepared fetch returned by [
QueryClient::prepare_fetch_query] or [QueryClient::prepare_prefetch_query]. - Query
Bucket - Type-partitioned storage for query resources of a specific
(T, E)type pair. - Query
Client - Global registry for query and mutation resources.
- Query
Diagnostic - Diagnostic information about a single query resource.
- Serializer
Registry - Registry of
T -> serde_json::Valueserializers, keyed byTypeIdof the resource’s data typeT.
Enums§
- Persist
Error - Errors produced by the persistence layer.
- Persist
Filter - Owned counterpart to
QueryKeyFilterfor the persistence layer.
Constants§
- PERSIST_
VERSION - Current on-disk snapshot format version. Bumped when the serialized shape of
PersistSnapshotchanges in a backwards-incompatible way; loaders reject mismatched versions withPersistError::VersionMismatch.
Traits§
- Observable
Resource - Bridges a resource type to its status for the generic
Observer. - Persister
- Async persistence backend for
QueryClient::persist_with. - Query
Persister - Legacy synchronous persistence adapter trait for query cache persistence across app restarts.
Functions§
- current_
time_ ms - Returns the current time as milliseconds since the UNIX epoch.
- hydrate
- Load a snapshot from
persisterand re-prime the live cache with it.
Type Aliases§
- Infinite
Query Observer - Observer for an
InfiniteQueryResource(status typeQueryStatus). - Mutation
Observer - Observer for a
MutationResource(status typeMutationStatus). - Query
Observer - Observer for a
QueryResource(status typeQueryStatus).