Class RemoteLocalHandlerRegistry
Namespace: DotBoxD.Plugins.Runtime.Hooks
Assembly: DotBoxD.Plugins.dll
Client-side registry for remote RunLocal terminals. A remote
server.Hooks.On<TEvent>().Where(..).Select(..).RunLocal(λ) chain lowers only its
Where/Select stages to verified IR that filters and projects server-side; the projected
value is pushed back over the control-plane callback per passing event. This registry holds the native
RunLocal delegate (real host C#, never lowered), keyed by the subscription id returned at install
time, and decodes each pushed payload back to the projected CLR type before invoking that delegate.
public sealed class RemoteLocalHandlerRegistryInheritance
Section titled “Inheritance”object ← RemoteLocalHandlerRegistry
Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
Section titled “Remarks”The decode mirrors the server-extension request/response path in reverse: the same
DotBoxD.Plugins.KernelRpcBinaryCodec/DotBoxD.Plugins.KernelRpcValueConverter/DotBoxD.Plugins.Runtime.Rpc.KernelRpcMarshaller
converters carry the value, so the supported projection types are exactly the wire-eligible set
(bool, int, long, double, string, enums, lists/arrays, and DTO records).
Methods
Section titled “Methods”Clear()
Section titled “ Clear()”Removes all registered handlers. Called when the plugin connection tears down (session disposed / peer disconnected) so a dropped plugin’s callbacks do not linger.
public void Clear()DispatchAsync(string, ReadOnlyMemory<byte>, HookContext, CancellationToken)
Section titled “ DispatchAsync(string, ReadOnlyMemory<byte>, HookContext, CancellationToken)”Decodes a server-pushed projected payload back to the projected CLR type and invokes the registered
native delegate. context is the client-side DotBoxD.Abstractions.HookContext the delegate
runs against. Throws if no handler is registered for subscriptionId.
public ValueTask DispatchAsync(string subscriptionId, ReadOnlyMemory<byte> projectedValue, HookContext context, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”subscriptionId string
projectedValue ReadOnlyMemory<byte>
context HookContext
cancellationToken CancellationToken
Returns
Section titled “Returns”DispatchResultAsync(string, ReadOnlyMemory<byte>, HookContext, CancellationToken)
Section titled “ DispatchResultAsync(string, ReadOnlyMemory<byte>, HookContext, CancellationToken)”public ValueTask<byte[]> DispatchResultAsync(string subscriptionId, ReadOnlyMemory<byte> contextValue, HookContext context, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”subscriptionId string
contextValue ReadOnlyMemory<byte>
context HookContext
cancellationToken CancellationToken
Returns
Section titled “Returns”Register<TProjected>(string, Func<TProjected, HookContext, ValueTask>)
Section titled “ Register<TProjected>(string, Func<TProjected, HookContext, ValueTask>)”Registers the native terminal delegate for a lowered local chain. TProjected is
the type produced by the chain’s final Select (or the event type when there is no projection — a
whole-event chain). Idempotent: re-registering the same subscriptionId replaces the
previous handler, so a plugin that reconnects and re-installs with a reused id does not throw. Returns a
token that unregisters this handler when disposed.
public IDisposable Register<TProjected>(string subscriptionId, Func<TProjected, HookContext, ValueTask> handler)Parameters
Section titled “Parameters”subscriptionId string
handler Func<TProjected, HookContext, ValueTask>
Returns
Section titled “Returns”Type Parameters
Section titled “Type Parameters”TProjected
Register<TProjected>(string, Func<TProjected, HookContext, ValueTask>, Func<KernelRpcValue, TProjected>)
Section titled “ Register<TProjected>(string, Func<TProjected, HookContext, ValueTask>, Func<KernelRpcValue, TProjected>)”Registers the native terminal delegate alongside a generated reflection-free decoder
that reads TProjected straight off the pushed DotBoxD.Plugins.KernelRpcValue’s typed
fields — no SandboxValue intermediate, no boxing, no reflection. Emitted by the plugin generator
for wire-eligible projected types; DotBoxD.Plugins.Runtime.Hooks.RemoteLocalHandlerRegistry.Register(System.String,System.Func{,DotBoxD.Abstractions.HookContext,System.Threading.Tasks.ValueTask})
remains the fallback for the rest. Idempotent in the same way as the 2-arg overload.
public IDisposable Register<TProjected>(string subscriptionId, Func<TProjected, HookContext, ValueTask> handler, Func<KernelRpcValue, TProjected> decoder)Parameters
Section titled “Parameters”subscriptionId string
handler Func<TProjected, HookContext, ValueTask>
decoder Func<KernelRpcValue, TProjected>
Returns
Section titled “Returns”Type Parameters
Section titled “Type Parameters”TProjected
Register<TProjected>(string, Func<TProjected, HookContext, ValueTask>, Func<ReadOnlyMemory<byte>, TProjected>)
Section titled “ Register<TProjected>(string, Func<TProjected, HookContext, ValueTask>, Func<ReadOnlyMemory<byte>, TProjected>)”Registers a generated decoder that reads directly from the pushed binary payload. This is the fastest
generated path because dispatch does not materialize an intermediate DotBoxD.Plugins.KernelRpcValue tree.
public IDisposable Register<TProjected>(string subscriptionId, Func<TProjected, HookContext, ValueTask> handler, Func<ReadOnlyMemory<byte>, TProjected> decoder)Parameters
Section titled “Parameters”subscriptionId string
handler Func<TProjected, HookContext, ValueTask>
decoder Func<ReadOnlyMemory<byte>, TProjected>
Returns
Section titled “Returns”Type Parameters
Section titled “Type Parameters”TProjected
RegisterResult<TContext, TResult>(string, Func<TContext, HookContext, TResult>)
Section titled “ RegisterResult<TContext, TResult>(string, Func<TContext, HookContext, TResult>)”public IDisposable RegisterResult<TContext, TResult>(string subscriptionId, Func<TContext, HookContext, TResult> handler) where TResult : struct, IHookResultParameters
Section titled “Parameters”subscriptionId string
handler Func<TContext, HookContext, TResult>
Returns
Section titled “Returns”Type Parameters
Section titled “Type Parameters”TContext
TResult
RegisterResult<TContext, TResult>(string, Func<TContext, HookContext, CancellationToken, ValueTask<TResult>>)
Section titled “ RegisterResult<TContext, TResult>(string, Func<TContext, HookContext, CancellationToken, ValueTask<TResult>>)”public IDisposable RegisterResult<TContext, TResult>(string subscriptionId, Func<TContext, HookContext, CancellationToken, ValueTask<TResult>> handler) where TResult : struct, IHookResultParameters
Section titled “Parameters”subscriptionId string
handler Func<TContext, HookContext, CancellationToken, ValueTask<TResult>>
Returns
Section titled “Returns”Type Parameters
Section titled “Type Parameters”TContext
TResult
Unregister(string)
Section titled “ Unregister(string)”Removes the handler for subscriptionId. Returns true if one was present.
public bool Unregister(string subscriptionId)Parameters
Section titled “Parameters”subscriptionId string