davianspace_hosting 1.0.3
davianspace_hosting: ^1.0.3 copied to clipboard
Enterprise-grade hosting framework for Dart. Unifies configuration, logging, dependency injection, and lifecycle management into a coherent application model.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.3 #
Added #
- Core abstractions:
Host,HostBuilder,HostContext,HostedServiceabstract interfaces defining the hosting contract. - Default host builder (
createDefaultBuilder): Pre-configured builder withappsettings.json, environment-specific config, environment variables, CLI argument parsing, and console logging. - Host implementation (
HostImpl): Full lifecycle management withAsyncLock-protected start/stop, SIGINT/SIGTERM signal handling, and orderly teardown. - Application lifetime (
ApplicationLifetime): One-shot event hooks for started, stopping, and stopped transitions with programmatic shutdown viarequestShutdown(). - Lifetime events (
LifetimeEvents): Single-invocation callback list with error collection and late-add-fires-immediately semantics. - Hosted service executor (
HostedServiceExecutor): Sequential and concurrent start/stop orchestration with startup rollback and stop-error collection. - Hosted service collection (
HostedServiceCollection): Dedicated registry for hosted-service factories, solving the DI singleton cache limitation. IncludesaddHostedService()andaddHostedServiceInstance()extension methods onServiceCollectionusingonContainerBuilthooks. - Environment detection:
HostContextwithisDevelopment,isStaging,isProductionconvenience getters. Resolution fromDART_ENVIRONMENTenv var →Hosting:Environmentconfig key → Production default. - Async lock (
AsyncLock): Lightweight async mutex preventing concurrent lifecycle transitions. - Framework service registration: Automatic registration of
Configuration,LoggerFactory,Logger,ApplicationLifetime,HostedServiceCollection, andHostedServiceExecutorin the DI container. - Exception types:
HostedServiceException,HostedServiceStopException,LifetimeEventExceptionfor structured error reporting. - Full integration with
davianspace_configuration,davianspace_dependencyinjection,davianspace_logging, anddavianspace_options. - Comprehensive test suite (44 tests).
- Enterprise-grade documentation: README with API reference, architecture doc, CONTRIBUTING.md, SECURITY.md.