Interface IModule
Contract every Shard module implements. The host runs dependency-aware Setup(IModuleContext),
PreloadAsync(CancellationToken), and Start() phases in that order. After eligible starts
finish and failed or blocked modules are cleaned up, the host publishes one
ServerReadyEvent.
During teardown, QuiesceAsync() first stops active work and exposes its completion.
Shutdown() then releases remaining synchronous resources in reverse order.
Modules that also implement IDisposable are disposed after shutdown. If setup
never succeeds, the host skips quiescence and shutdown and uses disposal as the lifetime cleanup.
public interface IModule
Properties
Manifest
Identity and dependency declaration used to compute load order.
ModuleManifest Manifest { get; }
Property Value
Methods
PreloadAsync(CancellationToken)
Async preload work that must finish before this module can start (e.g. server OAuth). Required dependencies must preload successfully; optional dependencies affect ordering only.
Task PreloadAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
QuiesceAsync()
Stops accepting new work before returning a completion for work already owned by the module. The host invokes this on every module before awaiting any returned operation. A Task is used because the host retains and composes every module completion. Implementations must not wait for the host's own shutdown completion.
Task QuiesceAsync()
Returns
Setup(IModuleContext)
Setup: subscribe to events and register systems. Hard deps are set up first.
void Setup(IModuleContext context)
Parameters
contextIModuleContext
Shutdown()
Releases synchronous resources in reverse load order after quiescence. This hook is skipped when setup fails or is dependency-blocked; Dispose() still runs.
void Shutdown()
Start()
Starts active work after preload and all required dependencies start. Server readiness is published only after all eligible starts and failed or blocked module cleanup finish.
void Start()