1 Star 0 Fork 0

jmesyan / kudos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
serverDefault.go 860 Bytes
一键复制 编辑 原始数据 按行查看 历史
jmesyan 提交于 2020-12-07 23:29 . v3 init
package app
import "gitee.com/jmesyan/kudos/v3/component"
type ServerDefault struct {
ServerId string
//component
Components map[string]component.Component
}
func NewServerDefault(serverId string) *ServerDefault {
return &ServerDefault{
ServerId: serverId,
Components: map[string]component.Component{},
}
}
func (s *ServerDefault) GetServerId() string {
return s.ServerId
}
func (s *ServerDefault) GetComponent(name string) component.Component {
return s.Components[name]
}
// Initialize components
func (s *ServerDefault) OnInit() {
for _,com := range s.Components {
com.OnInit(s)
}
}
// Destroy components
func (s *ServerDefault) OnDestroy() {
for _,com := range s.Components {
com.OnDestroy()
}
}
// Run components
func (s *ServerDefault) OnRun(closeSig chan bool) {
for _,com := range s.Components {
com.OnRun(closeSig)
}
}
1
https://gitee.com/jmesyan/kudos.git
git@gitee.com:jmesyan/kudos.git
jmesyan
kudos
kudos
v3.0.1

搜索帮助

53164aa7 5694891 3bd8fe86 5694891