diff --git a/dispatcher/grpc_service.go b/dispatcher/grpc_service.go index ca48e1f..ed5ca8d 100644 --- a/dispatcher/grpc_service.go +++ b/dispatcher/grpc_service.go @@ -29,7 +29,6 @@ import ( "github.com/blevesearch/bleve/search" "github.com/golang/protobuf/ptypes/any" "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/raft" "github.com/mosuka/blast/indexer" "github.com/mosuka/blast/indexutils" "github.com/mosuka/blast/manager" @@ -99,7 +98,7 @@ func (s *GRPCService) getManagerClient() (*manager.GRPCClient, error) { continue } - if node.State == raft.Leader.String() || node.State == raft.Follower.String() { + if node.State == management.Node_FOLLOWER || node.State == management.Node_LEADER { var ok bool client, ok = s.managerClients[id] if ok { @@ -108,7 +107,7 @@ func (s *GRPCService) getManagerClient() (*manager.GRPCClient, error) { s.logger.Error("node does not exist", zap.String("id", id)) } } else { - s.logger.Debug("node has not available", zap.String("id", id), zap.String("state", node.State)) + s.logger.Debug("node has not available", zap.String("id", id), zap.String("state", node.State.String())) } } diff --git a/dispatcher/server_test.go b/dispatcher/server_test.go index ec4ff53..64a5ca3 100644 --- a/dispatcher/server_test.go +++ b/dispatcher/server_test.go @@ -49,7 +49,7 @@ func TestServer_Start(t *testing.T) { managerNode1 := &management.Node{ BindAddress: managerBindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: managerGrpcAddress1, HttpAddress: managerHttpAddress1, @@ -85,7 +85,7 @@ func TestServer_Start(t *testing.T) { managerNode2 := &management.Node{ BindAddress: managerBindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: managerGrpcAddress2, HttpAddress: managerHttpAddress2, @@ -121,7 +121,7 @@ func TestServer_Start(t *testing.T) { managerNode3 := &management.Node{ BindAddress: managerBindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: managerGrpcAddress3, HttpAddress: managerHttpAddress3, @@ -167,7 +167,7 @@ func TestServer_Start(t *testing.T) { Nodes: map[string]*management.Node{ managerNodeId1: { BindAddress: managerBindAddress1, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: managerGrpcAddress1, HttpAddress: managerHttpAddress1, @@ -175,7 +175,7 @@ func TestServer_Start(t *testing.T) { }, managerNodeId2: { BindAddress: managerBindAddress2, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: managerGrpcAddress2, HttpAddress: managerHttpAddress2, @@ -183,7 +183,7 @@ func TestServer_Start(t *testing.T) { }, managerNodeId3: { BindAddress: managerBindAddress3, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: managerGrpcAddress3, HttpAddress: managerHttpAddress3, diff --git a/indexer/grpc_service.go b/indexer/grpc_service.go index 88ccf16..5b8d5cb 100644 --- a/indexer/grpc_service.go +++ b/indexer/grpc_service.go @@ -107,7 +107,7 @@ func (s *GRPCService) getManagerClient() (*manager.GRPCClient, error) { continue } - if node.State == raft.Leader.String() || node.State == raft.Follower.String() { + if node.State == management.Node_FOLLOWER || node.State == management.Node_LEADER { var ok bool client, ok = s.managerClients[id] if ok { @@ -116,7 +116,7 @@ func (s *GRPCService) getManagerClient() (*manager.GRPCClient, error) { s.logger.Error("node does not exist", zap.String("id", id)) } } else { - s.logger.Debug("node has not available", zap.String("id", id), zap.String("state", node.State)) + s.logger.Debug("node has not available", zap.String("id", id), zap.String("state", node.State.String())) } } diff --git a/manager/grpc_service.go b/manager/grpc_service.go index 2216077..6869c6c 100644 --- a/manager/grpc_service.go +++ b/manager/grpc_service.go @@ -79,35 +79,18 @@ func (s *GRPCService) Stop() error { } func (s *GRPCService) getLeaderClient() (*GRPCClient, error) { - var client *GRPCClient - for id, node := range s.cluster.Nodes { - state := node.State - if node.State == "" { - s.logger.Warn("missing state", zap.String("id", id), zap.String("state", state)) - continue - } - - if state == raft.Leader.String() { - var ok bool - client, ok = s.peerClients[id] - if ok { - break - } else { - s.logger.Error("node does not exist", zap.String("id", id)) + switch node.State { + case management.Node_LEADER: + if client, exist := s.peerClients[id]; exist { + return client, nil } - } else { - s.logger.Debug("not a leader", zap.String("id", id)) } } - if client == nil { - err := errors.New("there is no leader") - s.logger.Error(err.Error()) - return nil, err - } - - return client, nil + err := errors.New("there is no leader") + s.logger.Error(err.Error()) + return nil, err } func (s *GRPCService) cloneCluster(cluster *management.Cluster) (*management.Cluster, error) { @@ -319,7 +302,19 @@ func (s *GRPCService) NodeID() string { func (s *GRPCService) getSelfNode() *management.Node { node := s.raftServer.node - node.State = s.raftServer.State().String() + + switch s.raftServer.State() { + case raft.Follower: + node.State = management.Node_FOLLOWER + case raft.Candidate: + node.State = management.Node_CANDIDATE + case raft.Leader: + node.State = management.Node_LEADER + case raft.Shutdown: + node.State = management.Node_SHUTDOWN + default: + node.State = management.Node_UNKNOWN + } return node } @@ -336,7 +331,7 @@ func (s *GRPCService) getPeerNode(id string) (*management.Node, error) { s.logger.Debug(err.Error(), zap.String("id", id)) return &management.Node{ BindAddress: "", - State: raft.Shutdown.String(), + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: "", HttpAddress: "", diff --git a/manager/raft_fsm_test.go b/manager/raft_fsm_test.go index 983ff68..99d814c 100644 --- a/manager/raft_fsm_test.go +++ b/manager/raft_fsm_test.go @@ -20,7 +20,6 @@ import ( "reflect" "testing" - "github.com/hashicorp/raft" "github.com/mosuka/blast/logutils" "github.com/mosuka/blast/protobuf/management" ) @@ -58,7 +57,7 @@ func TestRaftFSM_GetNode(t *testing.T) { "node1", &management.Node{ BindAddress: "2100", - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: "5100", HttpAddress: "8100", @@ -69,7 +68,7 @@ func TestRaftFSM_GetNode(t *testing.T) { "node2", &management.Node{ BindAddress: "2110", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -80,7 +79,7 @@ func TestRaftFSM_GetNode(t *testing.T) { "node3", &management.Node{ BindAddress: "2120", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5120", HttpAddress: "8120", @@ -95,7 +94,7 @@ func TestRaftFSM_GetNode(t *testing.T) { exp1 := &management.Node{ BindAddress: "2110", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -142,7 +141,7 @@ func TestRaftFSM_SetNode(t *testing.T) { "node1", &management.Node{ BindAddress: "2100", - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: "5100", HttpAddress: "8100", @@ -153,7 +152,7 @@ func TestRaftFSM_SetNode(t *testing.T) { "node2", &management.Node{ BindAddress: "2110", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -164,7 +163,7 @@ func TestRaftFSM_SetNode(t *testing.T) { "node3", &management.Node{ BindAddress: "2120", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5120", HttpAddress: "8120", @@ -178,7 +177,7 @@ func TestRaftFSM_SetNode(t *testing.T) { } exp1 := &management.Node{ BindAddress: "2110", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -193,7 +192,7 @@ func TestRaftFSM_SetNode(t *testing.T) { "node2", &management.Node{ BindAddress: "2110", - State: raft.Shutdown.String(), + State: management.Node_SHUTDOWN, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -207,7 +206,7 @@ func TestRaftFSM_SetNode(t *testing.T) { } exp2 := &management.Node{ BindAddress: "2110", - State: raft.Shutdown.String(), + State: management.Node_SHUTDOWN, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -253,7 +252,7 @@ func TestRaftFSM_DeleteNode(t *testing.T) { "node1", &management.Node{ BindAddress: "2100", - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: "5100", HttpAddress: "8100", @@ -264,7 +263,7 @@ func TestRaftFSM_DeleteNode(t *testing.T) { "node2", &management.Node{ BindAddress: "2110", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", @@ -275,7 +274,7 @@ func TestRaftFSM_DeleteNode(t *testing.T) { "node3", &management.Node{ BindAddress: "2120", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5120", HttpAddress: "8120", @@ -289,7 +288,7 @@ func TestRaftFSM_DeleteNode(t *testing.T) { } exp1 := &management.Node{ BindAddress: "2110", - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: "5110", HttpAddress: "8110", diff --git a/manager/server_test.go b/manager/server_test.go index e389942..d1c30b8 100644 --- a/manager/server_test.go +++ b/manager/server_test.go @@ -22,7 +22,6 @@ import ( "testing" "time" - "github.com/hashicorp/raft" blasterrors "github.com/mosuka/blast/errors" "github.com/mosuka/blast/logutils" "github.com/mosuka/blast/protobuf/management" @@ -47,7 +46,7 @@ func TestServer_Start(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -94,7 +93,7 @@ func TestServer_HealthCheck(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -188,7 +187,7 @@ func TestServer_GetNode(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -238,7 +237,7 @@ func TestServer_GetNode(t *testing.T) { } expNodeInfo := &management.Node{ BindAddress: bindAddress, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -267,7 +266,7 @@ func TestServer_GetCluster(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -319,7 +318,7 @@ func TestServer_GetCluster(t *testing.T) { Nodes: map[string]*management.Node{ nodeId: { BindAddress: bindAddress, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -350,7 +349,7 @@ func TestServer_SetState(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -431,7 +430,7 @@ func TestServer_GetState(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -512,7 +511,7 @@ func TestServer_DeleteState(t *testing.T) { node := &management.Node{ BindAddress: bindAddress, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress, HttpAddress: httpAddress, @@ -614,7 +613,7 @@ func TestCluster_Start(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -650,7 +649,7 @@ func TestCluster_Start(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -686,7 +685,7 @@ func TestCluster_Start(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -733,7 +732,7 @@ func TestCluster_HealthCheck(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -769,7 +768,7 @@ func TestCluster_HealthCheck(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -805,7 +804,7 @@ func TestCluster_HealthCheck(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -975,7 +974,7 @@ func TestCluster_GetNode(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1011,7 +1010,7 @@ func TestCluster_GetNode(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1047,7 +1046,7 @@ func TestCluster_GetNode(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1106,7 +1105,7 @@ func TestCluster_GetNode(t *testing.T) { } expNode11 := &management.Node{ BindAddress: bindAddress1, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1123,7 +1122,7 @@ func TestCluster_GetNode(t *testing.T) { } expNode21 := &management.Node{ BindAddress: bindAddress2, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1140,7 +1139,7 @@ func TestCluster_GetNode(t *testing.T) { } expNode31 := &management.Node{ BindAddress: bindAddress3, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1169,7 +1168,7 @@ func TestCluster_GetCluster(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1205,7 +1204,7 @@ func TestCluster_GetCluster(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1241,7 +1240,7 @@ func TestCluster_GetCluster(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1302,7 +1301,7 @@ func TestCluster_GetCluster(t *testing.T) { Nodes: map[string]*management.Node{ nodeId1: { BindAddress: bindAddress1, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1310,7 +1309,7 @@ func TestCluster_GetCluster(t *testing.T) { }, nodeId2: { BindAddress: bindAddress2, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1318,7 +1317,7 @@ func TestCluster_GetCluster(t *testing.T) { }, nodeId3: { BindAddress: bindAddress3, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1339,7 +1338,7 @@ func TestCluster_GetCluster(t *testing.T) { Nodes: map[string]*management.Node{ nodeId1: { BindAddress: bindAddress1, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1347,7 +1346,7 @@ func TestCluster_GetCluster(t *testing.T) { }, nodeId2: { BindAddress: bindAddress2, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1355,7 +1354,7 @@ func TestCluster_GetCluster(t *testing.T) { }, nodeId3: { BindAddress: bindAddress3, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1376,7 +1375,7 @@ func TestCluster_GetCluster(t *testing.T) { Nodes: map[string]*management.Node{ nodeId1: { BindAddress: bindAddress1, - State: raft.Leader.String(), + State: management.Node_LEADER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1384,7 +1383,7 @@ func TestCluster_GetCluster(t *testing.T) { }, nodeId2: { BindAddress: bindAddress2, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1392,7 +1391,7 @@ func TestCluster_GetCluster(t *testing.T) { }, nodeId3: { BindAddress: bindAddress3, - State: raft.Follower.String(), + State: management.Node_FOLLOWER, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1423,7 +1422,7 @@ func TestCluster_SetState(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1459,7 +1458,7 @@ func TestCluster_SetState(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1495,7 +1494,7 @@ func TestCluster_SetState(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1670,7 +1669,7 @@ func TestCluster_GetState(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1706,7 +1705,7 @@ func TestCluster_GetState(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1742,7 +1741,7 @@ func TestCluster_GetState(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, @@ -1917,7 +1916,7 @@ func TestCluster_DeleteState(t *testing.T) { node1 := &management.Node{ BindAddress: bindAddress1, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress1, HttpAddress: httpAddress1, @@ -1953,7 +1952,7 @@ func TestCluster_DeleteState(t *testing.T) { node2 := &management.Node{ BindAddress: bindAddress2, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress2, HttpAddress: httpAddress2, @@ -1989,7 +1988,7 @@ func TestCluster_DeleteState(t *testing.T) { node3 := &management.Node{ BindAddress: bindAddress3, - State: "", + State: management.Node_UNKNOWN, Metadata: &management.Metadata{ GrpcAddress: grpcAddress3, HttpAddress: httpAddress3, diff --git a/protobuf/management/management.pb.go b/protobuf/management/management.pb.go index f5cf092..83c85b3 100644 --- a/protobuf/management/management.pb.go +++ b/protobuf/management/management.pb.go @@ -89,6 +89,40 @@ func (NodeHealthCheckResponse_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor_5e030ad796566078, []int{1, 0} } +type Node_State int32 + +const ( + Node_UNKNOWN Node_State = 0 + Node_FOLLOWER Node_State = 1 + Node_CANDIDATE Node_State = 2 + Node_LEADER Node_State = 3 + Node_SHUTDOWN Node_State = 4 +) + +var Node_State_name = map[int32]string{ + 0: "UNKNOWN", + 1: "FOLLOWER", + 2: "CANDIDATE", + 3: "LEADER", + 4: "SHUTDOWN", +} + +var Node_State_value = map[string]int32{ + "UNKNOWN": 0, + "FOLLOWER": 1, + "CANDIDATE": 2, + "LEADER": 3, + "SHUTDOWN": 4, +} + +func (x Node_State) String() string { + return proto.EnumName(Node_State_name, int32(x)) +} + +func (Node_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5e030ad796566078, []int{3, 0} +} + type ClusterWatchResponse_Event int32 const ( @@ -226,7 +260,6 @@ func (m *NodeHealthCheckResponse) GetState() NodeHealthCheckResponse_State { return NodeHealthCheckResponse_HEALTHY } -// use for raft type Metadata struct { GrpcAddress string `protobuf:"bytes,1,opt,name=grpc_address,json=grpcAddress,proto3" json:"grpc_address,omitempty"` HttpAddress string `protobuf:"bytes,2,opt,name=http_address,json=httpAddress,proto3" json:"http_address,omitempty"` @@ -275,12 +308,12 @@ func (m *Metadata) GetHttpAddress() string { } type Node struct { - BindAddress string `protobuf:"bytes,1,opt,name=bind_address,json=bindAddress,proto3" json:"bind_address,omitempty"` - State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - Metadata *Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + BindAddress string `protobuf:"bytes,1,opt,name=bind_address,json=bindAddress,proto3" json:"bind_address,omitempty"` + State Node_State `protobuf:"varint,2,opt,name=state,proto3,enum=management.Node_State" json:"state,omitempty"` + Metadata *Metadata `protobuf:"bytes,3,opt,name=metadata,proto3" json:"metadata,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Node) Reset() { *m = Node{} } @@ -315,11 +348,11 @@ func (m *Node) GetBindAddress() string { return "" } -func (m *Node) GetState() string { +func (m *Node) GetState() Node_State { if m != nil { return m.State } - return "" + return Node_UNKNOWN } func (m *Node) GetMetadata() *Metadata { @@ -856,6 +889,7 @@ func (m *WatchResponse) GetValue() *any.Any { func init() { proto.RegisterEnum("management.NodeHealthCheckRequest_Probe", NodeHealthCheckRequest_Probe_name, NodeHealthCheckRequest_Probe_value) proto.RegisterEnum("management.NodeHealthCheckResponse_State", NodeHealthCheckResponse_State_name, NodeHealthCheckResponse_State_value) + proto.RegisterEnum("management.Node_State", Node_State_name, Node_State_value) proto.RegisterEnum("management.ClusterWatchResponse_Event", ClusterWatchResponse_Event_name, ClusterWatchResponse_Event_value) proto.RegisterEnum("management.WatchResponse_Command", WatchResponse_Command_name, WatchResponse_Command_value) proto.RegisterType((*NodeHealthCheckRequest)(nil), "management.NodeHealthCheckRequest") @@ -882,65 +916,68 @@ func init() { } var fileDescriptor_5e030ad796566078 = []byte{ - // 920 bytes of a gzipped FileDescriptorProto + // 965 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x7f, 0x6f, 0xda, 0x46, - 0x18, 0xc6, 0x36, 0x0e, 0xe4, 0x25, 0x69, 0xad, 0x6b, 0x94, 0x26, 0x6c, 0xea, 0x92, 0x5b, 0x57, - 0x65, 0xab, 0x0a, 0x15, 0x5b, 0xb5, 0x6c, 0xeb, 0x7e, 0xd0, 0x60, 0x25, 0x30, 0x4a, 0x22, 0x43, - 0x56, 0x75, 0x9a, 0x54, 0x1d, 0xf8, 0x0a, 0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 0xcb, 0x4c, 0x4b, - 0x82, 0x53, 0xe9, 0x72, 0x82, 0x25, 0x78, 0xd8, 0x02, 0x3d, 0x58, 0xa3, 0x12, 0x14, 0x84, 0xa7, - 0xb7, 0x46, 0x8e, 0x3b, 0xb8, 0xee, 0x84, 0x4b, 0x05, 0x6d, 0x83, 0x5e, 0xe7, 0xfe, 0x0c, 0x15, - 0x15, 0x21, 0xdf, 0x30, 0xeb, 0x0d, 0x43, 0xe3, 0x41, 0xee, 0xf2, 0xad, 0x91, 0xe7, 0xf0, 0xce, - 0x65, 0xef, 0x9d, 0x58, 0xea, 0xf8, 0x0a, 0x8a, 0xaf, 0x29, 0x23, 0x36, 0x61, 0x04, 0x1d, 0xc3, - 0xce, 0x70, 0x36, 0x1d, 0xbc, 0x23, 0xb6, 0x3d, 0xa3, 0xbe, 0x1f, 0xf8, 0xdc, 0xb6, 0x4a, 0x3c, - 0x56, 0x17, 0x21, 0x0e, 0x19, 0x31, 0x36, 0x8d, 0x20, 0xaa, 0x80, 0xf0, 0x98, 0x84, 0xe0, 0x0f, - 0x90, 0xe7, 0xd9, 0x70, 0x68, 0x7f, 0xec, 0xda, 0xab, 0x6a, 0x3c, 0x16, 0xaa, 0xed, 0x85, 0x15, - 0x11, 0x32, 0x62, 0x81, 0x9e, 0x43, 0xd1, 0x91, 0x96, 0x0e, 0xb4, 0x23, 0xe5, 0xa4, 0x54, 0xdb, - 0x8b, 0x97, 0x2a, 0xb4, 0x6b, 0x45, 0x28, 0xfc, 0xa7, 0x02, 0x85, 0xb3, 0xc9, 0xdc, 0x67, 0x74, - 0x86, 0xbe, 0x01, 0xdd, 0xf5, 0x6c, 0xca, 0xcf, 0xd3, 0x4e, 0x4a, 0xb5, 0x47, 0x71, 0xaa, 0xc4, - 0x04, 0xd5, 0xf6, 0x4d, 0x97, 0xcd, 0xee, 0x2c, 0x01, 0x2e, 0xb7, 0x00, 0x16, 0x41, 0x64, 0x80, - 0x76, 0x43, 0xef, 0xa4, 0x63, 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xc3, 0x39, 0x74, 0x06, 0xa5, + 0xc4, 0x08, 0x40, 0x59, 0xe3, 0x2b, 0x31, 0x1b, 0xca, 0x6b, 0x8e, 0xc1, 0x39, 0xd4, 0x80, 0x9d, + 0x64, 0xff, 0xa3, 0x4f, 0x32, 0x94, 0x92, 0x93, 0x61, 0x83, 0x54, 0x3d, 0xf6, 0xb4, 0x31, 0xb5, + 0xac, 0x13, 0x96, 0xb2, 0x6b, 0xc5, 0xa6, 0xc2, 0x27, 0xb2, 0x56, 0xea, 0xf0, 0xb6, 0x39, 0x81, + 0x73, 0xcf, 0x24, 0x74, 0x02, 0xca, 0x19, 0xa1, 0x28, 0xf5, 0x6d, 0x5a, 0xf4, 0x64, 0xf9, 0xc1, + 0x4a, 0x3c, 0xf6, 0xf1, 0x0d, 0x28, 0x9d, 0x65, 0xe6, 0xa2, 0xe5, 0x36, 0x94, 0xe2, 0x07, 0xd8, + 0xe2, 0xed, 0x84, 0x0e, 0x92, 0xdc, 0x54, 0x8b, 0x6d, 0xa0, 0xff, 0x0c, 0x2a, 0x4f, 0x7c, 0x3f, + 0xa3, 0x5d, 0x38, 0xf9, 0x60, 0x6d, 0x23, 0x85, 0x39, 0xbf, 0x80, 0x62, 0xc7, 0x73, 0xa6, 0xc1, + 0xd0, 0xa7, 0x6b, 0xab, 0xb7, 0xf6, 0xfc, 0x97, 0x4f, 0x7f, 0x7d, 0x32, 0x18, 0xd1, 0xe1, 0xbc, + 0x57, 0xe9, 0xfb, 0x93, 0xea, 0xc4, 0x0f, 0xe6, 0x57, 0x4e, 0xb5, 0x37, 0x76, 0x02, 0x5a, 0xcd, + 0xf8, 0x6b, 0xd8, 0xdb, 0x0a, 0x83, 0x5f, 0xfd, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xa1, 0xdf, + 0xcd, 0x38, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -956,7 +993,6 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ManagementClient interface { NodeHealthCheck(ctx context.Context, in *NodeHealthCheckRequest, opts ...grpc.CallOption) (*NodeHealthCheckResponse, error) - // rpc NodeState (google.protobuf.Empty) returns (NodeStateResponse) {} NodeInfo(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*NodeInfoResponse, error) ClusterJoin(ctx context.Context, in *ClusterJoinRequest, opts ...grpc.CallOption) (*empty.Empty, error) ClusterLeave(ctx context.Context, in *ClusterLeaveRequest, opts ...grpc.CallOption) (*empty.Empty, error) @@ -1125,7 +1161,6 @@ func (c *managementClient) Snapshot(ctx context.Context, in *empty.Empty, opts . // ManagementServer is the server API for Management service. type ManagementServer interface { NodeHealthCheck(context.Context, *NodeHealthCheckRequest) (*NodeHealthCheckResponse, error) - // rpc NodeState (google.protobuf.Empty) returns (NodeStateResponse) {} NodeInfo(context.Context, *empty.Empty) (*NodeInfoResponse, error) ClusterJoin(context.Context, *ClusterJoinRequest) (*empty.Empty, error) ClusterLeave(context.Context, *ClusterLeaveRequest) (*empty.Empty, error) diff --git a/protobuf/management/management.proto b/protobuf/management/management.proto index 36cca52..2f0adf7 100644 --- a/protobuf/management/management.proto +++ b/protobuf/management/management.proto @@ -64,8 +64,15 @@ message Metadata { } message Node { + enum State { + UNKNOWN = 0; + FOLLOWER = 1; + CANDIDATE = 2; + LEADER = 3; + SHUTDOWN = 4; + } string bind_address = 1; - string state = 2; + State state = 2; Metadata metadata = 3; }