Interface AggregateCatalogService
public interface AggregateCatalogService
Gateway-level catalog that answers which aggregates apply to a source by routing to the right
QueryEngine, and holds the gateway's own folds. An engine's QueryEngine.nativeAggregates() is its registration; the gateway registers a fold per StandardAggregates entry, and the entry is the single source of the aggregate's metadata.-
Method Summary
Modifier and TypeMethodDescriptionvoidassertCompleteness(StandardAggregates... required) Checks that every requiredStandardAggregatesentry has a registered function, so a gap fails at boot rather than on the first query.static voidassertDeclarations(String engineId, Collection<? extends AggregationType> declared) Checks an engine's registration: one form per id, and a form under aStandardAggregatesid binds that entry (AggregationType.entry()), so no engine restates a standard aggregate's semantics.descriptorsForProvider(String providerId) Returns the aggregates the provider's engine currently exposes.Returns the aggregates that apply to the path's data type: the engine's catalog filtered byAggregationType.acceptedInputTypes().functionFor(AggregateId id, DataType inputType) Returns the gateway fold registered underidfor aninputTypetag: the fold registered for the type's class, else the entry's fold.lookup(String providerId, AggregateId id) Looks up an aggregate by id within a provider, for wire deserialization.default Optional<AggregationType> lookupForSource(QualifiedPath source, AggregateId id) Looks up an aggregate by id for the provider that ownssource; empty if the source does not resolve.default List<AggregateDescriptor> Returns the subset ofdescriptorsForSource(QualifiedPath)the source's engine computes itself.platformFallbackDescriptors(DataType inputType) Returns the gateway-computed aggregates for a data type: every registered entry whoseAggregationType.acceptedInputTypes()containsinputType.booleanproviderExists(String providerId) WhetherproviderIdresolves to a registered query engine.default voidregisterFunction(AggregationType entry, AggregateFunction<?> fold) Registersentrywith onefoldfor every input type.voidregisterFunction(AggregationType entry, AggregateFunction<?> fold, Map<DataTypeClass, AggregateFunction<?>> foldsByClass) Registersentryas gateway-computed:foldfolds it, except on a tag whosetype classhas its own fold infoldsByClass.default voidregisterFunction(AggregateFunction<?> fold) Registers the standard aggregate thatfoldfolds, by its id.
-
Method Details
-
descriptorsForProvider
Returns the aggregates the provider's engine currently exposes. -
descriptorsForSource
Returns the aggregates that apply to the path's data type: the engine's catalog filtered byAggregationType.acceptedInputTypes(). Empty if the path does not resolve to a configured provider. -
nativeDescriptorsForSource
Returns the subset ofdescriptorsForSource(QualifiedPath)the source's engine computes itself. -
platformFallbackDescriptors
Returns the gateway-computed aggregates for a data type: every registered entry whoseAggregationType.acceptedInputTypes()containsinputType. -
lookup
Looks up an aggregate by id within a provider, for wire deserialization. -
lookupForSource
Looks up an aggregate by id for the provider that ownssource; empty if the source does not resolve. -
providerExists
WhetherproviderIdresolves to a registered query engine.lookup(String, AggregateId)returns empty both for an unknown provider and for an aggregate missing from its catalog; use this to tell them apart. -
functionFor
Returns the gateway fold registered underidfor aninputTypetag: the fold registered for the type's class, else the entry's fold. The type does not gate admission.- Returns:
- the fold, or empty if nothing is registered under the id
-
registerFunction
void registerFunction(AggregationType entry, AggregateFunction<?> fold, Map<DataTypeClass, AggregateFunction<?>> foldsByClass) Registersentryas gateway-computed:foldfolds it, except on a tag whosetype classhas its own fold infoldsByClass. A later registration under the same id replaces the earlier one. The entry need not be standard: a module may register its own aggregate, which the gateway folds on every provider. -
registerFunction
Registersentrywith onefoldfor every input type. -
registerFunction
Registers the standard aggregate thatfoldfolds, by its id.- Throws:
IllegalArgumentException- if the id is not standard
-
assertCompleteness
Checks that every requiredStandardAggregatesentry has a registered function, so a gap fails at boot rather than on the first query.- Throws:
IllegalStateException- if any required id is missing
-
assertDeclarations
Checks an engine's registration: one form per id, and a form under aStandardAggregatesid binds that entry (AggregationType.entry()), so no engine restates a standard aggregate's semantics. Any other id is the engine's own.- Throws:
IllegalStateException- naming the engine and the id when a check fails
-