model.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package model
  2. import (
  3. "container/list"
  4. )
  5. const (
  6. // CodePlatDefaut db common plat code.
  7. CodePlatDefaut = 1
  8. // CodePlatDefautMsg db common plat msg.
  9. CodePlatDefautMsg = "common"
  10. // CodeDelStatus db delete status.
  11. CodeDelStatus = 2
  12. // HostOffline host offline state.
  13. HostOffline = 0
  14. )
  15. // RPC rpc node value.
  16. type RPC struct {
  17. Proto string `json:"Proto"`
  18. Addr string `json:"Addr"`
  19. Group string `json:"Group"`
  20. Weight int `json:"Weight"`
  21. }
  22. // Code ver and message.
  23. type Code struct {
  24. Ver int64
  25. Code int
  26. Msg string
  27. }
  28. // Codes all codes local map cache.
  29. type Codes struct {
  30. Ver int64
  31. MD5 string
  32. Code map[int]string
  33. }
  34. // Version list and map.
  35. type Version struct {
  36. List *list.List
  37. Map map[int64]*list.Element
  38. }
  39. // Databus databus rule.
  40. type Databus struct {
  41. Topic string `json:"topic"`
  42. Group string `json:"group"`
  43. Cluster string `json:"cluster"`
  44. Business string `json:"business"`
  45. Operation int8 `json:"operation"`
  46. Leader string `json:"leader"`
  47. Phone string `json:"phone"`
  48. Email string `json:"email"`
  49. AlarmSwitch int8 `json:"alarmSwitch"`
  50. Users string `json:"users"`
  51. AlarmRule string `json:"alarmRule"`
  52. }
  53. // Databuss databuss rules.
  54. type Databuss struct {
  55. Rules []*Databus `json:"rules"`
  56. MD5 string `json:"md5"`
  57. }
  58. // Limit limit.
  59. type Limit struct {
  60. Burst int `json:"burst"`
  61. Rate float64 `json:"rate"`
  62. }
  63. // Limits limits.
  64. type Limits struct {
  65. Apps map[string]*Limit `json:"apps"`
  66. MD5 string `json:"md5"`
  67. }
  68. // Host host.
  69. type Host struct {
  70. Name string `json:"hostname"`
  71. State int `json:"state"`
  72. }
  73. //CodesLangs ...
  74. type CodesLangs struct {
  75. Ver int64
  76. MD5 string
  77. Code map[int]map[string]string
  78. }
  79. // //Langs ...
  80. // type Langs struct {
  81. // Default string `json:"default"`
  82. // Localeds []*Locale
  83. // }
  84. //Locale ...
  85. // type Locale struct {
  86. // Locale string
  87. // Message string
  88. // }
  89. //CodeLangs ...
  90. type CodeLangs struct {
  91. Ver int64
  92. Code int
  93. Msg map[string]string
  94. }