QueryStatsOptions
@rotorsoft/act-root / act/src / QueryStatsOptions
Type Alias: QueryStatsOptions<E>
QueryStatsOptions<
E> =object
Defined in: libs/act/src/types/ports.ts:317
Options for Store.query_stats. All stat fields default to
false except head, which is always returned.
Cost model: With no opt-in flags (or tail alone), each requested
stat resolves via an index-backed lookup โ O(K) cost where K is the
number of matched streams. Setting count and/or names triggers a
full event scan over the matched streams (O(N) where N is total events);
both share the same scan and so requesting one is the same cost as
requesting both.
Type Parametersโ
Eโ
Event schemas; defaults to Schemas. When the caller
narrows E, exclude is type-checked against the schema's event names
โ typos like ["TOMBSTON_EVENT"] fail at compile time.
Propertiesโ
before?โ
readonlyoptionalbefore?:number
Defined in: libs/act/src/types/ports.ts:322
Time-travel cutoff: only consider events with
id < before. Omitted = current state. Useful for "what did this
stream look like at event N?" historical queries without changing
the call shape. Cheap on both code paths (cheap-heads path narrows
the index scan; full-scan path adds a WHERE id < ? predicate).
count?โ
readonlyoptionalcount?:boolean
Defined in: libs/act/src/types/ports.ts:319
Include the total non-excluded event count per stream. Triggers full scan.
exclude?โ
readonlyoptionalexclude?:ReadonlyArray<EventName<E>>
Defined in: libs/act/src/types/ports.ts:321
Event names to skip โ e.g.
[TOMBSTONE_EVENT, SNAP_EVENT] to ignore framework markers. Applies
to all returned stats (head, tail, count, names) consistently.
names?โ
readonlyoptionalnames?:boolean
Defined in: libs/act/src/types/ports.ts:320
Include a name โ count map per stream. Triggers
full scan (shares cost with count).
tail?โ
readonlyoptionaltail?:boolean
Defined in: libs/act/src/types/ports.ts:318
Include the earliest non-excluded event per stream.
Cheap when alone (indexed); free when count/names also set
(already scanning).