将代码与测试注释改为中文以符合仓库规范;新增中文部署指南、 示例配置,并完善构建脚本对 VERSION 注入的说明。 Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
889 B
Go
27 lines
889 B
Go
package service
|
|
|
|
import "mfd-monitor-agent/internal/config"
|
|
|
|
// InstallOptions 携带平台相关的服务安装参数。
|
|
type InstallOptions struct {
|
|
// ConfigPath 在提供了配置文件时,会写入服务命令行中的 -config 参数。
|
|
ConfigPath string
|
|
}
|
|
|
|
// Manager 控制操作系统服务的安装与生命周期命令。
|
|
type Manager interface {
|
|
// Install 将 agent 可执行文件注册为操作系统服务。
|
|
Install(executable string, cfg config.Config, opts InstallOptions) error
|
|
// Uninstall 移除操作系统服务注册。
|
|
Uninstall(cfg config.Config) error
|
|
// Start 请求操作系统服务管理器启动 agent 服务。
|
|
Start(cfg config.Config) error
|
|
// Stop 请求操作系统服务管理器停止 agent 服务。
|
|
Stop(cfg config.Config) error
|
|
}
|
|
|
|
// NewManager 返回平台相关的服务管理器。
|
|
func NewManager() Manager {
|
|
return newManager()
|
|
}
|