Module module

Module module 

Source
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.0

Unless 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

  1. Lifecycle Management: Modules follow a well-defined lifecycle with multiple phases
  2. Sync/Async Support: Clear separation between synchronous and asynchronous modules
  3. Default Implementations: Most methods have sensible defaults to minimize boilerplate
  4. Dependency Resolution: Modules can declare dependencies on other modules
  5. Priority System: Modules can specify execution priority
  6. Criticality Flag: Modules can be marked as critical or non-critical

§Module Lifecycle

Modules go through the following lifecycle phases:

  1. Initialization: init - Set up module resources
  2. Before Start: before_start - Prepare for module startup
  3. Start: start - Start module execution
  4. After Start: after_start - Post-startup operations
  5. Before Shutdown: before_shutdown - Prepare for shutdown
  6. Shutdown: shutdown - Stop module execution
  7. After Shutdown: after_shutdown - Cleanup resources

Structs§

DMSCPythonAsyncServiceModule
Python wrapper for asynchronous AsyncServiceModule trait.
DMSCPythonModule
Python representation of a DMSC module configuration.
DMSCPythonModuleAdapter
Python module adapter that implements DMSCModule trait.
DMSCPythonServiceModule
Python wrapper for synchronous ServiceModule trait.

Traits§

AsyncServiceModule
Internal asynchronous service module trait.
DMSCModule
Public asynchronous service module trait.
ServiceModule
Synchronous service module trait.