Interface ITsakContextManager

Assembly: redb.Tsak.Core.dll

Manages lifecycle of route contexts: create, start, stop, remove.
Supports named (config-driven) and anonymous (auto-created) contexts.
Equivalent of lt.tsak IRouteContextManager.

public interface ITsakContextManager

Methods

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

Creates a named context with the given configuration.

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

GetAllContexts()

Returns all contexts as (name, context) pairs.

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

GetContext(string)

Gets a context by name.

IRouteContext? GetContext(string contextName)

GetNamedRedbInstances()

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

IReadOnlyList<RedbInstanceInfo> GetNamedRedbInstances()

RemoveContextAsync(string, bool)

Removes a context (stop + dispose + unregister).

Task RemoveContextAsync(string contextName, bool preserveState = false)

RestartContextAsync(string, CancellationToken)

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

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

ShouldAutoStart(string)

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

bool ShouldAutoStart(string contextName)

ShouldAutoStartAsync(string)

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

Task<bool> ShouldAutoStartAsync(string contextName)

StartContextAsync(string, bool)

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

Task StartContextAsync(string contextName, bool ignoreAutoStart = false)

StopContextAsync(string, bool, CancellationToken)

Stops a context with graceful drain. Returns drain diagnostics.

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