2022-09-09 18:26:08 +08:00
|
|
|
package application
|
|
|
|
|
|
2023-03-06 16:59:57 +08:00
|
|
|
import (
|
2024-01-21 22:52:20 +08:00
|
|
|
"mayfly-go/pkg/ioc"
|
2024-10-22 20:39:44 +08:00
|
|
|
"sync"
|
2023-03-06 16:59:57 +08:00
|
|
|
)
|
2022-09-09 18:26:08 +08:00
|
|
|
|
2024-01-22 11:35:28 +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
|
|
|
|
2024-10-22 20:39:44 +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
|
|
|
}
|
2023-03-06 16:59:57 +08:00
|
|
|
|
2023-07-20 22:41:13 +08:00
|
|
|
func GetMachineCronJobApp() MachineCronJob {
|
2026-01-05 20:07:17 +08:00
|
|
|
return ioc.Get[MachineCronJob]()
|
2023-07-20 22:41:13 +08:00
|
|
|
}
|
2023-12-05 23:03:51 +08:00
|
|
|
|
|
|
|
|
func GetMachineTermOpApp() MachineTermOp {
|
2026-01-05 20:07:17 +08:00
|
|
|
return ioc.Get[MachineTermOp]()
|
2023-12-05 23:03:51 +08:00
|
|
|
}
|