Path: redb-tsak/src/redb.Tsak.Core/Contracts/ITsakModule.cs
Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak
Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/src/redb.Tsak.Core/Contracts/ITsakModule.cs
----
using redb.Route.Abstractions;
namespace redb.Tsak.Core.Contracts;
///
/// Status of a route module in its lifecycle.
///
public enum TsakModuleStatus
{
/// Module discovered but not yet loaded.
Discovered,
/// Module loaded into memory.
Loaded,
/// Module initialized (routes configured).
Initialized,
/// Module running (context started).
Running,
/// Module stopped.
Stopped,
/// Module failed to load or initialize.
Faulted
}
///
/// Contract for a route module that can be discovered, loaded, and initialized in a context.
/// Equivalent of lt.tsak IRouteModule, adapted for redb.Route.
///
public interface ITsakModule
{
/// Unique module name (e.g. "DAL.GPS", "Api.Mobile").
string ModuleName { get; }
/// Module version string.
string Version { get; }
/// Human-readable description.
string Description { get; }
/// Names of modules this module depends on.
IReadOnlyList Dependencies { get; }
/// Whether the module can be initialized (all deps met, no errors).
bool CanInitialize { get; }
/// Current lifecycle status.
TsakModuleStatus Status { get; }
///
/// Directory where the module's DLL was loaded from.
/// Used to locate module config files (context.json, {Module}.config.json).
/// Null for static/in-process modules.
///
string? SourceDirectory { get; }
///
/// Initializes routes in the given context, synchronously. The coordinator reaches it through the
/// default .
///
/// Route context to configure.
/// The configured context.
IRouteContext Initialize(IRouteContext context);
///
/// Initializes routes in the given context. This is the entry the coordinator awaits, and the context
/// starts only after it completes. A module whose setup awaits (schema sync, reference data) overrides
/// it; the default runs , so existing modules work unchanged, without a rebuild.
///
/// Interface mapping is fixed by the class that declares . A module that inherits
/// the interface from a base class and adds InitializeAsync must list
/// again (or the base class must declare a virtual InitializeAsync to override); otherwise this
/// default runs and its is called instead.
///
///
/// Route context to configure.
/// The configured context.
Task InitializeAsync(IRouteContext context) => Task.FromResult(Initialize(context));
}