Path: redb-tsak/src/redb.Tsak.Core/Contracts/ITsakModuleRegistry.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/ITsakModuleRegistry.cs
----
namespace redb.Tsak.Core.Contracts;
///
/// Registry managing discovery, registration, and lifecycle of route modules.
/// Thread-safe. Fires events for coordinator subscription.
/// Equivalent of lt.tsak IRouteModuleRegistry.
///
public interface ITsakModuleRegistry
{
///
/// Registers modules from static (compile-time) providers.
/// Fires once with all registered modules.
///
/// Static module providers.
/// Number of modules registered.
Task RegisterStaticProvidersAsync(IEnumerable providers);
///
/// Discovers modules in assemblies at the specified paths.
/// Scans for ITsakModule implementations and InitRoute.main() conventions.
///
/// Directory paths to scan for DLL files.
/// Number of modules discovered.
Task DiscoverModulesAsync(IEnumerable assemblyPaths);
/// Registers a single module manually (awaits the store — no sync-over-async).
Task RegisterModuleAsync(ITsakModule module);
/// Unregisters a module by name (awaits the store).
/// True if module was found and removed.
Task UnregisterModuleAsync(string moduleName);
/// Unregisters a module without firing events (used during package reload to preserve state).
/// Touches no store, so it stays synchronous.
bool UnregisterModuleSilent(string moduleName);
/// Replaces a module in the registry without firing events (used by hot-swap; awaits the store).
Task ReplaceModuleSilentAsync(ITsakModule module);
/// Returns all registered modules.
IReadOnlyList GetAllModules();
/// Gets a module by name.
ITsakModule? GetModule(string moduleName);
/// Returns modules with the specified status.
IReadOnlyList GetModulesByStatus(TsakModuleStatus status);
/// Fired when a single module is added.
event EventHandler ModuleAdded;
/// Fired when a single module is removed.
event EventHandler ModuleRemoved;
/// Fired when a module is updated (new version detected).
event EventHandler ModuleUpdated;
/// Fired after a batch of modules is added (e.g. from static providers).
event EventHandler> ModulesBatchAdded;
}