Class PluginHost
Owns the per-route .NET plugins of one configuration: one collectible AssemblyLoadContext per plugin, one instance of its class, and the isolation wrapper (exception, timeout, metrics) that routes call. A reload builds a new host, swaps it in, and retires the old one, which disposes every plugin and unloads every context.
Implements
Inherited Members
Namespace: Titanium.Web.Proxy.Plugins
Assembly: Titanium.Web.Proxy.dll
Syntax
public sealed class PluginHost : IDisposable
Properties
| Edit this page View SourceIsDisposed
True once every plugin was disposed and every context unloaded.
Declaration
public bool IsDisposed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LoadContexts
Weak handles to the load contexts, so a test or an operator can confirm the runtime reclaimed them.
Declaration
public IReadOnlyList<WeakReference> LoadContexts { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<WeakReference> |
Plugins
The plugins by configured name, for ReverseProxyOptions.RoutePlugins.
Declaration
public IReadOnlyDictionary<string, IProxyMiddleware> Plugins { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, IProxyMiddleware> |
Methods
| Edit this page View SourceCanFilterStreams(string)
True when the loaded script plugin name can run as an L4 stream filter.
Declaration
public bool CanFilterStreams(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| bool |
Dispose()
Disposes every plugin that is disposable and unloads every load context. Safe to call twice.
Declaration
public void Dispose()
GetScriptHost(string)
The script plugin name as a listener-wide script host, for ReverseProxyOptions.ScriptPipeline
(alone, or with others in a chain). Every call is counted against this host, so a reload retires it only after the
calls in flight finish. Returns null when no loaded plugin of that name runs HTTP phases.
Declaration
public IScriptPhaseHost? GetScriptHost(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| IScriptPhaseHost |
Load(IEnumerable<PluginConfig>?, ILogger?)
Loads every plugin. Nothing is kept when one fails: the contexts loaded so far are unloaded and the exception names the plugin and the reason.
Declaration
public static PluginHost Load(IEnumerable<PluginConfig>? configs, ILogger? logger = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<PluginConfig> | configs | |
| ILogger | logger |
Returns
| Type | Description |
|---|---|
| PluginHost |
Retire()
Stops new work from being counted against this host and disposes it once the calls in flight finish.
Declaration
public void Retire()