Files
mayfly-go/server/internal/machine/application/application.go

46 lines
864 B
Go
Raw Normal View History

2022-09-09 18:26:08 +08:00
package application
import (
2024-01-21 22:52:20 +08:00
"mayfly-go/pkg/ioc"
"sync"
)
2022-09-09 18:26:08 +08:00
func InitIoc() {
2026-02-01 13:35:23 +08:00
ioc.Register(new(machineAppImpl))
ioc.Register(new(machineFileAppImpl))
ioc.Register(new(machineScriptAppImpl))
ioc.Register(new(machineCronJobAppImpl))
ioc.Register(new(machineTermOpAppImpl))
ioc.Register(new(machineCmdConfAppImpl))
2024-01-21 22:52:20 +08:00
}
2022-09-09 18:26:08 +08:00
func Init() {
sync.OnceFunc(func() {
GetMachineCronJobApp().InitCronJob()
GetMachineApp().TimerUpdateStats()
GetMachineTermOpApp().TimerDeleteTermOp()
})()
}
2022-09-09 18:26:08 +08:00
func GetMachineApp() Machine {
2026-01-05 20:07:17 +08:00
return ioc.Get[Machine]()
2022-09-09 18:26:08 +08:00
}
func GetMachineFileApp() MachineFile {
2026-01-05 20:07:17 +08:00
return ioc.Get[MachineFile]()
2022-09-09 18:26:08 +08:00
}
func GetMachineScriptApp() MachineScript {
2026-01-05 20:07:17 +08:00
return ioc.Get[MachineScript]()
2022-09-09 18:26:08 +08:00
}
func GetMachineCronJobApp() MachineCronJob {
2026-01-05 20:07:17 +08:00
return ioc.Get[MachineCronJob]()
}
func GetMachineTermOpApp() MachineTermOp {
2026-01-05 20:07:17 +08:00
return ioc.Get[MachineTermOp]()
}