Class EventIndexMatcher<TEvent>
A host's compiled view of a subscription's IndexedPredicate metadata — the
"compile the metadata into whatever dispatch/index structure is natural for the runtime" half of
issue #47, promoted to the framework by issue #50. It keeps only the predicates whose
Path is an EventIndexKeyAttribute property of
TEvent (the fields the host indexes) and evaluates them cheaply against an event
through precompiled property getters — no per-event reflection, so the index never costs more
than it saves.
Because every kept predicate is a necessary AND condition of the real predicate,
CouldMatch(TEvent) returning false is always a safe reject; returning true means
the event passed the cheap index and the host should still run the verified IR unless the manifest
reported full coverage. Conversely, the matcher never rejects on a comparison it cannot soundly decide
(a value whose type cannot be reconciled to the property, a null reference, or an ordering it cannot
evaluate): such a leaf is dropped or passed through so the verified IR stays the authority. This keeps
the invariant "index-reject ⇒ verified-IR-reject" intact even for hand-built or imported manifests
whose ValueType disagrees with the property's CLR type.
public sealed class EventIndexMatcher<TEvent>
Type Parameters
TEvent
- Inheritance
-
EventIndexMatcher<TEvent>
- Inherited Members
Properties
HasIndex
true when at least one manifest predicate mapped onto an indexed field.
public bool HasIndex { get; }
Property Value
HonoredPredicates
The manifest predicates this host can actually serve from an index (path is an index key).
public IReadOnlyList<IndexedPredicate> HonoredPredicates { get; }
Property Value
IndexKeyNames
The EventIndexKeyAttribute property names of TEvent.
public static IReadOnlyCollection<string> IndexKeyNames { get; }
Property Value
Methods
CouldMatch(TEvent)
Evaluates the cheap index checks against value. Returns false as soon as
any indexed constraint is definitively violated, so the host can skip dispatch entirely; a constraint
it cannot decide is treated as satisfied so the verified IR remains the authority.
public bool CouldMatch(TEvent value)
Parameters
valueTEvent
Returns
Create(IReadOnlyList<IndexedPredicate>)
Compiles predicates into cheap index checks, keeping only those whose path is an
EventIndexKeyAttribute property of TEvent and whose value
can be reconciled to that property's CLR type. A predicate whose value type cannot be reconciled is
dropped (left to the verified IR) rather than turned into an unsound or throwing check.
public static EventIndexMatcher<TEvent> Create(IReadOnlyList<IndexedPredicate> predicates)
Parameters
predicatesIReadOnlyList<IndexedPredicate>
Returns
- EventIndexMatcher<TEvent>