client.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package model
  2. import (
  3. "go-common/library/time"
  4. )
  5. const (
  6. // HostOffline host offline state.
  7. HostOffline = 0
  8. // HostOnline host online state.
  9. HostOnline = 1
  10. // HostStateOK host state ok.
  11. HostStateOK = 2
  12. // UnknownVersion unknown version.
  13. UnknownVersion = -1
  14. )
  15. // Diff return to client.
  16. type Diff struct {
  17. Version int64 `json:"version"`
  18. Diffs []int64 `json:"diffs"`
  19. }
  20. // Version return to client.
  21. type Version struct {
  22. Version int64 `json:"version"`
  23. }
  24. // ReVer reVer
  25. type ReVer struct {
  26. Version int64 `json:"version"`
  27. Remark string `json:"remark"`
  28. }
  29. // Versions versions
  30. type Versions struct {
  31. Version []*ReVer `json:"version"`
  32. DefVer int64 `json:"defver"`
  33. }
  34. // Content return to client.
  35. type Content struct {
  36. Version int64 `json:"version"`
  37. Md5 string `json:"md5"`
  38. Content string `json:"content"`
  39. }
  40. // Namespace the key-value config object.
  41. type Namespace struct {
  42. Name string `json:"name"`
  43. Data map[string]string `json:"data"`
  44. }
  45. // Service service
  46. type Service struct {
  47. Name string
  48. BuildVersion string
  49. Env string
  50. Token string
  51. File string
  52. Version int64
  53. Host string
  54. IP string
  55. Appoint int64
  56. }
  57. // NSValue config value.
  58. type NSValue struct {
  59. ConfigID int64 `json:"cid"`
  60. NamespaceID int64 `json:"nsid"`
  61. Name string `json:"name"`
  62. Config string `json:"config"`
  63. }
  64. // Value config value.
  65. type Value struct {
  66. ConfigID int64 `json:"cid"`
  67. Name string `json:"name"`
  68. Config string `json:"config"`
  69. }
  70. // Host host.
  71. type Host struct {
  72. Name string `json:"hostname"`
  73. Service string `json:"service"`
  74. BuildVersion string `json:"build"`
  75. IP string `json:"ip"`
  76. ConfigVersion int64 `json:"version"`
  77. HeartbeatTime time.Time `json:"heartbeat_time"`
  78. State int `json:"state"`
  79. Appoint int64 `json:"appoint"`
  80. Customize string `json:"customize"`
  81. Force int8 `json:"force"`
  82. ForceVersion int64 `json:"force_version"`
  83. }