⚡ 初始提交 - FutureOSS v1.0 插件化运行时框架
一切皆为插件的开发者工具运行时框架
🧩 核心特性:
- 插件热插拔 (importlib 动态加载)
- 依赖自动解析 (拓扑排序 + 循环检测)
- 企业级稳定 (熔断/降级/重试/隔离)
- 事件驱动 (发布/订阅事件总线)
- 完整配置 (YAML 配置 + 热重载)
This commit is contained in:
33
oss/plugin/manager.py
Normal file
33
oss/plugin/manager.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""插件管理器 - 只加载 plugin-loader"""
|
||||
from typing import Any, Optional
|
||||
|
||||
from oss.plugin.loader import PluginLoader
|
||||
|
||||
|
||||
class PluginManager:
|
||||
"""管理基础插件"""
|
||||
|
||||
def __init__(self):
|
||||
self.loader = PluginLoader()
|
||||
self.plugin_loader: Optional[Any] = None
|
||||
|
||||
def load(self):
|
||||
"""加载基础插件"""
|
||||
# 只加载 plugin-loader,其他都是可选的
|
||||
pl_info = self.loader.load_core_plugin("plugin-loader")
|
||||
if pl_info:
|
||||
self.plugin_loader = pl_info["instance"]
|
||||
|
||||
def start(self):
|
||||
"""启动基础插件"""
|
||||
if self.plugin_loader:
|
||||
self.plugin_loader.init()
|
||||
self.plugin_loader.start()
|
||||
|
||||
def stop(self):
|
||||
"""停止基础插件"""
|
||||
if self.plugin_loader:
|
||||
try:
|
||||
self.plugin_loader.stop()
|
||||
except Exception:
|
||||
pass
|
||||
Reference in New Issue
Block a user