-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtypes.go
More file actions
50 lines (40 loc) · 1.4 KB
/
types.go
File metadata and controls
50 lines (40 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package typesense_healthcheck
type NodeState string
const (
LeaderState NodeState = "LEADER"
FollowerState NodeState = "FOLLOWER"
CandidateState NodeState = "CANDIDATE"
NotReadyState NodeState = "NOT_READY"
ErrorState NodeState = "ERROR"
UnreachableState NodeState = "UNREACHABLE"
)
type NodeStatus struct {
CommittedIndex int `json:"committed_index"`
QueuedWrites int `json:"queued_writes"`
State NodeState `json:"state"`
}
type ClusterStatus string
const (
ClusterStatusOK ClusterStatus = "OK"
ClusterStatusSplitBrain ClusterStatus = "SPLIT_BRAIN"
ClusterStatusNotReady ClusterStatus = "NOT_READY"
ClusterStatusElectionDeadlock ClusterStatus = "ELECTION_DEADLOCK"
)
type NodeHealthResourceError string
const (
OutOfMemory NodeHealthResourceError = "OUT_OF_MEMORY"
OutOfDisk NodeHealthResourceError = "OUT_OF_DISK"
)
type NodeHealth struct {
Ok bool `json:"ok"`
ResourceError *NodeHealthResourceError `json:"resource_error,omitempty"`
}
type NodesHealthCheck struct {
NodeStatus NodeStatus `json:"node_status"`
NodeHealth NodeHealth `json:"node_health"`
}
type ClusterHealthCheck struct {
ClusterStatus ClusterStatus `json:"cluster_status"`
ClusterHealth bool `json:"cluster_health"`
NodesStatus map[string]NodesHealthCheck `json:"nodes_health_check"`
}