InMemoryQueryBackend

The query backend of one record set: an aggregate type's snapshots in an InMemoryQueryStorage, or a dataset's rows in an InMemoryDatasetStorage. It evaluates every filter operator but full-text search, sort, offset and keyset pages, bounded counts, projection and aggregation; HAVING, top-N by a metric, dense fill and windows are left to the core (InMemoryQueryStorageAdapter). timeouts records the timeout of every query it received, so a test can see that the timeout reached the backend.

Properties

Link copied to clipboard
open override val aggregateType: AggregateType

The aggregate type whose records this backend reads.

Link copied to clipboard

Encodes and decodes the native CursorPositions page returns for a PageWindow.Keyset.

Link copied to clipboard

The timeout of every query this backend received, in order; null for a query without one.

Functions

Link copied to clipboard
open override fun aggregate(query: AdmittedQuery<AggregationQuery>, window: GroupWindow): Flow<ObjectNode>

Streams the groups of query in its effective sort order, at most GroupWindow.First.limit of them, or every group for GroupWindow.All. The core has already removed from query what it computes itself.

Link copied to clipboard
open suspend override fun count(query: AdmittedQuery<CountQuery>): Long

The number of records matching query's filter. When query.query.limit is set the backend may stop counting after limit + 1 matches (count(*) over a LIMIT limit + 1 subquery, MongoDB's countDocuments limit): the core turns any count above the limit into a bounded CountResult. A null limit asks for the exact count.

Link copied to clipboard
open suspend override fun page(query: AdmittedQuery<Queryable<*>>, window: PageWindow): BackendPage

Returns one window of query's records: for PageWindow.Offset the rows and, when asked, the total; for PageWindow.Keyset the rows after the position and each row's native position, taken before any field added for the position is stripped from the row.

Link copied to clipboard
open override fun stream(query: AdmittedQuery<ListQuery>): Flow<ObjectNode>

Streams the records of query, at most query.limit of them, or all when the limit is 0.