Skip to content

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>

TEvent

objectEventIndexMatcher<TEvent>

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

true when at least one manifest predicate mapped onto an indexed field.

public bool HasIndex { get; }

bool

The manifest predicates this host can actually serve from an index (path is an index key).

public IReadOnlyList<IndexedPredicate> HonoredPredicates { get; }

IReadOnlyList<IndexedPredicate>

The DotBoxD.Plugins.Indexing.EventIndexKeyAttribute property names of TEvent.

public static IReadOnlyCollection<string> IndexKeyNames { get; }

IReadOnlyCollection<string>

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)

value TEvent

bool

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)

predicates IReadOnlyList<IndexedPredicate>

EventIndexMatcher<TEvent>