优化结构

This commit is contained in:
Yvan
2026-08-28 09:19:54 +08:00
parent 03a4131f6e
commit 279692375b
57 changed files with 778 additions and 799 deletions
+10 -2
View File
@@ -50,10 +50,11 @@ type TaskReloader interface {
type SystemConfigUsecase struct {
repo InitializationRepo
tasks TaskReloader
info SystemInfoProvider
}
func NewSystemConfigUsecase(repo InitializationRepo, tasks TaskReloader) *SystemConfigUsecase {
return &SystemConfigUsecase{repo: repo, tasks: tasks}
func NewSystemConfigUsecase(repo InitializationRepo, tasks TaskReloader, info SystemInfoProvider) *SystemConfigUsecase {
return &SystemConfigUsecase{repo: repo, tasks: tasks, info: info}
}
func (uc *SystemConfigUsecase) IsInitialized(ctx context.Context) (bool, error) {
@@ -128,3 +129,10 @@ func (uc *SystemConfigUsecase) DiskMountPoints() []string {
}
return uc.repo.DiskMountPoints()
}
func (uc *SystemConfigUsecase) ServerInfo(ctx context.Context) (*ServerInfo, error) {
if uc == nil || uc.repo == nil || uc.info == nil {
return nil, errors.New("系统信息服务未就绪")
}
return uc.info.Collect(ctx, uc.repo.DiskMountPoints())
}