QuerySchemaCatalog

class QuerySchemaCatalog(snapshots: SnapshotQueryBackendFactory? = null, eventStreams: EventStreamQueryBackendFactory? = null, compiler: QueryModelCompiler = QueryModelCompiler.of(), aggregates: Collection<NamedAggregate> = emptyList(), meterRegistry: MeterRegistry? = null)

The Catalog (design §4, §5.2): compiles the query schema of every aggregate model this instance serves, one provider per aggregate and model, with its compiler (by default the model sources merged under the sensitivity policy, see QueryModelCompiler.of). Each storage only reports its native facts, through the storage adapter its backend factory supplies. Gateways, point reads and the capability descriptor all read their schema here.

Storage facts (indexes, mappings, validators) change outside deployments, so the catalog is revalidated periodically: each schema of aggregates is reloaded and published only if it compiles, otherwise the previous one stays and the failure is reported. A model without a backend, or whose backend reports an UnavailableQueryStorageAdapter, has nothing to load or revalidate: its provider fails every load and revalidation skips it.

Constructors

Link copied to clipboard
constructor(snapshots: SnapshotQueryBackendFactory? = null, eventStreams: EventStreamQueryBackendFactory? = null, compiler: QueryModelCompiler = QueryModelCompiler.of(), aggregates: Collection<NamedAggregate> = emptyList(), meterRegistry: MeterRegistry? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Status(val aggregate: String, val model: QueryModel, val version: String? = null, val error: String? = null)

The state of one schema: its content-hash version, or the error that kept it from loading.

Functions

Link copied to clipboard

The schema provider of namedAggregate's model, compiled once and shared by every reader.

Link copied to clipboard
fun revalidate(aggregate: String? = null): Flux<QuerySchemaCatalog.Status>

Reloads every schema (or aggregate's) now; a schema that fails to compile keeps its previous version.

Link copied to clipboard
fun schema(namedAggregate: NamedAggregate, model: QueryModel): Mono<QueryModelSchema>

The current schema of namedAggregate's model.

Link copied to clipboard
fun versions(aggregate: String? = null): Flux<QuerySchemaCatalog.Status>

The current version of every schema, loading those not loaded yet.