Class TsakContextManager

Assembly: redb.Tsak.Core.dll

Manages lifecycle of route contexts. Supports named (config-driven) and anonymous (dynamic) contexts.
Based on lt.tsak RouteContextManager, adapted for redb.Route.

public class TsakContextManager : ITsakContextManager

Inheritance

Object→TsakContextManager

Implements

Methods

CleanupAnonymousStatesAsync()

Remove orphaned autoStart keys for anonymous contexts from StateStore.

public Task CleanupAnonymousStatesAsync()

CreateContext(string, IServiceProvider, IDictionary<string, object?>)

Creates a named context with the given configuration.

public IRouteContext CreateContext(string contextName, IServiceProvider serviceProvider, IDictionary<string, object?> configuration)

GetAllContexts()

Returns all contexts as (name, context) pairs.

public IReadOnlyList<(string Name, IRouteContext Context)> GetAllContexts()

GetContext(string)

Gets a context by name.

public IRouteContext? GetContext(string contextName)

GetNamedRedbInstances()

Named redb instances as the manager actually registered them, context by context. The context registry

public IReadOnlyList<RedbInstanceInfo> GetNamedRedbInstances()

RemoveContextAsync(string, bool)

Removes a context (stop + dispose + unregister).

public Task RemoveContextAsync(string contextName, bool preserveState = false)

RestartContextAsync(string, CancellationToken)

Restarts a context (drain-aware stop + start). Returns drain diagnostics.

public Task<ContextActionResponse> RestartContextAsync(string contextName, CancellationToken ct = default)

ShouldAutoStart(string)

Returns whether the context should auto-start based on config.

public bool ShouldAutoStart(string contextName)

ShouldAutoStartAsync(string)

Async version of — avoids sync-over-async for Redb-backed store.

public Task<bool> ShouldAutoStartAsync(string contextName)

StartContextAsync(string, bool)

Starts a context. When ignoreAutoStart is true, skips the autoStart check (for manual API/CLI calls).

public Task StartContextAsync(string contextName, bool ignoreAutoStart = false)

StopContextAsync(string, bool, CancellationToken)

Stops a context with graceful drain. Returns drain diagnostics.

public Task<ContextActionResponse> StopContextAsync(string contextName, bool setAutoStartFalse = true, CancellationToken ct = default)

Constructors