Package-level declarations

Types

Link copied to clipboard

How a storage's presence operators see a stored null and an empty array.

Link copied to clipboard
class AggregationSupport @InternalWowApi constructor(val having: SupportMode = SupportMode.NATIVE, val topN: SupportMode = SupportMode.NATIVE, val denseFill: SupportMode = SupportMode.NATIVE, val percentile: SupportMode = SupportMode.NATIVE, val distinctCount: SupportMode = SupportMode.NATIVE, val firstLast: SupportMode = SupportMode.NATIVE, val windows: Map<WindowFunction, SupportMode> = RESIDUAL_WINDOWS, val rootGroups: SupportMode = SupportMode.NATIVE, val termsTopN: Set<MetricSpec> = emptySet())

How a storage aggregates. HAVING, top-N by a metric, dense date-histogram fill and the windows may be RESIDUAL; percentiles and distinct counts need the records themselves, so they are NATIVE or NONE. A storage declares it with of.

Link copied to clipboard

The declarations registered in code (querySchemaRegistration), each for the model its context names. 9.x's classpath and working-directory declaration files are gone: the Manifest (ManifestQuerySchemaSource) states what they supplemented.

Link copied to clipboard

The profile of an aggregate's read model: every record carries an identity, a payload and an event time: the snapshots (SnapshotQueryModelProfile) and the event streams (EventsQueryModelProfile).

Link copied to clipboard
sealed interface DeclarationValue<out T>

A fact a declaration states, or leaves to a source of lower priority.

Link copied to clipboard
class DefaultQueryModelSchemaProvider(context: QuerySchemaContext, sources: List<QuerySchemaSource>, adapter: QueryStorageAdapter, provisionalTtl: Duration = DEFAULT_PROVISIONAL_TTL, nanoTime: LongSupplier = LongSupplier(System::nanoTime), profile: QueryModelProfile? = QueryModelProfile.of(context.model), sensitivity: QuerySensitivityPolicy = QuerySensitivityPolicy.DEFAULT) : QueryModelSchemaProvider

The Catalog's compilation of one aggregate model: merges the declarations of sources into the logical model, asks the storage adapter for its facts about it, and compiles them into the published QueryModelSchema. The first load is shared by concurrent callers; a refresh reloads the sources and the storage's native structures and replaces the published schema only when it compiles to a different schema: when the version and the native facts are unchanged, the published instance is kept. A provisional schema is never published: it is answered for provisionalTtl, so a storage that is never written is not asked again on every query, and the first load after that compiles the storage again. Once the storage exists its schema is the one published, at most provisionalTtl after it does.

Link copied to clipboard

The event streams of one aggregate type: one record per stream, identified by (aggregateId, version), its events an array whose conditions are element predicates (ELEMENT_MATCH), so count counts commits and a page never splits one. Per-event analytics expand the array (AggregationQuery.elements).

Link copied to clipboard
class EventsQuerySchemas(manifest: Manifest, strategies: MaskStrategyResolver = MaskStrategyResolver.NONE) : QuerySchemaSource

The query schema of each aggregate's events model as the Manifest states it: the source of the events array's declaration and the EventsQueryModelProfile of each aggregate type.

Link copied to clipboard

A provider of one fixed schema, for a model whose schema is built in code (tests, tools, the query TCK).

Link copied to clipboard
class LogicalQuerySchema @InternalWowApi constructor(val root: QueryValueSchema, val sensitivity: QuerySensitivityPolicy = QuerySensitivityPolicy.DEFAULT)

The logical definition of a model: the merged value tree of every source, shared unchanged with every native binding snapshot, with the sensitivity policy its masked values are protected under. The core builds it; a storage adapter reads its values, each logical path template with its value, to report its facts.

Link copied to clipboard
class ManifestQuerySchemaSource(manifest: Manifest, strategies: MaskStrategyResolver = MaskStrategyResolver.NONE) : QuerySchemaSource

The query schema of each aggregate's snapshot model as the Manifest states it: the aggregate's state schema in $defs becomes the declaration of state, its x-wow-* keywords (written by manifest-tools from the :query-api annotations, #4332) the semantic types, aliases and sensitivity of its fields. Nothing is introspected at run time. The snapshot's system fields come from the model's profile (SnapshotQueryModelProfile), not from here.

Link copied to clipboard
class MaskRule

The sensitivity of one value: its level and how responses mask it, with the compiled strategy. Two rules are equal when their level and mask are; the compiled instance is not part of the identity.

Link copied to clipboard
fun interface MaskStrategyResolver

Supplies the instance of each custom mask strategy a Manifest names. The runtime does not load classes by name, so a host registers the strategies its domain declares; a strategy no resolver supplies fails the schema build instead of leaving the value unmasked.

Link copied to clipboard
class PagingSupport @InternalWowApi constructor(val keyset: SupportMode = SupportMode.NATIVE, val unboundedStream: SupportMode = SupportMode.NATIVE, val maxOffsetWindow: Int? = null)

How a storage pages. Neither mode has a residual implementation, so each is NATIVE or NONE. A storage declares it with of.

Link copied to clipboard

What storage lets a field do. A closed set: a backend grants a subset per field, and every query rule is written against these values. A storage adapter reports, for each logical path, the ones its native structures execute (QueryValueBindings).

Link copied to clipboard

Whether a value holds one value per record, or many (an array, or a value inside one).

Link copied to clipboard
class QueryDeprecation @InternalWowApi constructor(val message: String? = null)

A field kept only for existing callers: it can still be queried, but new queries and view definitions should avoid it. message says why, or what to use instead; omitted when the declaration gave none.

Link copied to clipboard
class QueryFieldBinding(val physicalField: QueryField<*>, storageTypes: Set<QueryStorageType>?, val physicalScope: QueryField<*>? = null, val indexed: Boolean? = null)

Where a logical field is stored for one capability. physicalScope is the physical container physicalField lies in whose elements storage indexes as separate documents, such as an Elasticsearch nested mapping, so a backend addresses the field through it; null when there is none.

Link copied to clipboard
class QueryFieldBindingTemplate @InternalWowApi constructor(val physicalPath: QueryPathTemplate, storageTypes: Set<QueryStorageType>?, val physicalScope: QueryField<*>? = null, val indexed: Boolean? = null)

Where a storage keeps a logical value for one capability, as its adapter reports it (of): the physicalPath in the stored record, whose * key slots the core fills from the logical path; the native storageTypes there, or null when the storage does not know them; the physicalScope, the container whose elements the storage indexes as separate documents (an Elasticsearch nested mapping), when there is one; and whether an index backs it (indexed), null when the storage does not say. indexed never gates a capability: the descriptor publishes it.

Link copied to clipboard

The effective capabilities of one field, compiled once from its value definition, the capabilities storage grants it, its sensitivity, its element scopes and the model's storage support. Admission checks each reference against this record, the descriptor publishes it, and it lists each capability with the cost class its spec states, which an entry gate that refuses expensive operations also reads. The value rules of the operator, group and metric specs are decided here, once, so admission and the descriptor cannot disagree about them.

Link copied to clipboard
class QueryFieldDeclaration @InternalWowApi constructor(val title: DeclarationValue<String?> = DeclarationValue.Unset, val description: DeclarationValue<String?> = DeclarationValue.Unset, val enumValues: DeclarationValue<List<JsonNode>?> = DeclarationValue.Unset, val enumDescriptions: DeclarationValue<Map<JsonNode, String>> = DeclarationValue.Unset, val valueTypes: DeclarationValue<Set<QueryValueType>> = DeclarationValue.Unset, val nullable: DeclarationValue<Boolean> = DeclarationValue.Unset, val required: DeclarationValue<Boolean> = DeclarationValue.Unset, val kind: DeclarationValue<QueryValueKind> = DeclarationValue.Unset, val properties: DeclarationValue<Map<String, QueryFieldDeclaration>> = DeclarationValue.Unset, val items: DeclarationValue<QueryFieldDeclaration?> = DeclarationValue.Unset, val additionalProperties: DeclarationValue<QueryFieldDeclaration?> = DeclarationValue.Unset, val alternatives: DeclarationValue<List<QueryFieldDeclaration>> = DeclarationValue.Unset, val semanticType: DeclarationValue<QuerySemanticType?> = DeclarationValue.Unset, val maskRule: DeclarationValue<MaskRule> = DeclarationValue.Unset, val variant: DeclarationValue<String?> = DeclarationValue.Unset, val aliases: DeclarationValue<Set<QueryField<*>>> = DeclarationValue.Unset, val deprecated: DeclarationValue<QueryDeprecation?> = DeclarationValue.Unset)

What one source declares about one logical value, in the capability descriptor's vocabulary; each fact may be left Unset for a source of lower priority to state. A source of higher priority cannot drop a sensitivity a lower one declares: replacing a protected structure keeps its masks, or fails.

Link copied to clipboard

One field or nested value: its shape (kind, types, nullability, structure) and semantics (enum, time, text).

Link copied to clipboard

One resolved field of a QueryModelSchema with its capability facts. Facts that depend only on the field and its schema are computed once per instance; static fields are resolved once per schema.

Link copied to clipboard
sealed interface QueryMask

How query results mask a sensitive value, as the Manifest's x-wow-mask states it (@Sensitive.mask): the built-in mask that keeps Keep.prefix leading and Keep.suffix trailing code points, or a custom Strategy named by its binary class name.

Link copied to clipboard
class QueryModel @InternalWowApi constructor(val value: String)

A read model a query runs against: SNAPSHOT, a DATASET (QueryDataset), or a custom model. The events model of an aggregate's log is not a record set a backend filters freely, so it is not one of these.

Link copied to clipboard

How the Catalog compiles one aggregate model: from its context and its storage's facts to a schema provider.

Link copied to clipboard

Record layout and invariants of one QueryModel: the built-in Snapshot, and each declared dataset (DatasetQueryModelProfile). The hierarchy is closed to this module: its constructor is internal.

Link copied to clipboard
class QueryModelSchema(val model: QueryModel, capabilities: Set<QueryCapability>, val definition: LogicalQuerySchema, bindings: Map<QueryPathTemplate, QueryValueBindings>, val fullProjectionAvailable: Boolean = true, approximateMetrics: Set<String> = emptySet(), val storage: StorageSupport = StorageSupport.NATIVE, val provisional: Boolean = false, val profile: QueryModelProfile? = QueryModelProfile.of(model))

Published facts only: model values and operation-specific native locations.

Link copied to clipboard

The current schema of one aggregate model, compiled once and recompiled on refresh.

Link copied to clipboard
sealed interface QueryPathSegment

One part of a QueryPathTemplate: a named Property, a dynamic Key whose name the core captures from the logical path (a map's key, numbered by its Key.slot), or an array's Item.

Link copied to clipboard

A logical or physical path of a model as segments (QueryPathSegment): state.lines[].sku is Property(state), Property(lines), Item, Property(sku). A storage adapter reports its bindings by the logical template (LogicalQuerySchema.values) and gives each binding's physical template (of).

Link copied to clipboard
class QuerySchemaCatalog(storages: QueryStorageLocator = QueryStorageLocator.NONE, compiler: QueryModelCompiler = QueryModelCompiler.of(), aggregates: Collection<AggregateType> = emptyList(), listener: QuerySchemaRefreshListener = QuerySchemaRefreshListener.NONE, datasets: QueryDatasets = QueryDatasets.NONE)

The Catalog: compiles the query schema of every aggregate model this instance serves, one provider per aggregate type and model, with its compiler (by default the model sources merged, see QueryModelCompiler.of). Each storage only reports its native facts, through the storage adapter storages locates. Gateways and point reads read their schema here.

Link copied to clipboard
data class QuerySchemaContext(val aggregateType: AggregateType, val model: QueryModel)

The read model of one aggregate type a schema is compiled for.

Link copied to clipboard

What one source declares about a model's fields, by logical field.

Link copied to clipboard

Declares a model's fields in code, in the vocabulary of the capability descriptor: the programmatic source of declarations (BeanQuerySchemaSource) beside the Manifest's (ManifestQuerySchemaSource), and how tests describe a model.

Link copied to clipboard

A failure of a query schema: of a query against it, or of the schema itself.

Link copied to clipboard

Sees each revalidation of one schema (QuerySchemaCatalog.revalidate): where a host records its metrics.

Link copied to clipboard
Link copied to clipboard

Where a model's field declarations come from: the Manifest's state schema ($defs plus x-wow-*, ManifestQuerySchemaSource), declarations registered in code (BeanQuerySchemaSource), or any other source a host adds. The Catalog merges the declarations of every source by priority, a higher one stating a fact over a lower one.

Link copied to clipboard

A model whose schema cannot be loaded, such as one without a query backend: QueryErrors.FAILED.

Link copied to clipboard
class QuerySchemaValidationException(message: String, cause: Throwable? = null, val violation: QueryViolation? = null) : QuerySchemaException

A query that does not fit its model or the model's storage: QueryErrors.INVALID with the violation it breaks. Without a violation it is a schema that does not validate, a server fault (QueryErrors.FAILED).

Link copied to clipboard

What a field's value means beyond its type; a field has at most one. A type this version does not know reads as Unknown, so a client on an older version can still read a newer server's descriptor. The wire names (the descriptor's type) are TEMPORAL_DATE, TEMPORAL_EPOCH, TEMPORAL_FORMATTED, DECIMAL, MONEY, DURATION and REFERENCE, as QueryJson writes them.

Link copied to clipboard
class QuerySensitivityPolicy @InternalWowApi constructor(val displayComparable: Boolean = true)

Whether a filter or sort may compare a protected value. displayComparable lets queries compare SensitivityLevel.DISPLAY values (the 9.x default); SensitivityLevel.CONFIDENTIAL values never compare.

Link copied to clipboard

A storage's port into the Catalog: it reports what its native structures (indexes, mappings, validators) prove about a logical model, and nothing else. The Catalog merges the model's sources and compiles the reported facts into the model's schema, applying every rule that does not depend on the storage.

Link copied to clipboard
class QueryStorageFacts @InternalWowApi constructor(val bindings: Map<QueryPathTemplate, QueryValueBindings>, val capabilities: Set<QueryCapability> = emptySet(), val fullProjectionAvailable: Boolean = true, val approximateMetrics: Set<String> = emptySet(), val storage: StorageSupport = StorageSupport.NATIVE, val provisional: Boolean = false)

What a storage proves about one read model, in the storage-neutral vocabulary of capabilities: for each logical path, the capabilities its native structures can execute and the physical location each binds to, with the projection and response locations; and the storage's model-wide support. Which native types, index kinds or mapping options prove a capability is the storage's knowledge; what a logical value must be for a capability to apply at all is the Catalog's. An adapter builds them with build (or builder from Java).

Link copied to clipboard

A storage-neutral family of native types a logical value may be stored as. A storage adapter maps each family to its own native types (BSON types, Elasticsearch field kinds); which families a logical value needs for a capability is the Catalog's decision (storageFamilies).

Link copied to clipboard
class QueryStorageFamilyRules @InternalWowApi constructor(val dateOperands: Boolean = true, val strictValueTypes: Boolean = true)

Where a storage still departs from the strict table of storageFamilies. Each rule is a known divergence between storages, kept so that every adapter reproduces today's capabilities exactly; the defaults are the strict table (STRICT), and of gives another.

Link copied to clipboard

Where the QuerySchemaCatalog finds the storage of an aggregate model: the QueryStorageAdapter of the query backend that serves it, or null when no backend does. The Catalog needs a storage's facts only, never its backend.

Link copied to clipboard
class QueryStorageType @InternalWowApi constructor(val value: String)

A storage's own name for a native type, such as a PostgreSQL jsonb cast or a MongoDB BSON type (of): a letter or _, then letters, digits, _ and -.

Link copied to clipboard
class QueryValueBindings @InternalWowApi constructor(bindings: Map<QueryCapability, QueryFieldBindingTemplate> = emptyMap(), val projectionPath: QueryPathTemplate? = null, val responsePath: QueryPathTemplate? = null)

What a storage serves at one logical path, as its adapter reports it (of): the bindings, the location each capability it can execute reads, and where a projection takes the value from (projectionPath) and a response returns it (responsePath), null where the storage cannot project or return it.

Link copied to clipboard
class QueryValueSchema @InternalWowApi constructor(val kind: QueryValueKind, val title: String? = null, val description: String? = null, enumValues: List<JsonNode>? = null, enumDescriptions: Map<JsonNode, String> = emptyMap(), valueTypes: Set<QueryValueType> = if (kind == QueryValueKind.OBJECT) setOf(QueryValueType.OBJECT) else emptySet(), properties: Map<String, QueryValueSchema> = emptyMap(), val items: QueryValueSchema? = null, val additionalProperties: QueryValueSchema? = null, alternatives: List<QueryValueSchema> = emptyList(), val nullable: Boolean = kind != QueryValueKind.UNION || alternatives.any { it.nullable }, val required: Boolean = false, val semanticType: QuerySemanticType? = null, val maskRule: MaskRule? = null, val variant: String? = null, aliases: Set<QueryField<*>> = emptySet(), val deprecated: QueryDeprecation? = null)

One immutable logical value shape, shared by backend schema snapshots: its kind, the scalar valueTypes, an object's properties and additionalProperties, an array's items, a union's alternatives, and what the sources declare about it (semanticType, maskRule, aliases, deprecated). The core builds it from the model's sources; a storage adapter reads it, through LogicalQuerySchema, to report what its storage serves. Collection inputs are snapshotted; mutable enum JSON is detached on read.

Link copied to clipboard
class QueryValueType @InternalWowApi constructor(val value: String)
Link copied to clipboard
sealed interface QueryViolation

The error catalog: every rule a query can break, as structured facts. Each violation names its stable code, renders its message from its facts, and belongs to a Kind that decides the error it becomes (rejection): the one place a rejection is rendered. Codes are a contract (added, never renamed); texts are not.

Link copied to clipboard
class StorageSupport @InternalWowApi constructor(val paging: PagingSupport = PagingSupport(), val aggregation: AggregationSupport = AggregationSupport(), val parallelArraySort: SupportMode = SupportMode.NATIVE, val absentValues: AbsentValues = AbsentValues.DISTINCT, val arrayEquality: SupportMode = SupportMode.NATIVE, val datasetAccess: SupportMode = SupportMode.NONE, val nullElementSort: SupportMode = SupportMode.NATIVE)

What a storage declares beyond each field's native capabilities, bound into the schema by its adapter (QueryStorageFacts.Builder.storage); a storage declares it with of, or takes NATIVE.

Link copied to clipboard

How a storage supports a query feature: natively, through the core after the storage, or not at all.

Link copied to clipboard

Functions

Link copied to clipboard

Flattens nested unions into their non-union alternatives; any other value is its own single alternative.

Link copied to clipboard
suspend fun QuerySchemaContext.declaredFields(sources: List<QuerySchemaSource>, sensitivity: QuerySensitivityPolicy = QuerySensitivityPolicy.DEFAULT): Set<QueryField<*>>

The fields a query on this model can name as written: the system fields and the declarations of sources, merged into the logical model as DefaultQueryModelSchemaProvider merges them, before any storage facts. Fields under a map, whose keys are the caller's, are left out.

Link copied to clipboard

Whether this value may be an array holding a null element: an array whose items the schema lets be null.

Link copied to clipboard

The values an operation on this value compares: the value itself, an array's items (one member layer, without flattening the definition) and a union's alternatives, each a non-union value. A storage adapter asks each one which storage families a capability needs (storageFamilies).

Link copied to clipboard
Link copied to clipboard
fun QueryValueSchema.storageFamilies(capability: QueryCapability, rules: QueryStorageFamilyRules = QueryStorageFamilyRules.STRICT): List<Set<QueryStorageFamily>>

The native type families this scalar value needs for capability: one set per declared alternative, and storage proves the capability when its native types cover every set and fall in some set. An empty list, or a list with an empty set, means no storage can prove the capability for this value.