2016-09-20 15:20:17 -07:00
|
|
|
package model
|
2016-09-15 13:52:55 -07:00
|
|
|
|
2016-09-28 09:59:01 -07:00
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
type NodeState int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
Healthy NodeState = iota
|
|
|
|
|
Unhealthy
|
|
|
|
|
)
|
|
|
|
|
|
2016-09-15 13:52:55 -07:00
|
|
|
type Node struct {
|
2016-09-28 09:59:01 -07:00
|
|
|
NodeID string `json:"nodeId"`
|
|
|
|
|
ClusterName string `json:"clusterName"`
|
|
|
|
|
IPAddress string `json:"ipAddr"`
|
|
|
|
|
Storage uint64 `json:"storage"`
|
|
|
|
|
LastUpdated time.Duration `json:"lastUpdated"`
|
|
|
|
|
State NodeState `json:"state"`
|
|
|
|
|
Location string `json:"location"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NodeStateToString(state NodeState) string {
|
|
|
|
|
switch state {
|
|
|
|
|
case Healthy:
|
|
|
|
|
return "OK"
|
|
|
|
|
case Unhealthy:
|
|
|
|
|
return "DOWN"
|
|
|
|
|
default:
|
|
|
|
|
return "UNKNOWN"
|
|
|
|
|
}
|
2016-09-15 13:52:55 -07:00
|
|
|
}
|