Expand description
Module system for extending DMSC with custom functionality Copyright © 2025-2026 Wenze Wei. All Rights Reserved.
This file is part of DMSC. The DMSC project belongs to the Dunimd Team.
Licensed under the Apache License, Version 2.0 (the “License”); You may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
§Core Module System
This module provides the foundation for modular service architecture in DMSC. It defines traits and structures for both synchronous and asynchronous service modules.
§Key Components
- ServiceModule: Trait for synchronous service modules
- AsyncServiceModule: Trait for asynchronous service modules
- DMSCModule: Public async trait for DMSC modules
- DMSCPythonModuleAdapter: Python module adapter
§Design Principles
- Lifecycle Management: Modules follow a well-defined lifecycle with multiple phases
- Sync/Async Support: Clear separation between synchronous and asynchronous modules
- Default Implementations: Most methods have sensible defaults to minimize boilerplate
- Dependency Resolution: Modules can declare dependencies on other modules
- Priority System: Modules can specify execution priority
- Criticality Flag: Modules can be marked as critical or non-critical
§Module Lifecycle
Modules go through the following lifecycle phases:
- Initialization:
init- Set up module resources - Before Start:
before_start- Prepare for module startup - Start:
start- Start module execution - After Start:
after_start- Post-startup operations - Before Shutdown:
before_shutdown- Prepare for shutdown - Shutdown:
shutdown- Stop module execution - After Shutdown:
after_shutdown- Cleanup resources
Structs§
- DMSC
Python Async Service Module - Python wrapper for asynchronous AsyncServiceModule trait.
- DMSC
Python Module - Python representation of a DMSC module configuration.
- DMSC
Python Module Adapter - Python module adapter that implements DMSCModule trait.
- DMSC
Python Service Module - Python wrapper for synchronous ServiceModule trait.
Traits§
- Async
Service Module - Internal asynchronous service module trait.
- DMSC
Module - Public asynchronous service module trait.
- Service
Module - Synchronous service module trait.