Class EventIndexRegistry
Namespace: DotBoxD.Plugins.Indexing
Assembly: DotBoxD.Plugins.dll
A first-class, reusable host dispatch index (issue #50). A host registers a subscription kernel together
with its generated DotBoxD.Plugins.IndexedPredicates; the registry recomputes them from verified IR and
compiles them into an
DotBoxD.Plugins.Indexing.EventIndexMatcher (precompiled getters, no per-event reflection) and, when the host
publishes an event, runs the cheap index check before entering the sandbox. Events the index
rejects never reach the verified IR; survivors are dispatched to DotBoxD.Plugins.Kernel.InstalledKernel as the
correctness authority — the verified ShouldHandle still runs after a matching index check because
package-supplied coverage metadata is not trusted across the manifest boundary.
This is the "register a subscription and get index-based prefiltering without writing your own matcher"
surface. Subscriptions whose predicates touch no indexed field are rejected by `DotBoxD.Plugins.Indexing.EventIndexRegistry.Register(DotBoxD.Abstractions.IPluginEventAdapter{},DotBoxD.Plugins.Kernel.InstalledKernel,System.Collections.Generic.IReadOnlyList{DotBoxD.Plugins.IndexedPredicate},System.Boolean)`
(returns false) so the host can leave them on its broad pipeline.
public sealed class EventIndexRegistryInheritance
Section titled “Inheritance”Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Section titled “Constructors”EventIndexRegistry(Action<SubscriptionDeliveryFault>?)
Section titled “ EventIndexRegistry(Action<SubscriptionDeliveryFault>?)”public EventIndexRegistry(Action<SubscriptionDeliveryFault>? onFault = null)Parameters
Section titled “Parameters”onFault Action<SubscriptionDeliveryFault>?
Properties
Section titled “Properties”Aggregate prefilter diagnostics across every published event and registered subscription.
public EventIndexStats Stats { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”DrainAsync()
Section titled “ DrainAsync()”Awaits every in-flight dispatch launched by DotBoxD.Plugins.Indexing.EventIndexRegistry.Publish(,System.Threading.CancellationToken) (e.g. on host shutdown).
public Task DrainAsync()Returns
Section titled “Returns”Publish<TEvent>(TEvent, CancellationToken)
Section titled “ Publish<TEvent>(TEvent, CancellationToken)”Runs every registered TEvent subscription’s cheap index check against
value; survivors are dispatched to the verified IR fire-and-forget (the host’s
broad pipeline keeps non-indexed subscriptions). Prefilter counters update synchronously.
public void Publish<TEvent>(TEvent value, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”value TEvent
cancellationToken CancellationToken
Type Parameters
Section titled “Type Parameters”TEvent
Register<TEvent>(IPluginEventAdapter<TEvent>, InstalledKernel, IReadOnlyList<IndexedPredicate>, bool)
Section titled “ Register<TEvent>(IPluginEventAdapter<TEvent>, InstalledKernel, IReadOnlyList<IndexedPredicate>, bool)”Registers kernel as an indexed subscription for TEvent.
The matching predicates are recomputed from the kernel’s verified ShouldHandle IR; the
predicates and indexCoversPredicate arguments are the package’s
untrusted manifest claims and are intentionally not read here. Returns false (registering
nothing) when none of the recomputed predicates map onto an DotBoxD.Plugins.Indexing.EventIndexKeyAttribute field
— the caller should keep such a subscription on its broad pipeline. Returns true when the
subscription is now served from the index.
public bool Register<TEvent>(IPluginEventAdapter<TEvent> adapter, InstalledKernel kernel, IReadOnlyList<IndexedPredicate> predicates, bool indexCoversPredicate)Parameters
Section titled “Parameters”adapter IPluginEventAdapter<TEvent>
kernel InstalledKernel
predicates IReadOnlyList<IndexedPredicate>
indexCoversPredicate bool
Returns
Section titled “Returns”Type Parameters
Section titled “Type Parameters”TEvent
Unregister(InstalledKernel)
Section titled “ Unregister(InstalledKernel)”Removes every registration owned by kernel (e.g. when a host uninstalls it).
public void Unregister(InstalledKernel kernel)Parameters
Section titled “Parameters”kernel InstalledKernel