entities.go 513 B

12345678910111213141516171819202122232425262728293031
  1. package cluster
  2. import (
  3. "fmt"
  4. )
  5. type address struct {
  6. Ip string `json:"ip"`
  7. Port uint16 `json:"port"`
  8. Votes []vote `json:"vote"`
  9. }
  10. func (a *address) fullAddress() string {
  11. return fmt.Sprintf("%s:%d", a.Ip, a.Port)
  12. }
  13. type vote struct {
  14. NodeID string `json:"node_id"`
  15. VotedAt int64 `json:"voted_at"`
  16. Failed bool `json:"failed"`
  17. }
  18. type node struct {
  19. Addresses []address `json:"ips"`
  20. LastPingAt int64 `json:"last_ping_at"`
  21. }
  22. type newNodeEvent struct {
  23. NodeID string `json:"node_id"`
  24. }