db.go 1010 B

123456789101112131415161718192021222324252627282930313233343536
  1. package main
  2. import (
  3. "github.com/mhaya"
  4. mhayaCron "github.com/mhaya/components/cron"
  5. mhayaGops "github.com/mhaya/components/gops"
  6. mhayaMongo "github.com/mhaya/components/mongo"
  7. checkCenter "github.com/mhaya/game/game_cluster/internal/component/check_center"
  8. "github.com/mhaya/game/game_cluster/internal/data"
  9. "github.com/mhaya/game/game_cluster/internal/mdb"
  10. "github.com/mhaya/game/game_cluster/nodes/db/module"
  11. )
  12. func main() {
  13. nodeId := "m-db"
  14. // 配置mhaya引擎
  15. app := mhaya.Configure("./config/profile-gc.json", nodeId, false, mhaya.Cluster)
  16. // diagnose
  17. app.Register(mhayaGops.New())
  18. // 注册调度组件
  19. app.Register(mhayaCron.New())
  20. // 注册数据配置组件
  21. app.Register(data.New())
  22. // 注册检测中心节点组件,确认中心节点启动后,再启动当前节点
  23. app.Register(checkCenter.New())
  24. // 注册db组件
  25. app.Register(mhayaMongo.NewComponent())
  26. app.AddActors(
  27. &module.ActorDBs{},
  28. &module.ActorSaves{},
  29. &mdb.ActorDB{Name: nodeId},
  30. )
  31. app.Startup()
  32. }