Skip to main content

Module client

Module client 

Source
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 optional now_ms parameter via gc_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)
  • QueryPersister trait and persist() / restore() for pluggable persistence (finding 9)
  • fetch_query() for imperative one-shot fetches (finding 10)
  • prefetch_query() for background cache warming (finding 11)

Structs§

CacheMutation
Marker gpui::Global bumped whenever cached query data changes.
ClientDiagnostic
Aggregate diagnostic for the entire QueryClient.
DehydratedEntry
A single entry in a dehydrated query cache snapshot.
DehydratedState
A portable snapshot of all cached query state.
InfiniteQueryBucket
Type-partitioned storage for infinite query resources of a specific (T, E) type pair.
MutationBucket
Type-partitioned storage for mutation resources.
MutationDiagnostic
Diagnostic information about a single mutation resource.
NoopPersister
A Persister that persists nothing and loads an empty snapshot.
Observer
Observes a resource and triggers re-renders only on status changes.
ObserverConfig
Configuration for a query observer.
PersistHandle
Drop-guard returned by QueryClient::persist_with.
PersistOptions
Tuning knobs for QueryClient::persist_with.
PersistSnapshot
A full snapshot of the persistable cache, ready to hand to a Persister.
PersistedEntry
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.
PreparedFetch
A prepared fetch returned by [QueryClient::prepare_fetch_query] or [QueryClient::prepare_prefetch_query].
QueryBucket
Type-partitioned storage for query resources of a specific (T, E) type pair.
QueryClient
Global registry for query and mutation resources.
QueryDiagnostic
Diagnostic information about a single query resource.
SerializerRegistry
Registry of T -> serde_json::Value serializers, keyed by TypeId of the resource’s data type T.

Enums§

PersistError
Errors produced by the persistence layer.
PersistFilter
Owned counterpart to QueryKeyFilter for the persistence layer.

Constants§

PERSIST_VERSION
Current on-disk snapshot format version. Bumped when the serialized shape of PersistSnapshot changes in a backwards-incompatible way; loaders reject mismatched versions with PersistError::VersionMismatch.

Traits§

ObservableResource
Bridges a resource type to its status for the generic Observer.
Persister
Async persistence backend for QueryClient::persist_with.
QueryPersister
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 persister and re-prime the live cache with it.

Type Aliases§

InfiniteQueryObserver
Observer for an InfiniteQueryResource (status type QueryStatus).
MutationObserver
Observer for a MutationResource (status type MutationStatus).
QueryObserver
Observer for a QueryResource (status type QueryStatus).