Class EventIndexMatcher<TEvent>
Namespace: DotBoxD.Plugins.Indexing
Assembly: DotBoxD.Plugins.dll
A host’s compiled view of a subscription’s DotBoxD.Plugins.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
DotBoxD.Plugins.IndexedPredicate.Path is an DotBoxD.Plugins.Indexing.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,
`DotBoxD.Plugins.Indexing.EventIndexMatcher.CouldMatch()` 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 `DotBoxD.Plugins.IndexedPredicate.ValueType` disagrees with the property's CLR type.
public sealed class EventIndexMatcher<TEvent>Type Parameters
Section titled “Type Parameters”TEvent
Inheritance
Section titled “Inheritance”object ← EventIndexMatcher<TEvent>
Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Properties
Section titled “Properties”HasIndex
Section titled “ HasIndex”true when at least one manifest predicate mapped onto an indexed field.
public bool HasIndex { get; }Property Value
Section titled “Property Value”HonoredPredicates
Section titled “ HonoredPredicates”The manifest predicates this host can actually serve from an index (path is an index key).
public IReadOnlyList<IndexedPredicate> HonoredPredicates { get; }Property Value
Section titled “Property Value”IReadOnlyList<IndexedPredicate>
IndexKeyNames
Section titled “ IndexKeyNames”The DotBoxD.Plugins.Indexing.EventIndexKeyAttribute property names of TEvent.
public static IReadOnlyCollection<string> IndexKeyNames { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”CouldMatch(TEvent)
Section titled “ 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
Section titled “Parameters”value TEvent
Returns
Section titled “Returns”Create(IReadOnlyList<IndexedPredicate>)
Section titled “ Create(IReadOnlyList<IndexedPredicate>)”Compiles predicates into cheap index checks, keeping only those whose path is an
DotBoxD.Plugins.Indexing.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
Section titled “Parameters”predicates IReadOnlyList<IndexedPredicate>
Returns
Section titled “Returns”EventIndexMatcher<TEvent>