mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 06:40:26 +08:00
阶段性提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ADMIN_PROJECT="../../EdgeAdmin"
|
||||
NODE_PROJECT="../../EdgeNode"
|
||||
|
||||
rm -f ../internal/rpc/pb/*
|
||||
protoc --go_out=plugins=grpc:../internal/rpc --proto_path=../internal/rpc/protos ../internal/rpc/protos/*.proto
|
||||
@@ -18,3 +19,11 @@ pub ${ADMIN_PROJECT} node_grant
|
||||
pub ${ADMIN_PROJECT} server
|
||||
|
||||
cp ../internal/rpc/pb/model_*.go ${ADMIN_PROJECT}/internal/rpc/pb/
|
||||
|
||||
# node
|
||||
pub ${NODE_PROJECT} node
|
||||
|
||||
cp ../internal/rpc/pb/model_node.pb.go ${NODE_PROJECT}/internal/rpc/pb/
|
||||
cp ../internal/rpc/pb/model_node_login.pb.go ${NODE_PROJECT}/internal/rpc/pb/
|
||||
cp ../internal/rpc/pb/model_node_grant.pb.go ${NODE_PROJECT}/internal/rpc/pb/
|
||||
cp ../internal/rpc/pb/model_node_cluster.pb.go ${NODE_PROJECT}/internal/rpc/pb/
|
||||
@@ -43,7 +43,7 @@ func (this *NodeClusterDAO) DisableNodeCluster(id uint32) (rowsAffected int64, e
|
||||
}
|
||||
|
||||
// 查找启用中的条目
|
||||
func (this *NodeClusterDAO) FindEnabledNodeCluster(id uint32) (*NodeCluster, error) {
|
||||
func (this *NodeClusterDAO) FindEnabledNodeCluster(id int64) (*NodeCluster, error) {
|
||||
result, err := this.Query().
|
||||
Pk(id).
|
||||
Attr("state", NodeClusterStateEnabled).
|
||||
|
||||
@@ -69,9 +69,14 @@ func (this *NodeDAO) FindNodeName(id uint32) (string, error) {
|
||||
|
||||
// 创建节点
|
||||
func (this *NodeDAO) CreateNode(name string, clusterId int64) (nodeId int64, err error) {
|
||||
uniqueId, err := this.genUniqueId()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
op := NewNodeOperator()
|
||||
op.Name = name
|
||||
op.NodeId = rands.HexString(32)
|
||||
op.UniqueId = uniqueId
|
||||
op.Secret = rands.String(32)
|
||||
op.ClusterId = clusterId
|
||||
op.IsOn = 1
|
||||
@@ -93,10 +98,69 @@ func (this *NodeDAO) UpdateNode(nodeId int64, name string, clusterId int64) erro
|
||||
op.Id = nodeId
|
||||
op.Name = name
|
||||
op.ClusterId = clusterId
|
||||
op.LatestVersion = dbs.SQL("latestVersion+1")
|
||||
_, err := this.Save(op)
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新节点版本
|
||||
func (this *NodeDAO) UpdateNodeLatestVersion(nodeId int64) error {
|
||||
if nodeId <= 0 {
|
||||
return errors.New("invalid nodeId")
|
||||
}
|
||||
op := NewNodeOperator()
|
||||
op.Id = nodeId
|
||||
op.LatestVersion = dbs.SQL("latestVersion+1")
|
||||
_, err := this.Save(op)
|
||||
return err
|
||||
}
|
||||
|
||||
// 批量更新节点版本
|
||||
func (this *NodeDAO) UpdateAllNodesLatestVersionMatch(clusterId int64) error {
|
||||
nodeIds, err := this.FindAllNodeIdsMatch(clusterId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(nodeIds) == 0 {
|
||||
return nil
|
||||
}
|
||||
_, err = this.Query().
|
||||
Pk(nodeIds).
|
||||
Set("latestVersion", dbs.SQL("latestVersion+1")).
|
||||
Update()
|
||||
return err
|
||||
}
|
||||
|
||||
// 同步集群中的节点版本
|
||||
func (this *NodeDAO) SyncNodeVersionsWithCluster(clusterId int64) error {
|
||||
if clusterId <= 0 {
|
||||
return errors.New("invalid cluster")
|
||||
}
|
||||
_, err := this.Query().
|
||||
Attr("clusterId", clusterId).
|
||||
Set("version", dbs.SQL("latestVersion")).
|
||||
Update()
|
||||
return err
|
||||
}
|
||||
|
||||
// 取得有变更的集群
|
||||
func (this *NodeDAO) FindChangedClusterIds() ([]int64, error) {
|
||||
ones, _, err := this.Query().
|
||||
State(NodeStateEnabled).
|
||||
Gt("latestVersion", 0).
|
||||
Where("version!=latestVersion").
|
||||
Result("DISTINCT(clusterId) AS clusterId").
|
||||
FindOnes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := []int64{}
|
||||
for _, one := range ones {
|
||||
result = append(result, one.GetInt64("clusterId"))
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// 计算所有节点数量
|
||||
func (this *NodeDAO) CountAllEnabledNodes() (int64, error) {
|
||||
return this.Query().
|
||||
@@ -115,3 +179,85 @@ func (this *NodeDAO) ListEnabledNodes(offset int64, size int64) (result []*Node,
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
// 根据节点ID和密钥查询节点
|
||||
func (this *NodeDAO) FindEnabledNodeWithUniqueIdAndSecret(uniqueId string, secret string) (*Node, error) {
|
||||
one, err := this.Query().
|
||||
Attr("uniqueId", uniqueId).
|
||||
Attr("secret", secret).
|
||||
State(NodeStateEnabled).
|
||||
Find()
|
||||
|
||||
if one != nil {
|
||||
return one.(*Node), err
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 根据节点ID获取节点
|
||||
func (this *NodeDAO) FindEnabledNodeWithUniqueId(uniqueId string) (*Node, error) {
|
||||
one, err := this.Query().
|
||||
Attr("uniqueId", uniqueId).
|
||||
State(NodeStateEnabled).
|
||||
Find()
|
||||
|
||||
if one != nil {
|
||||
return one.(*Node), err
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 获取节点集群ID
|
||||
func (this *NodeDAO) FindNodeClusterId(nodeId int64) (int64, error) {
|
||||
col, err := this.Query().
|
||||
Pk(nodeId).
|
||||
Result("clusterId").
|
||||
FindCol(0)
|
||||
return types.Int64(col), err
|
||||
}
|
||||
|
||||
// 匹配节点并返回节点ID
|
||||
func (this *NodeDAO) FindAllNodeIdsMatch(clusterId int64) (result []int64, err error) {
|
||||
query := this.Query()
|
||||
query.State(NodeStateEnabled)
|
||||
if clusterId > 0 {
|
||||
query.Attr("clusterId", clusterId)
|
||||
}
|
||||
query.Result("id")
|
||||
ones, _, err := query.FindOnes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, one := range ones {
|
||||
result = append(result, one.GetInt64("id"))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 更改节点状态
|
||||
func (this *NodeDAO) UpdateNodeStatus(nodeId int64, statusJSON []byte) error {
|
||||
_, err := this.Query().
|
||||
Pk(nodeId).
|
||||
Set("status", string(statusJSON)).
|
||||
Update()
|
||||
return err
|
||||
}
|
||||
|
||||
// 生成唯一ID
|
||||
func (this *NodeDAO) genUniqueId() (string, error) {
|
||||
for {
|
||||
uniqueId := rands.HexString(32)
|
||||
ok, err := this.Query().
|
||||
Attr("uniqueId", uniqueId).
|
||||
Exist()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
return uniqueId, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,21 @@ package models
|
||||
|
||||
import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNodeDAO_FindAllNodeIdsMatch(t *testing.T) {
|
||||
nodeIds, err := SharedNodeDAO.FindAllNodeIdsMatch(1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(nodeIds)
|
||||
}
|
||||
|
||||
func TestNodeDAO_FindChangedClusterIds(t *testing.T) {
|
||||
clusterIds, err := SharedNodeDAO.FindChangedClusterIds()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(clusterIds)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package models
|
||||
type Node struct {
|
||||
Id uint32 `field:"id"` // ID
|
||||
IsOn uint8 `field:"isOn"` // 是否启用
|
||||
NodeId string `field:"nodeId"` // 节点ID
|
||||
UniqueId string `field:"uniqueId"` // 节点ID
|
||||
Secret string `field:"secret"` // 密钥
|
||||
Name string `field:"name"` // 节点名
|
||||
Code string `field:"code"` // 代号
|
||||
@@ -13,13 +13,15 @@ type Node struct {
|
||||
GroupId uint32 `field:"groupId"` // 分组ID
|
||||
CreatedAt uint32 `field:"createdAt"` // 创建时间
|
||||
Status string `field:"status"` // 最新的状态
|
||||
Version uint32 `field:"version"` // 当前版本号
|
||||
LatestVersion uint32 `field:"latestVersion"` // 最后版本号
|
||||
State uint8 `field:"state"` // 状态
|
||||
}
|
||||
|
||||
type NodeOperator struct {
|
||||
Id interface{} // ID
|
||||
IsOn interface{} // 是否启用
|
||||
NodeId interface{} // 节点ID
|
||||
UniqueId interface{} // 节点ID
|
||||
Secret interface{} // 密钥
|
||||
Name interface{} // 节点名
|
||||
Code interface{} // 代号
|
||||
@@ -28,6 +30,8 @@ type NodeOperator struct {
|
||||
GroupId interface{} // 分组ID
|
||||
CreatedAt interface{} // 创建时间
|
||||
Status interface{} // 最新的状态
|
||||
Version interface{} // 当前版本号
|
||||
LatestVersion interface{} // 最后版本号
|
||||
State interface{} // 状态
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"github.com/iwind/TeaGo/rands"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
)
|
||||
|
||||
@@ -37,15 +38,16 @@ func (this *ServerDAO) EnableServer(id uint32) (rowsAffected int64, err error) {
|
||||
}
|
||||
|
||||
// 禁用条目
|
||||
func (this *ServerDAO) DisableServer(id uint32) (rowsAffected int64, err error) {
|
||||
return this.Query().
|
||||
func (this *ServerDAO) DisableServer(id int64) (err error) {
|
||||
_, err = this.Query().
|
||||
Pk(id).
|
||||
Set("state", ServerStateDisabled).
|
||||
Update()
|
||||
return
|
||||
}
|
||||
|
||||
// 查找启用中的条目
|
||||
func (this *ServerDAO) FindEnabledServer(id uint32) (*Server, error) {
|
||||
func (this *ServerDAO) FindEnabledServer(id int64) (*Server, error) {
|
||||
result, err := this.Query().
|
||||
Pk(id).
|
||||
Attr("state", ServerStateEnabled).
|
||||
@@ -58,7 +60,13 @@ func (this *ServerDAO) FindEnabledServer(id uint32) (*Server, error) {
|
||||
|
||||
// 创建服务
|
||||
func (this *ServerDAO) CreateServer(adminId int64, userId int64, clusterId int64, configJSON string, includeNodesJSON string, excludeNodesJSON string) (serverId int64, err error) {
|
||||
uniqueId, err := this.genUniqueId()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
op := NewServerOperator()
|
||||
op.UniqueId = uniqueId
|
||||
op.UserId = userId
|
||||
op.AdminId = adminId
|
||||
op.ClusterId = clusterId
|
||||
@@ -119,3 +127,40 @@ func (this *ServerDAO) ListEnabledServers(offset int64, size int64) (result []*S
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
// 获取节点中的所有服务
|
||||
func (this *ServerDAO) FindAllEnabledServersWithNode(nodeId int64) (result []*Server, err error) {
|
||||
// 节点所在集群
|
||||
clusterId, err := SharedNodeDAO.FindNodeClusterId(nodeId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if clusterId <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
_, err = this.Query().
|
||||
Attr("clusterId", clusterId).
|
||||
State(ServerStateEnabled).
|
||||
AscPk().
|
||||
Slice(&result).
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
// 生成唯一ID
|
||||
func (this *ServerDAO) genUniqueId() (string, error) {
|
||||
for {
|
||||
uniqueId := rands.HexString(32)
|
||||
ok, err := this.Query().
|
||||
Attr("uniqueId", uniqueId).
|
||||
Exist()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if ok {
|
||||
continue
|
||||
}
|
||||
return uniqueId, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package models
|
||||
// 服务
|
||||
type Server struct {
|
||||
Id uint32 `field:"id"` // ID
|
||||
UniqueId string `field:"uniqueId"` // 唯一ID
|
||||
IsOn uint8 `field:"isOn"` // 是否启用
|
||||
UserId uint32 `field:"userId"` // 用户ID
|
||||
AdminId uint32 `field:"adminId"` // 管理员ID
|
||||
@@ -18,6 +19,7 @@ type Server struct {
|
||||
|
||||
type ServerOperator struct {
|
||||
Id interface{} // ID
|
||||
UniqueId interface{} // 唯一ID
|
||||
IsOn interface{} // 是否启用
|
||||
UserId interface{} // 用户ID
|
||||
AdminId interface{} // 管理员ID
|
||||
|
||||
@@ -32,6 +32,7 @@ type Node struct {
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Cluster *NodeCluster `protobuf:"bytes,32,opt,name=cluster,proto3" json:"cluster,omitempty"`
|
||||
Login *NodeLogin `protobuf:"bytes,33,opt,name=login,proto3" json:"login,omitempty"`
|
||||
}
|
||||
@@ -82,6 +83,13 @@ func (x *Node) GetName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetCluster() *NodeCluster {
|
||||
if x != nil {
|
||||
return x.Cluster
|
||||
@@ -103,16 +111,17 @@ var file_model_node_proto_rawDesc = []byte{
|
||||
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f,
|
||||
0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x1a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18,
|
||||
0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12,
|
||||
0x23, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x05, 0x6c,
|
||||
0x6f, 0x67, 0x69, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x01, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x29, 0x0a,
|
||||
0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
|
||||
0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69,
|
||||
0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -620,6 +620,349 @@ func (x *FindEnabledNodeResponse) GetNode() *Node {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 组合单个节点配置
|
||||
type ComposeNodeConfigRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ComposeNodeConfigRequest) Reset() {
|
||||
*x = ComposeNodeConfigRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ComposeNodeConfigRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ComposeNodeConfigRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ComposeNodeConfigRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[12]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ComposeNodeConfigRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ComposeNodeConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
type ComposeNodeConfigResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ConfigJSON []byte `protobuf:"bytes,1,opt,name=configJSON,proto3" json:"configJSON,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ComposeNodeConfigResponse) Reset() {
|
||||
*x = ComposeNodeConfigResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ComposeNodeConfigResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ComposeNodeConfigResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ComposeNodeConfigResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[13]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ComposeNodeConfigResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ComposeNodeConfigResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *ComposeNodeConfigResponse) GetConfigJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ConfigJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 节点stream
|
||||
type NodeStreamRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *NodeStreamRequest) Reset() {
|
||||
*x = NodeStreamRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeStreamRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeStreamRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NodeStreamRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[14]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeStreamRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NodeStreamRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
type NodeStreamResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *NodeStreamResponse) Reset() {
|
||||
*x = NodeStreamResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[15]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NodeStreamResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NodeStreamResponse) ProtoMessage() {}
|
||||
|
||||
func (x *NodeStreamResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[15]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NodeStreamResponse.ProtoReflect.Descriptor instead.
|
||||
func (*NodeStreamResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{15}
|
||||
}
|
||||
|
||||
// 更新节点状态
|
||||
type UpdateNodeStatusRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
|
||||
StatusJSON []byte `protobuf:"bytes,2,opt,name=statusJSON,proto3" json:"statusJSON,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateNodeStatusRequest) Reset() {
|
||||
*x = UpdateNodeStatusRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[16]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateNodeStatusRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateNodeStatusRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateNodeStatusRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[16]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateNodeStatusRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateNodeStatusRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{16}
|
||||
}
|
||||
|
||||
func (x *UpdateNodeStatusRequest) GetNodeId() int64 {
|
||||
if x != nil {
|
||||
return x.NodeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateNodeStatusRequest) GetStatusJSON() []byte {
|
||||
if x != nil {
|
||||
return x.StatusJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateNodeStatusResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *UpdateNodeStatusResponse) Reset() {
|
||||
*x = UpdateNodeStatusResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[17]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateNodeStatusResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateNodeStatusResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateNodeStatusResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[17]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateNodeStatusResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateNodeStatusResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{17}
|
||||
}
|
||||
|
||||
// 同步集群中的节点版本
|
||||
type SyncNodesVersionWithClusterRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ClusterId int64 `protobuf:"varint,1,opt,name=clusterId,proto3" json:"clusterId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterRequest) Reset() {
|
||||
*x = SyncNodesVersionWithClusterRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[18]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SyncNodesVersionWithClusterRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[18]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SyncNodesVersionWithClusterRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SyncNodesVersionWithClusterRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{18}
|
||||
}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterRequest) GetClusterId() int64 {
|
||||
if x != nil {
|
||||
return x.ClusterId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SyncNodesVersionWithClusterResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterResponse) Reset() {
|
||||
*x = SyncNodesVersionWithClusterResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_proto_msgTypes[19]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SyncNodesVersionWithClusterResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SyncNodesVersionWithClusterResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_proto_msgTypes[19]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SyncNodesVersionWithClusterResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SyncNodesVersionWithClusterResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_proto_rawDescGZIP(), []int{19}
|
||||
}
|
||||
|
||||
var File_service_node_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_node_proto_rawDesc = []byte{
|
||||
@@ -670,35 +1013,78 @@ var file_service_node_proto_rawDesc = []byte{
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x17, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x1c, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x08, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x32,
|
||||
0xbd, 0x03, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x3b, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41,
|
||||
0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x45,
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64,
|
||||
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
|
||||
0x08, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22,
|
||||
0x1a, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x19, 0x43,
|
||||
0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x13, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a,
|
||||
0x12, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x51, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x1a, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x42, 0x0a, 0x22, 0x53, 0x79, 0x6e, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56,
|
||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73,
|
||||
0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x23, 0x53, 0x79, 0x6e, 0x63, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c,
|
||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8f, 0x06,
|
||||
0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a,
|
||||
0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c,
|
||||
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c,
|
||||
0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a,
|
||||
0x11, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x3f, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x15, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74,
|
||||
0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01,
|
||||
0x12, 0x4d, 0x0a, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x6e, 0x0a, 0x1b, 0x73, 0x79, 0x6e, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x26,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56, 0x65, 0x72,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68,
|
||||
0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
@@ -714,7 +1100,7 @@ func file_service_node_proto_rawDescGZIP() []byte {
|
||||
return file_service_node_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_node_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||
var file_service_node_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
|
||||
var file_service_node_proto_goTypes = []interface{}{
|
||||
(*CreateNodeRequest)(nil), // 0: pb.CreateNodeRequest
|
||||
(*CreateNodeResponse)(nil), // 1: pb.CreateNodeResponse
|
||||
@@ -728,28 +1114,44 @@ var file_service_node_proto_goTypes = []interface{}{
|
||||
(*UpdateNodeResponse)(nil), // 9: pb.UpdateNodeResponse
|
||||
(*FindEnabledNodeRequest)(nil), // 10: pb.FindEnabledNodeRequest
|
||||
(*FindEnabledNodeResponse)(nil), // 11: pb.FindEnabledNodeResponse
|
||||
(*NodeLogin)(nil), // 12: pb.NodeLogin
|
||||
(*Node)(nil), // 13: pb.Node
|
||||
(*ComposeNodeConfigRequest)(nil), // 12: pb.ComposeNodeConfigRequest
|
||||
(*ComposeNodeConfigResponse)(nil), // 13: pb.ComposeNodeConfigResponse
|
||||
(*NodeStreamRequest)(nil), // 14: pb.NodeStreamRequest
|
||||
(*NodeStreamResponse)(nil), // 15: pb.NodeStreamResponse
|
||||
(*UpdateNodeStatusRequest)(nil), // 16: pb.UpdateNodeStatusRequest
|
||||
(*UpdateNodeStatusResponse)(nil), // 17: pb.UpdateNodeStatusResponse
|
||||
(*SyncNodesVersionWithClusterRequest)(nil), // 18: pb.SyncNodesVersionWithClusterRequest
|
||||
(*SyncNodesVersionWithClusterResponse)(nil), // 19: pb.SyncNodesVersionWithClusterResponse
|
||||
(*NodeLogin)(nil), // 20: pb.NodeLogin
|
||||
(*Node)(nil), // 21: pb.Node
|
||||
}
|
||||
var file_service_node_proto_depIdxs = []int32{
|
||||
12, // 0: pb.CreateNodeRequest.Login:type_name -> pb.NodeLogin
|
||||
13, // 1: pb.ListEnabledNodesResponse.nodes:type_name -> pb.Node
|
||||
12, // 2: pb.UpdateNodeRequest.Login:type_name -> pb.NodeLogin
|
||||
13, // 3: pb.FindEnabledNodeResponse.node:type_name -> pb.Node
|
||||
20, // 0: pb.CreateNodeRequest.Login:type_name -> pb.NodeLogin
|
||||
21, // 1: pb.ListEnabledNodesResponse.nodes:type_name -> pb.Node
|
||||
20, // 2: pb.UpdateNodeRequest.Login:type_name -> pb.NodeLogin
|
||||
21, // 3: pb.FindEnabledNodeResponse.node:type_name -> pb.Node
|
||||
0, // 4: pb.NodeService.createNode:input_type -> pb.CreateNodeRequest
|
||||
2, // 5: pb.NodeService.countAllEnabledNodes:input_type -> pb.CountAllEnabledNodesRequest
|
||||
4, // 6: pb.NodeService.listEnabledNodes:input_type -> pb.ListEnabledNodesRequest
|
||||
6, // 7: pb.NodeService.disableNode:input_type -> pb.DisableNodeRequest
|
||||
8, // 8: pb.NodeService.updateNode:input_type -> pb.UpdateNodeRequest
|
||||
10, // 9: pb.NodeService.findEnabledNode:input_type -> pb.FindEnabledNodeRequest
|
||||
1, // 10: pb.NodeService.createNode:output_type -> pb.CreateNodeResponse
|
||||
3, // 11: pb.NodeService.countAllEnabledNodes:output_type -> pb.CountAllEnabledNodesResponse
|
||||
5, // 12: pb.NodeService.listEnabledNodes:output_type -> pb.ListEnabledNodesResponse
|
||||
7, // 13: pb.NodeService.disableNode:output_type -> pb.DisableNodeResponse
|
||||
9, // 14: pb.NodeService.updateNode:output_type -> pb.UpdateNodeResponse
|
||||
11, // 15: pb.NodeService.findEnabledNode:output_type -> pb.FindEnabledNodeResponse
|
||||
10, // [10:16] is the sub-list for method output_type
|
||||
4, // [4:10] is the sub-list for method input_type
|
||||
12, // 10: pb.NodeService.composeNodeConfig:input_type -> pb.ComposeNodeConfigRequest
|
||||
14, // 11: pb.NodeService.nodeStream:input_type -> pb.NodeStreamRequest
|
||||
16, // 12: pb.NodeService.updateNodeStatus:input_type -> pb.UpdateNodeStatusRequest
|
||||
18, // 13: pb.NodeService.syncNodesVersionWithCluster:input_type -> pb.SyncNodesVersionWithClusterRequest
|
||||
1, // 14: pb.NodeService.createNode:output_type -> pb.CreateNodeResponse
|
||||
3, // 15: pb.NodeService.countAllEnabledNodes:output_type -> pb.CountAllEnabledNodesResponse
|
||||
5, // 16: pb.NodeService.listEnabledNodes:output_type -> pb.ListEnabledNodesResponse
|
||||
7, // 17: pb.NodeService.disableNode:output_type -> pb.DisableNodeResponse
|
||||
9, // 18: pb.NodeService.updateNode:output_type -> pb.UpdateNodeResponse
|
||||
11, // 19: pb.NodeService.findEnabledNode:output_type -> pb.FindEnabledNodeResponse
|
||||
13, // 20: pb.NodeService.composeNodeConfig:output_type -> pb.ComposeNodeConfigResponse
|
||||
15, // 21: pb.NodeService.nodeStream:output_type -> pb.NodeStreamResponse
|
||||
17, // 22: pb.NodeService.updateNodeStatus:output_type -> pb.UpdateNodeStatusResponse
|
||||
19, // 23: pb.NodeService.syncNodesVersionWithCluster:output_type -> pb.SyncNodesVersionWithClusterResponse
|
||||
14, // [14:24] is the sub-list for method output_type
|
||||
4, // [4:14] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
@@ -907,6 +1309,102 @@ func file_service_node_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ComposeNodeConfigRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ComposeNodeConfigResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeStreamRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NodeStreamResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateNodeStatusRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UpdateNodeStatusResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SyncNodesVersionWithClusterRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SyncNodesVersionWithClusterResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -914,7 +1412,7 @@ func file_service_node_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_node_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 12,
|
||||
NumMessages: 20,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
@@ -952,6 +1450,14 @@ type NodeServiceClient interface {
|
||||
UpdateNode(ctx context.Context, in *UpdateNodeRequest, opts ...grpc.CallOption) (*UpdateNodeResponse, error)
|
||||
// 查看单个节点
|
||||
FindEnabledNode(ctx context.Context, in *FindEnabledNodeRequest, opts ...grpc.CallOption) (*FindEnabledNodeResponse, error)
|
||||
// 组合单个节点配置
|
||||
ComposeNodeConfig(ctx context.Context, in *ComposeNodeConfigRequest, opts ...grpc.CallOption) (*ComposeNodeConfigResponse, error)
|
||||
// 节点stream
|
||||
NodeStream(ctx context.Context, opts ...grpc.CallOption) (NodeService_NodeStreamClient, error)
|
||||
// 更新节点状态
|
||||
UpdateNodeStatus(ctx context.Context, in *UpdateNodeStatusRequest, opts ...grpc.CallOption) (*UpdateNodeStatusResponse, error)
|
||||
// 同步集群中的节点版本
|
||||
SyncNodesVersionWithCluster(ctx context.Context, in *SyncNodesVersionWithClusterRequest, opts ...grpc.CallOption) (*SyncNodesVersionWithClusterResponse, error)
|
||||
}
|
||||
|
||||
type nodeServiceClient struct {
|
||||
@@ -1016,6 +1522,64 @@ func (c *nodeServiceClient) FindEnabledNode(ctx context.Context, in *FindEnabled
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeServiceClient) ComposeNodeConfig(ctx context.Context, in *ComposeNodeConfigRequest, opts ...grpc.CallOption) (*ComposeNodeConfigResponse, error) {
|
||||
out := new(ComposeNodeConfigResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeService/composeNodeConfig", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeServiceClient) NodeStream(ctx context.Context, opts ...grpc.CallOption) (NodeService_NodeStreamClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_NodeService_serviceDesc.Streams[0], "/pb.NodeService/nodeStream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &nodeServiceNodeStreamClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type NodeService_NodeStreamClient interface {
|
||||
Send(*NodeStreamRequest) error
|
||||
Recv() (*NodeStreamResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type nodeServiceNodeStreamClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *nodeServiceNodeStreamClient) Send(m *NodeStreamRequest) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *nodeServiceNodeStreamClient) Recv() (*NodeStreamResponse, error) {
|
||||
m := new(NodeStreamResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *nodeServiceClient) UpdateNodeStatus(ctx context.Context, in *UpdateNodeStatusRequest, opts ...grpc.CallOption) (*UpdateNodeStatusResponse, error) {
|
||||
out := new(UpdateNodeStatusResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeService/updateNodeStatus", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeServiceClient) SyncNodesVersionWithCluster(ctx context.Context, in *SyncNodesVersionWithClusterRequest, opts ...grpc.CallOption) (*SyncNodesVersionWithClusterResponse, error) {
|
||||
out := new(SyncNodesVersionWithClusterResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeService/syncNodesVersionWithCluster", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NodeServiceServer is the server API for NodeService service.
|
||||
type NodeServiceServer interface {
|
||||
// 创建节点
|
||||
@@ -1030,6 +1594,14 @@ type NodeServiceServer interface {
|
||||
UpdateNode(context.Context, *UpdateNodeRequest) (*UpdateNodeResponse, error)
|
||||
// 查看单个节点
|
||||
FindEnabledNode(context.Context, *FindEnabledNodeRequest) (*FindEnabledNodeResponse, error)
|
||||
// 组合单个节点配置
|
||||
ComposeNodeConfig(context.Context, *ComposeNodeConfigRequest) (*ComposeNodeConfigResponse, error)
|
||||
// 节点stream
|
||||
NodeStream(NodeService_NodeStreamServer) error
|
||||
// 更新节点状态
|
||||
UpdateNodeStatus(context.Context, *UpdateNodeStatusRequest) (*UpdateNodeStatusResponse, error)
|
||||
// 同步集群中的节点版本
|
||||
SyncNodesVersionWithCluster(context.Context, *SyncNodesVersionWithClusterRequest) (*SyncNodesVersionWithClusterResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedNodeServiceServer can be embedded to have forward compatible implementations.
|
||||
@@ -1054,6 +1626,18 @@ func (*UnimplementedNodeServiceServer) UpdateNode(context.Context, *UpdateNodeRe
|
||||
func (*UnimplementedNodeServiceServer) FindEnabledNode(context.Context, *FindEnabledNodeRequest) (*FindEnabledNodeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledNode not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeServiceServer) ComposeNodeConfig(context.Context, *ComposeNodeConfigRequest) (*ComposeNodeConfigResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ComposeNodeConfig not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeServiceServer) NodeStream(NodeService_NodeStreamServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method NodeStream not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeServiceServer) UpdateNodeStatus(context.Context, *UpdateNodeStatusRequest) (*UpdateNodeStatusResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeStatus not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeServiceServer) SyncNodesVersionWithCluster(context.Context, *SyncNodesVersionWithClusterRequest) (*SyncNodesVersionWithClusterResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SyncNodesVersionWithCluster not implemented")
|
||||
}
|
||||
|
||||
func RegisterNodeServiceServer(s *grpc.Server, srv NodeServiceServer) {
|
||||
s.RegisterService(&_NodeService_serviceDesc, srv)
|
||||
@@ -1167,6 +1751,86 @@ func _NodeService_FindEnabledNode_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeService_ComposeNodeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ComposeNodeConfigRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeServiceServer).ComposeNodeConfig(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeService/ComposeNodeConfig",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeServiceServer).ComposeNodeConfig(ctx, req.(*ComposeNodeConfigRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeService_NodeStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(NodeServiceServer).NodeStream(&nodeServiceNodeStreamServer{stream})
|
||||
}
|
||||
|
||||
type NodeService_NodeStreamServer interface {
|
||||
Send(*NodeStreamResponse) error
|
||||
Recv() (*NodeStreamRequest, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type nodeServiceNodeStreamServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *nodeServiceNodeStreamServer) Send(m *NodeStreamResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *nodeServiceNodeStreamServer) Recv() (*NodeStreamRequest, error) {
|
||||
m := new(NodeStreamRequest)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _NodeService_UpdateNodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateNodeStatusRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeServiceServer).UpdateNodeStatus(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeService/UpdateNodeStatus",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeServiceServer).UpdateNodeStatus(ctx, req.(*UpdateNodeStatusRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeService_SyncNodesVersionWithCluster_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SyncNodesVersionWithClusterRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeServiceServer).SyncNodesVersionWithCluster(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeService/SyncNodesVersionWithCluster",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeServiceServer).SyncNodesVersionWithCluster(ctx, req.(*SyncNodesVersionWithClusterRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _NodeService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.NodeService",
|
||||
HandlerType: (*NodeServiceServer)(nil),
|
||||
@@ -1195,7 +1859,26 @@ var _NodeService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "findEnabledNode",
|
||||
Handler: _NodeService_FindEnabledNode_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "composeNodeConfig",
|
||||
Handler: _NodeService_ComposeNodeConfig_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "updateNodeStatus",
|
||||
Handler: _NodeService_UpdateNodeStatus_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "syncNodesVersionWithCluster",
|
||||
Handler: _NodeService_SyncNodesVersionWithCluster_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "nodeStream",
|
||||
Handler: _NodeService_NodeStream_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_node.proto",
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ const (
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
// 获取所有集群的信息
|
||||
type FindAllEnabledNodeClustersRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -114,6 +115,92 @@ func (x *FindAllEnabledNodeClustersResponse) GetClusters() []*NodeCluster {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取变更的集群
|
||||
type FindAllChangedClustersRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *FindAllChangedClustersRequest) Reset() {
|
||||
*x = FindAllChangedClustersRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_cluster_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindAllChangedClustersRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindAllChangedClustersRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FindAllChangedClustersRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_cluster_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindAllChangedClustersRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FindAllChangedClustersRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_cluster_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type FindAllChangedClustersResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Clusters []*NodeCluster `protobuf:"bytes,1,rep,name=clusters,proto3" json:"clusters,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindAllChangedClustersResponse) Reset() {
|
||||
*x = FindAllChangedClustersResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_node_cluster_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindAllChangedClustersResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindAllChangedClustersResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FindAllChangedClustersResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_node_cluster_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindAllChangedClustersResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FindAllChangedClustersResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_node_cluster_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *FindAllChangedClustersResponse) GetClusters() []*NodeCluster {
|
||||
if x != nil {
|
||||
return x.Clusters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_service_node_cluster_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_node_cluster_proto_rawDesc = []byte{
|
||||
@@ -128,16 +215,29 @@ var file_service_node_cluster_proto_rawDesc = []byte{
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x73, 0x32, 0x7d, 0x0a, 0x12, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x16, 0x66, 0x69, 0x6e, 0x64,
|
||||
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45,
|
||||
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x62, 0x2e, 0x46,
|
||||
0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x72, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x22, 0x4d, 0x0a, 0x1e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68,
|
||||
0x61, 0x6e, 0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x73, 0x32, 0xde, 0x01, 0x0a, 0x12, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x16, 0x66, 0x69, 0x6e,
|
||||
0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c,
|
||||
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x70,
|
||||
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64,
|
||||
0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -152,21 +252,26 @@ func file_service_node_cluster_proto_rawDescGZIP() []byte {
|
||||
return file_service_node_cluster_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_service_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_service_node_cluster_proto_goTypes = []interface{}{
|
||||
(*FindAllEnabledNodeClustersRequest)(nil), // 0: pb.FindAllEnabledNodeClustersRequest
|
||||
(*FindAllEnabledNodeClustersResponse)(nil), // 1: pb.FindAllEnabledNodeClustersResponse
|
||||
(*NodeCluster)(nil), // 2: pb.NodeCluster
|
||||
(*FindAllChangedClustersRequest)(nil), // 2: pb.FindAllChangedClustersRequest
|
||||
(*FindAllChangedClustersResponse)(nil), // 3: pb.FindAllChangedClustersResponse
|
||||
(*NodeCluster)(nil), // 4: pb.NodeCluster
|
||||
}
|
||||
var file_service_node_cluster_proto_depIdxs = []int32{
|
||||
2, // 0: pb.FindAllEnabledNodeClustersResponse.clusters:type_name -> pb.NodeCluster
|
||||
0, // 1: pb.NodeClusterService.findAllEnabledClusters:input_type -> pb.FindAllEnabledNodeClustersRequest
|
||||
1, // 2: pb.NodeClusterService.findAllEnabledClusters:output_type -> pb.FindAllEnabledNodeClustersResponse
|
||||
2, // [2:3] is the sub-list for method output_type
|
||||
1, // [1:2] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
4, // 0: pb.FindAllEnabledNodeClustersResponse.clusters:type_name -> pb.NodeCluster
|
||||
4, // 1: pb.FindAllChangedClustersResponse.clusters:type_name -> pb.NodeCluster
|
||||
0, // 2: pb.NodeClusterService.findAllEnabledClusters:input_type -> pb.FindAllEnabledNodeClustersRequest
|
||||
2, // 3: pb.NodeClusterService.findAllChangedClusters:input_type -> pb.FindAllChangedClustersRequest
|
||||
1, // 4: pb.NodeClusterService.findAllEnabledClusters:output_type -> pb.FindAllEnabledNodeClustersResponse
|
||||
3, // 5: pb.NodeClusterService.findAllChangedClusters:output_type -> pb.FindAllChangedClustersResponse
|
||||
4, // [4:6] is the sub-list for method output_type
|
||||
2, // [2:4] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_node_cluster_proto_init() }
|
||||
@@ -200,6 +305,30 @@ func file_service_node_cluster_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_cluster_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindAllChangedClustersRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_node_cluster_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindAllChangedClustersResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -207,7 +336,7 @@ func file_service_node_cluster_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_node_cluster_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
@@ -235,6 +364,8 @@ const _ = grpc.SupportPackageIsVersion6
|
||||
type NodeClusterServiceClient interface {
|
||||
// 获取所有集群的信息
|
||||
FindAllEnabledClusters(ctx context.Context, in *FindAllEnabledNodeClustersRequest, opts ...grpc.CallOption) (*FindAllEnabledNodeClustersResponse, error)
|
||||
// 获取变更的集群
|
||||
FindAllChangedClusters(ctx context.Context, in *FindAllChangedClustersRequest, opts ...grpc.CallOption) (*FindAllChangedClustersResponse, error)
|
||||
}
|
||||
|
||||
type nodeClusterServiceClient struct {
|
||||
@@ -254,10 +385,21 @@ func (c *nodeClusterServiceClient) FindAllEnabledClusters(ctx context.Context, i
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *nodeClusterServiceClient) FindAllChangedClusters(ctx context.Context, in *FindAllChangedClustersRequest, opts ...grpc.CallOption) (*FindAllChangedClustersResponse, error) {
|
||||
out := new(FindAllChangedClustersResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.NodeClusterService/findAllChangedClusters", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NodeClusterServiceServer is the server API for NodeClusterService service.
|
||||
type NodeClusterServiceServer interface {
|
||||
// 获取所有集群的信息
|
||||
FindAllEnabledClusters(context.Context, *FindAllEnabledNodeClustersRequest) (*FindAllEnabledNodeClustersResponse, error)
|
||||
// 获取变更的集群
|
||||
FindAllChangedClusters(context.Context, *FindAllChangedClustersRequest) (*FindAllChangedClustersResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedNodeClusterServiceServer can be embedded to have forward compatible implementations.
|
||||
@@ -267,6 +409,9 @@ type UnimplementedNodeClusterServiceServer struct {
|
||||
func (*UnimplementedNodeClusterServiceServer) FindAllEnabledClusters(context.Context, *FindAllEnabledNodeClustersRequest) (*FindAllEnabledNodeClustersResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledClusters not implemented")
|
||||
}
|
||||
func (*UnimplementedNodeClusterServiceServer) FindAllChangedClusters(context.Context, *FindAllChangedClustersRequest) (*FindAllChangedClustersResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindAllChangedClusters not implemented")
|
||||
}
|
||||
|
||||
func RegisterNodeClusterServiceServer(s *grpc.Server, srv NodeClusterServiceServer) {
|
||||
s.RegisterService(&_NodeClusterService_serviceDesc, srv)
|
||||
@@ -290,6 +435,24 @@ func _NodeClusterService_FindAllEnabledClusters_Handler(srv interface{}, ctx con
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _NodeClusterService_FindAllChangedClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FindAllChangedClustersRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodeClusterServiceServer).FindAllChangedClusters(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.NodeClusterService/FindAllChangedClusters",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodeClusterServiceServer).FindAllChangedClusters(ctx, req.(*FindAllChangedClustersRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _NodeClusterService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.NodeClusterService",
|
||||
HandlerType: (*NodeClusterServiceServer)(nil),
|
||||
@@ -298,6 +461,10 @@ var _NodeClusterService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "findAllEnabledClusters",
|
||||
Handler: _NodeClusterService_FindAllEnabledClusters_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "findAllChangedClusters",
|
||||
Handler: _NodeClusterService_FindAllChangedClusters_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_node_cluster.proto",
|
||||
|
||||
@@ -164,6 +164,140 @@ func (x *CreateServerResponse) GetServerId() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 修改服务
|
||||
type UpdateServerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
|
||||
UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||
AdminId int64 `protobuf:"varint,3,opt,name=adminId,proto3" json:"adminId,omitempty"`
|
||||
ClusterId int64 `protobuf:"varint,4,opt,name=clusterId,proto3" json:"clusterId,omitempty"`
|
||||
Config []byte `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"`
|
||||
IncludeNodesJSON []byte `protobuf:"bytes,6,opt,name=includeNodesJSON,proto3" json:"includeNodesJSON,omitempty"`
|
||||
ExcludeNodesJSON []byte `protobuf:"bytes,7,opt,name=excludeNodesJSON,proto3" json:"excludeNodesJSON,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) Reset() {
|
||||
*x = UpdateServerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateServerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateServerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateServerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateServerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetServerId() int64 {
|
||||
if x != nil {
|
||||
return x.ServerId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetUserId() int64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetAdminId() int64 {
|
||||
if x != nil {
|
||||
return x.AdminId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetClusterId() int64 {
|
||||
if x != nil {
|
||||
return x.ClusterId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetConfig() []byte {
|
||||
if x != nil {
|
||||
return x.Config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetIncludeNodesJSON() []byte {
|
||||
if x != nil {
|
||||
return x.IncludeNodesJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateServerRequest) GetExcludeNodesJSON() []byte {
|
||||
if x != nil {
|
||||
return x.ExcludeNodesJSON
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateServerResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *UpdateServerResponse) Reset() {
|
||||
*x = UpdateServerResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UpdateServerResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UpdateServerResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UpdateServerResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UpdateServerResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UpdateServerResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
// 计算服务数量
|
||||
type CountAllEnabledServersRequest struct {
|
||||
state protoimpl.MessageState
|
||||
@@ -174,7 +308,7 @@ type CountAllEnabledServersRequest struct {
|
||||
func (x *CountAllEnabledServersRequest) Reset() {
|
||||
*x = CountAllEnabledServersRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[2]
|
||||
mi := &file_service_server_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -187,7 +321,7 @@ func (x *CountAllEnabledServersRequest) String() string {
|
||||
func (*CountAllEnabledServersRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CountAllEnabledServersRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[2]
|
||||
mi := &file_service_server_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -200,7 +334,7 @@ func (x *CountAllEnabledServersRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CountAllEnabledServersRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CountAllEnabledServersRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{2}
|
||||
return file_service_server_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type CountAllEnabledServersResponse struct {
|
||||
@@ -214,7 +348,7 @@ type CountAllEnabledServersResponse struct {
|
||||
func (x *CountAllEnabledServersResponse) Reset() {
|
||||
*x = CountAllEnabledServersResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[3]
|
||||
mi := &file_service_server_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -227,7 +361,7 @@ func (x *CountAllEnabledServersResponse) String() string {
|
||||
func (*CountAllEnabledServersResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CountAllEnabledServersResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[3]
|
||||
mi := &file_service_server_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -240,7 +374,7 @@ func (x *CountAllEnabledServersResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CountAllEnabledServersResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CountAllEnabledServersResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{3}
|
||||
return file_service_server_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *CountAllEnabledServersResponse) GetCount() int64 {
|
||||
@@ -263,7 +397,7 @@ type ListEnabledServersRequest struct {
|
||||
func (x *ListEnabledServersRequest) Reset() {
|
||||
*x = ListEnabledServersRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[4]
|
||||
mi := &file_service_server_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -276,7 +410,7 @@ func (x *ListEnabledServersRequest) String() string {
|
||||
func (*ListEnabledServersRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListEnabledServersRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[4]
|
||||
mi := &file_service_server_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -289,7 +423,7 @@ func (x *ListEnabledServersRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ListEnabledServersRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListEnabledServersRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{4}
|
||||
return file_service_server_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *ListEnabledServersRequest) GetOffset() int64 {
|
||||
@@ -317,7 +451,7 @@ type ListEnabledServersResponse struct {
|
||||
func (x *ListEnabledServersResponse) Reset() {
|
||||
*x = ListEnabledServersResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[5]
|
||||
mi := &file_service_server_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -330,7 +464,7 @@ func (x *ListEnabledServersResponse) String() string {
|
||||
func (*ListEnabledServersResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListEnabledServersResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[5]
|
||||
mi := &file_service_server_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -343,7 +477,7 @@ func (x *ListEnabledServersResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ListEnabledServersResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListEnabledServersResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{5}
|
||||
return file_service_server_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *ListEnabledServersResponse) GetServers() []*Server {
|
||||
@@ -353,6 +487,187 @@ func (x *ListEnabledServersResponse) GetServers() []*Server {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 禁用服务
|
||||
type DisableServerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DisableServerRequest) Reset() {
|
||||
*x = DisableServerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DisableServerRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DisableServerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DisableServerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DisableServerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DisableServerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *DisableServerRequest) GetServerId() int64 {
|
||||
if x != nil {
|
||||
return x.ServerId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DisableServerResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *DisableServerResponse) Reset() {
|
||||
*x = DisableServerResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DisableServerResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DisableServerResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DisableServerResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DisableServerResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DisableServerResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
// 查找单个服务
|
||||
type FindEnabledServerRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindEnabledServerRequest) Reset() {
|
||||
*x = FindEnabledServerRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindEnabledServerRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindEnabledServerRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FindEnabledServerRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindEnabledServerRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FindEnabledServerRequest) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *FindEnabledServerRequest) GetServerId() int64 {
|
||||
if x != nil {
|
||||
return x.ServerId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FindEnabledServerResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Server *Server `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FindEnabledServerResponse) Reset() {
|
||||
*x = FindEnabledServerResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_server_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FindEnabledServerResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FindEnabledServerResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FindEnabledServerResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_server_proto_msgTypes[11]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FindEnabledServerResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FindEnabledServerResponse) Descriptor() ([]byte, []int) {
|
||||
return file_service_server_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *FindEnabledServerResponse) GetServer() *Server {
|
||||
if x != nil {
|
||||
return x.Server
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_service_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_server_proto_rawDesc = []byte{
|
||||
@@ -375,39 +690,82 @@ var file_service_server_proto_rawDesc = []byte{
|
||||
0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x32, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x43, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x1e, 0x43,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x22, 0x47, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x42, 0x0a, 0x1a,
|
||||
0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x73, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
|
||||
0x32, 0x88, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c,
|
||||
0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12,
|
||||
0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c,
|
||||
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0xf1, 0x01, 0x0a, 0x13, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
|
||||
0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64,
|
||||
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x52, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53,
|
||||
0x4f, 0x4e, 0x12, 0x2a, 0x0a, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x65, 0x78,
|
||||
0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x16,
|
||||
0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41,
|
||||
0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x1e, 0x43, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22,
|
||||
0x47, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66,
|
||||
0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x42, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x2e, 0x70,
|
||||
0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x32, 0x0a, 0x14,
|
||||
0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64,
|
||||
0x22, 0x17, 0x0a, 0x15, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x0a, 0x18, 0x46, 0x69, 0x6e,
|
||||
0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49,
|
||||
0x64, 0x22, 0x3f, 0x0a, 0x19, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
|
||||
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22,
|
||||
0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x32, 0xe3, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41,
|
||||
0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c,
|
||||
0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c,
|
||||
0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x44, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46,
|
||||
0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -422,29 +780,42 @@ func file_service_server_proto_rawDescGZIP() []byte {
|
||||
return file_service_server_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_server_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_service_server_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||
var file_service_server_proto_goTypes = []interface{}{
|
||||
(*CreateServerRequest)(nil), // 0: pb.CreateServerRequest
|
||||
(*CreateServerResponse)(nil), // 1: pb.CreateServerResponse
|
||||
(*CountAllEnabledServersRequest)(nil), // 2: pb.CountAllEnabledServersRequest
|
||||
(*CountAllEnabledServersResponse)(nil), // 3: pb.CountAllEnabledServersResponse
|
||||
(*ListEnabledServersRequest)(nil), // 4: pb.ListEnabledServersRequest
|
||||
(*ListEnabledServersResponse)(nil), // 5: pb.ListEnabledServersResponse
|
||||
(*Server)(nil), // 6: pb.Server
|
||||
(*UpdateServerRequest)(nil), // 2: pb.UpdateServerRequest
|
||||
(*UpdateServerResponse)(nil), // 3: pb.UpdateServerResponse
|
||||
(*CountAllEnabledServersRequest)(nil), // 4: pb.CountAllEnabledServersRequest
|
||||
(*CountAllEnabledServersResponse)(nil), // 5: pb.CountAllEnabledServersResponse
|
||||
(*ListEnabledServersRequest)(nil), // 6: pb.ListEnabledServersRequest
|
||||
(*ListEnabledServersResponse)(nil), // 7: pb.ListEnabledServersResponse
|
||||
(*DisableServerRequest)(nil), // 8: pb.DisableServerRequest
|
||||
(*DisableServerResponse)(nil), // 9: pb.DisableServerResponse
|
||||
(*FindEnabledServerRequest)(nil), // 10: pb.FindEnabledServerRequest
|
||||
(*FindEnabledServerResponse)(nil), // 11: pb.FindEnabledServerResponse
|
||||
(*Server)(nil), // 12: pb.Server
|
||||
}
|
||||
var file_service_server_proto_depIdxs = []int32{
|
||||
6, // 0: pb.ListEnabledServersResponse.servers:type_name -> pb.Server
|
||||
0, // 1: pb.ServerService.createServer:input_type -> pb.CreateServerRequest
|
||||
2, // 2: pb.ServerService.countAllEnabledServers:input_type -> pb.CountAllEnabledServersRequest
|
||||
4, // 3: pb.ServerService.listEnabledServers:input_type -> pb.ListEnabledServersRequest
|
||||
1, // 4: pb.ServerService.createServer:output_type -> pb.CreateServerResponse
|
||||
3, // 5: pb.ServerService.countAllEnabledServers:output_type -> pb.CountAllEnabledServersResponse
|
||||
5, // 6: pb.ServerService.listEnabledServers:output_type -> pb.ListEnabledServersResponse
|
||||
4, // [4:7] is the sub-list for method output_type
|
||||
1, // [1:4] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
12, // 0: pb.ListEnabledServersResponse.servers:type_name -> pb.Server
|
||||
12, // 1: pb.FindEnabledServerResponse.server:type_name -> pb.Server
|
||||
0, // 2: pb.ServerService.createServer:input_type -> pb.CreateServerRequest
|
||||
2, // 3: pb.ServerService.updateServer:input_type -> pb.UpdateServerRequest
|
||||
4, // 4: pb.ServerService.countAllEnabledServers:input_type -> pb.CountAllEnabledServersRequest
|
||||
6, // 5: pb.ServerService.listEnabledServers:input_type -> pb.ListEnabledServersRequest
|
||||
8, // 6: pb.ServerService.disableServer:input_type -> pb.DisableServerRequest
|
||||
10, // 7: pb.ServerService.findEnabledServer:input_type -> pb.FindEnabledServerRequest
|
||||
1, // 8: pb.ServerService.createServer:output_type -> pb.CreateServerResponse
|
||||
3, // 9: pb.ServerService.updateServer:output_type -> pb.UpdateServerResponse
|
||||
5, // 10: pb.ServerService.countAllEnabledServers:output_type -> pb.CountAllEnabledServersResponse
|
||||
7, // 11: pb.ServerService.listEnabledServers:output_type -> pb.ListEnabledServersResponse
|
||||
9, // 12: pb.ServerService.disableServer:output_type -> pb.DisableServerResponse
|
||||
11, // 13: pb.ServerService.findEnabledServer:output_type -> pb.FindEnabledServerResponse
|
||||
8, // [8:14] is the sub-list for method output_type
|
||||
2, // [2:8] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_server_proto_init() }
|
||||
@@ -479,7 +850,7 @@ func file_service_server_proto_init() {
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CountAllEnabledServersRequest); i {
|
||||
switch v := v.(*UpdateServerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -491,7 +862,7 @@ func file_service_server_proto_init() {
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CountAllEnabledServersResponse); i {
|
||||
switch v := v.(*UpdateServerResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -503,7 +874,7 @@ func file_service_server_proto_init() {
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListEnabledServersRequest); i {
|
||||
switch v := v.(*CountAllEnabledServersRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -515,6 +886,30 @@ func file_service_server_proto_init() {
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CountAllEnabledServersResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListEnabledServersRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListEnabledServersResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -526,6 +921,54 @@ func file_service_server_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DisableServerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DisableServerResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindEnabledServerRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FindEnabledServerResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -533,7 +976,7 @@ func file_service_server_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_server_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumMessages: 12,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
@@ -561,10 +1004,16 @@ const _ = grpc.SupportPackageIsVersion6
|
||||
type ServerServiceClient interface {
|
||||
// 创建服务
|
||||
CreateServer(ctx context.Context, in *CreateServerRequest, opts ...grpc.CallOption) (*CreateServerResponse, error)
|
||||
// 修改服务
|
||||
UpdateServer(ctx context.Context, in *UpdateServerRequest, opts ...grpc.CallOption) (*UpdateServerResponse, error)
|
||||
// 计算服务数量
|
||||
CountAllEnabledServers(ctx context.Context, in *CountAllEnabledServersRequest, opts ...grpc.CallOption) (*CountAllEnabledServersResponse, error)
|
||||
// 列出单页服务
|
||||
ListEnabledServers(ctx context.Context, in *ListEnabledServersRequest, opts ...grpc.CallOption) (*ListEnabledServersResponse, error)
|
||||
// 禁用某服务
|
||||
DisableServer(ctx context.Context, in *DisableServerRequest, opts ...grpc.CallOption) (*DisableServerResponse, error)
|
||||
// 查找单个服务
|
||||
FindEnabledServer(ctx context.Context, in *FindEnabledServerRequest, opts ...grpc.CallOption) (*FindEnabledServerResponse, error)
|
||||
}
|
||||
|
||||
type serverServiceClient struct {
|
||||
@@ -584,6 +1033,15 @@ func (c *serverServiceClient) CreateServer(ctx context.Context, in *CreateServer
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) UpdateServer(ctx context.Context, in *UpdateServerRequest, opts ...grpc.CallOption) (*UpdateServerResponse, error) {
|
||||
out := new(UpdateServerResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.ServerService/updateServer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) CountAllEnabledServers(ctx context.Context, in *CountAllEnabledServersRequest, opts ...grpc.CallOption) (*CountAllEnabledServersResponse, error) {
|
||||
out := new(CountAllEnabledServersResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.ServerService/countAllEnabledServers", in, out, opts...)
|
||||
@@ -602,14 +1060,38 @@ func (c *serverServiceClient) ListEnabledServers(ctx context.Context, in *ListEn
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) DisableServer(ctx context.Context, in *DisableServerRequest, opts ...grpc.CallOption) (*DisableServerResponse, error) {
|
||||
out := new(DisableServerResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.ServerService/disableServer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) FindEnabledServer(ctx context.Context, in *FindEnabledServerRequest, opts ...grpc.CallOption) (*FindEnabledServerResponse, error) {
|
||||
out := new(FindEnabledServerResponse)
|
||||
err := c.cc.Invoke(ctx, "/pb.ServerService/findEnabledServer", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ServerServiceServer is the server API for ServerService service.
|
||||
type ServerServiceServer interface {
|
||||
// 创建服务
|
||||
CreateServer(context.Context, *CreateServerRequest) (*CreateServerResponse, error)
|
||||
// 修改服务
|
||||
UpdateServer(context.Context, *UpdateServerRequest) (*UpdateServerResponse, error)
|
||||
// 计算服务数量
|
||||
CountAllEnabledServers(context.Context, *CountAllEnabledServersRequest) (*CountAllEnabledServersResponse, error)
|
||||
// 列出单页服务
|
||||
ListEnabledServers(context.Context, *ListEnabledServersRequest) (*ListEnabledServersResponse, error)
|
||||
// 禁用某服务
|
||||
DisableServer(context.Context, *DisableServerRequest) (*DisableServerResponse, error)
|
||||
// 查找单个服务
|
||||
FindEnabledServer(context.Context, *FindEnabledServerRequest) (*FindEnabledServerResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedServerServiceServer can be embedded to have forward compatible implementations.
|
||||
@@ -619,12 +1101,21 @@ type UnimplementedServerServiceServer struct {
|
||||
func (*UnimplementedServerServiceServer) CreateServer(context.Context, *CreateServerRequest) (*CreateServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateServer not implemented")
|
||||
}
|
||||
func (*UnimplementedServerServiceServer) UpdateServer(context.Context, *UpdateServerRequest) (*UpdateServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateServer not implemented")
|
||||
}
|
||||
func (*UnimplementedServerServiceServer) CountAllEnabledServers(context.Context, *CountAllEnabledServersRequest) (*CountAllEnabledServersResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledServers not implemented")
|
||||
}
|
||||
func (*UnimplementedServerServiceServer) ListEnabledServers(context.Context, *ListEnabledServersRequest) (*ListEnabledServersResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListEnabledServers not implemented")
|
||||
}
|
||||
func (*UnimplementedServerServiceServer) DisableServer(context.Context, *DisableServerRequest) (*DisableServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DisableServer not implemented")
|
||||
}
|
||||
func (*UnimplementedServerServiceServer) FindEnabledServer(context.Context, *FindEnabledServerRequest) (*FindEnabledServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledServer not implemented")
|
||||
}
|
||||
|
||||
func RegisterServerServiceServer(s *grpc.Server, srv ServerServiceServer) {
|
||||
s.RegisterService(&_ServerService_serviceDesc, srv)
|
||||
@@ -648,6 +1139,24 @@ func _ServerService_CreateServer_Handler(srv interface{}, ctx context.Context, d
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_UpdateServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateServerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServerServiceServer).UpdateServer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.ServerService/UpdateServer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServerServiceServer).UpdateServer(ctx, req.(*UpdateServerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_CountAllEnabledServers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CountAllEnabledServersRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -684,6 +1193,42 @@ func _ServerService_ListEnabledServers_Handler(srv interface{}, ctx context.Cont
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_DisableServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DisableServerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServerServiceServer).DisableServer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.ServerService/DisableServer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServerServiceServer).DisableServer(ctx, req.(*DisableServerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_FindEnabledServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FindEnabledServerRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServerServiceServer).FindEnabledServer(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pb.ServerService/FindEnabledServer",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServerServiceServer).FindEnabledServer(ctx, req.(*FindEnabledServerRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _ServerService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pb.ServerService",
|
||||
HandlerType: (*ServerServiceServer)(nil),
|
||||
@@ -692,6 +1237,10 @@ var _ServerService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "createServer",
|
||||
Handler: _ServerService_CreateServer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "updateServer",
|
||||
Handler: _ServerService_UpdateServer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "countAllEnabledServers",
|
||||
Handler: _ServerService_CountAllEnabledServers_Handler,
|
||||
@@ -700,6 +1249,14 @@ var _ServerService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "listEnabledServers",
|
||||
Handler: _ServerService_ListEnabledServers_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "disableServer",
|
||||
Handler: _ServerService_DisableServer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "findEnabledServer",
|
||||
Handler: _ServerService_FindEnabledServer_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_server.proto",
|
||||
|
||||
@@ -9,6 +9,7 @@ import "model_node_login.proto";
|
||||
message Node {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string status = 3;
|
||||
|
||||
NodeCluster cluster = 32;
|
||||
NodeLogin login = 33;
|
||||
|
||||
@@ -23,6 +23,18 @@ service NodeService {
|
||||
|
||||
// 查看单个节点
|
||||
rpc findEnabledNode (FindEnabledNodeRequest) returns (FindEnabledNodeResponse);
|
||||
|
||||
// 组合单个节点配置
|
||||
rpc composeNodeConfig (ComposeNodeConfigRequest) returns (ComposeNodeConfigResponse);
|
||||
|
||||
// 节点stream
|
||||
rpc nodeStream (stream NodeStreamRequest) returns (stream NodeStreamResponse);
|
||||
|
||||
// 更新节点状态
|
||||
rpc updateNodeStatus (UpdateNodeStatusRequest) returns (UpdateNodeStatusResponse);
|
||||
|
||||
// 同步集群中的节点版本
|
||||
rpc syncNodesVersionWithCluster (SyncNodesVersionWithClusterRequest) returns (SyncNodesVersionWithClusterResponse);
|
||||
}
|
||||
|
||||
// 创建节点
|
||||
@@ -84,3 +96,39 @@ message FindEnabledNodeRequest {
|
||||
message FindEnabledNodeResponse {
|
||||
Node node = 1;
|
||||
}
|
||||
|
||||
// 组合单个节点配置
|
||||
message ComposeNodeConfigRequest {
|
||||
|
||||
}
|
||||
|
||||
message ComposeNodeConfigResponse {
|
||||
bytes configJSON = 1;
|
||||
}
|
||||
|
||||
// 节点stream
|
||||
message NodeStreamRequest {
|
||||
|
||||
}
|
||||
|
||||
message NodeStreamResponse {
|
||||
|
||||
}
|
||||
|
||||
// 更新节点状态
|
||||
message UpdateNodeStatusRequest {
|
||||
int64 nodeId = 1;
|
||||
bytes statusJSON = 2;
|
||||
}
|
||||
|
||||
message UpdateNodeStatusResponse {
|
||||
|
||||
}
|
||||
|
||||
// 同步集群中的节点版本
|
||||
message SyncNodesVersionWithClusterRequest {
|
||||
int64 clusterId = 1;
|
||||
}
|
||||
|
||||
message SyncNodesVersionWithClusterResponse {
|
||||
}
|
||||
@@ -7,8 +7,12 @@ import "model_node_cluster.proto";
|
||||
service NodeClusterService {
|
||||
// 获取所有集群的信息
|
||||
rpc findAllEnabledClusters (FindAllEnabledNodeClustersRequest) returns (FindAllEnabledNodeClustersResponse);
|
||||
|
||||
// 获取变更的集群
|
||||
rpc findAllChangedClusters (FindAllChangedClustersRequest) returns (FindAllChangedClustersResponse);
|
||||
}
|
||||
|
||||
// 获取所有集群的信息
|
||||
message FindAllEnabledNodeClustersRequest {
|
||||
|
||||
}
|
||||
@@ -16,3 +20,12 @@ message FindAllEnabledNodeClustersRequest {
|
||||
message FindAllEnabledNodeClustersResponse {
|
||||
repeated NodeCluster clusters = 1;
|
||||
}
|
||||
|
||||
// 获取变更的集群
|
||||
message FindAllChangedClustersRequest {
|
||||
|
||||
}
|
||||
|
||||
message FindAllChangedClustersResponse {
|
||||
repeated NodeCluster clusters = 1;
|
||||
}
|
||||
@@ -8,13 +8,21 @@ service ServerService {
|
||||
// 创建服务
|
||||
rpc createServer (CreateServerRequest) returns (CreateServerResponse);
|
||||
|
||||
// 修改服务
|
||||
rpc updateServer (UpdateServerRequest) returns (UpdateServerResponse);
|
||||
|
||||
// 计算服务数量
|
||||
rpc countAllEnabledServers (CountAllEnabledServersRequest) returns (CountAllEnabledServersResponse);
|
||||
|
||||
// 列出单页服务
|
||||
rpc listEnabledServers (ListEnabledServersRequest) returns (ListEnabledServersResponse);
|
||||
}
|
||||
|
||||
// 禁用某服务
|
||||
rpc disableServer (DisableServerRequest) returns (DisableServerResponse);
|
||||
|
||||
// 查找单个服务
|
||||
rpc findEnabledServer (FindEnabledServerRequest) returns (FindEnabledServerResponse);
|
||||
}
|
||||
|
||||
// 创建服务
|
||||
message CreateServerRequest {
|
||||
@@ -30,6 +38,21 @@ message CreateServerResponse {
|
||||
int64 serverId = 1;
|
||||
}
|
||||
|
||||
// 修改服务
|
||||
message UpdateServerRequest {
|
||||
int64 serverId = 1;
|
||||
int64 userId = 2;
|
||||
int64 adminId = 3;
|
||||
int64 clusterId = 4;
|
||||
bytes config = 5;
|
||||
bytes includeNodesJSON = 6;
|
||||
bytes excludeNodesJSON = 7;
|
||||
}
|
||||
|
||||
message UpdateServerResponse {
|
||||
|
||||
}
|
||||
|
||||
// 计算服务数量
|
||||
message CountAllEnabledServersRequest {
|
||||
|
||||
@@ -48,3 +71,21 @@ message ListEnabledServersRequest {
|
||||
message ListEnabledServersResponse {
|
||||
repeated Server servers = 1;
|
||||
}
|
||||
|
||||
// 禁用服务
|
||||
message DisableServerRequest {
|
||||
int64 serverId = 1;
|
||||
}
|
||||
|
||||
message DisableServerResponse {
|
||||
|
||||
}
|
||||
|
||||
// 查找单个服务
|
||||
message FindEnabledServerRequest {
|
||||
int64 serverId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledServerResponse {
|
||||
Server server = 1;
|
||||
}
|
||||
@@ -2,9 +2,13 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
|
||||
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type NodeService struct {
|
||||
@@ -68,6 +72,7 @@ func (this *NodeService) ListEnabledNodes(ctx context.Context, req *pb.ListEnabl
|
||||
result = append(result, &pb.Node{
|
||||
Id: int64(node.Id),
|
||||
Name: node.Name,
|
||||
Status: node.Status,
|
||||
Cluster: &pb.NodeCluster{
|
||||
Id: int64(node.ClusterId),
|
||||
Name: clusterName,
|
||||
@@ -168,6 +173,7 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
|
||||
return &pb.FindEnabledNodeResponse{Node: &pb.Node{
|
||||
Id: int64(node.Id),
|
||||
Name: node.Name,
|
||||
Status: node.Status,
|
||||
Cluster: &pb.NodeCluster{
|
||||
Id: int64(node.ClusterId),
|
||||
Name: clusterName,
|
||||
@@ -175,3 +181,113 @@ func (this *NodeService) FindEnabledNode(ctx context.Context, req *pb.FindEnable
|
||||
Login: respLogin,
|
||||
}}, nil
|
||||
}
|
||||
|
||||
// 组合节点配置
|
||||
func (this *NodeService) ComposeNodeConfig(ctx context.Context, req *pb.ComposeNodeConfigRequest) (*pb.ComposeNodeConfigResponse, error) {
|
||||
// 校验节点
|
||||
_, nodeId, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeNode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
node, err := models.SharedNodeDAO.FindEnabledNode(nodeId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if node == nil {
|
||||
return nil, errors.New("node validate failed, please check 'nodeId' or 'secret'")
|
||||
}
|
||||
|
||||
nodeMap := maps.Map{
|
||||
"id": node.UniqueId,
|
||||
"isOn": node.IsOn == 1,
|
||||
"servers": []maps.Map{},
|
||||
"version": node.Version,
|
||||
}
|
||||
|
||||
// 获取所有的服务
|
||||
servers, err := models.SharedServerDAO.FindAllEnabledServersWithNode(int64(node.Id))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverMaps := []maps.Map{}
|
||||
for _, server := range servers {
|
||||
if len(server.Config) == 0 {
|
||||
continue
|
||||
}
|
||||
configMap := maps.Map{}
|
||||
err = json.Unmarshal([]byte(server.Config), &configMap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
configMap["id"] = server.UniqueId
|
||||
configMap["version"] = server.Version
|
||||
serverMaps = append(serverMaps, configMap)
|
||||
}
|
||||
nodeMap["servers"] = serverMaps
|
||||
|
||||
data, err := json.Marshal(nodeMap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.ComposeNodeConfigResponse{ConfigJSON: data}, nil
|
||||
}
|
||||
|
||||
// 节点stream
|
||||
func (this *NodeService) NodeStream(server pb.NodeService_NodeStreamServer) error {
|
||||
// 校验节点
|
||||
_, nodeId, err := rpcutils.ValidateRequest(server.Context(), rpcutils.UserTypeNode)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logs.Println("nodeId:", nodeId)
|
||||
|
||||
for {
|
||||
req, err := server.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logs.Println("received:", req)
|
||||
}
|
||||
}
|
||||
|
||||
// 更新节点状态
|
||||
func (this *NodeService) UpdateNodeStatus(ctx context.Context, req *pb.UpdateNodeStatusRequest) (*pb.UpdateNodeStatusResponse, error) {
|
||||
// 校验节点
|
||||
_, nodeId, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeNode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if req.NodeId > 0 {
|
||||
nodeId = req.NodeId
|
||||
}
|
||||
|
||||
if nodeId <= 0 {
|
||||
return nil, errors.New("'nodeId' should be greater than 0")
|
||||
}
|
||||
|
||||
err = models.SharedNodeDAO.UpdateNodeStatus(nodeId, req.StatusJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.UpdateNodeStatusResponse{}, nil
|
||||
}
|
||||
|
||||
// 同步集群中的节点版本
|
||||
func (this *NodeService) SyncNodesVersionWithCluster(ctx context.Context, req *pb.SyncNodesVersionWithClusterRequest) (*pb.SyncNodesVersionWithClusterResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = models.SharedNodeDAO.SyncNodeVersionsWithCluster(req.ClusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.SyncNodesVersionWithClusterResponse{}, nil
|
||||
}
|
||||
|
||||
@@ -36,3 +36,37 @@ func (this *NodeClusterService) FindAllEnabledClusters(ctx context.Context, req
|
||||
Clusters: result,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 查找所有变更的集群
|
||||
func (this *NodeClusterService) FindAllChangedClusters(ctx context.Context, req *pb.FindAllChangedClustersRequest) (*pb.FindAllChangedClustersResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clusterIds, err := models.SharedNodeDAO.FindChangedClusterIds()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(clusterIds) == 0 {
|
||||
return &pb.FindAllChangedClustersResponse{
|
||||
Clusters: []*pb.NodeCluster{},
|
||||
}, nil
|
||||
}
|
||||
result := []*pb.NodeCluster{}
|
||||
for _, clusterId := range clusterIds {
|
||||
cluster, err := models.SharedNodeClusterDAO.FindEnabledNodeCluster(clusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if cluster == nil {
|
||||
continue
|
||||
}
|
||||
result = append(result, &pb.NodeCluster{
|
||||
Id: int64(cluster.Id),
|
||||
Name: cluster.Name,
|
||||
CreatedAt: int64(cluster.CreatedAt),
|
||||
})
|
||||
}
|
||||
return &pb.FindAllChangedClustersResponse{Clusters: result}, nil
|
||||
}
|
||||
|
||||
186
internal/rpc/services/service_server.go
Normal file
186
internal/rpc/services/service_server.go
Normal file
@@ -0,0 +1,186 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
|
||||
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
|
||||
)
|
||||
|
||||
type ServerService struct {
|
||||
}
|
||||
|
||||
// 创建服务
|
||||
func (this *ServerService) CreateServer(ctx context.Context, req *pb.CreateServerRequest) (*pb.CreateServerResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
serverId, err := models.SharedServerDAO.CreateServer(req.AdminId, req.UserId, req.ClusterId, string(req.Config), string(req.IncludeNodesJSON), string(req.ExcludeNodesJSON))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 更新节点版本
|
||||
err = models.SharedNodeDAO.UpdateAllNodesLatestVersionMatch(req.ClusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.CreateServerResponse{ServerId: serverId}, nil
|
||||
}
|
||||
|
||||
// 修改服务
|
||||
func (this *ServerService) UpdateServer(ctx context.Context, req *pb.UpdateServerRequest) (*pb.UpdateServerResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if req.ServerId <= 0 {
|
||||
return nil, errors.New("invalid serverId")
|
||||
}
|
||||
|
||||
// 查询老的节点信息
|
||||
server, err := models.SharedServerDAO.FindEnabledServer(req.ServerId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if server == nil {
|
||||
return nil, errors.New("can not find server")
|
||||
}
|
||||
|
||||
err = models.SharedServerDAO.UpdateServer(req.ServerId, req.ClusterId, string(req.Config), string(req.IncludeNodesJSON), string(req.ExcludeNodesJSON))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 更新老的节点版本
|
||||
if req.ClusterId != int64(server.ClusterId) {
|
||||
err = models.SharedNodeDAO.UpdateAllNodesLatestVersionMatch(int64(server.ClusterId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// 更新新的节点版本
|
||||
err = models.SharedNodeDAO.UpdateAllNodesLatestVersionMatch(req.ClusterId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.UpdateServerResponse{}, nil
|
||||
}
|
||||
|
||||
// 计算服务数量
|
||||
func (this *ServerService) CountAllEnabledServers(ctx context.Context, req *pb.CountAllEnabledServersRequest) (*pb.CountAllEnabledServersResponse, error) {
|
||||
_ = req
|
||||
_, _, err := rpcutils.ValidateRequest(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
count, err := models.SharedServerDAO.CountAllEnabledServers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.CountAllEnabledServersResponse{Count: count}, nil
|
||||
}
|
||||
|
||||
// 列出单页服务
|
||||
func (this *ServerService) ListEnabledServers(ctx context.Context, req *pb.ListEnabledServersRequest) (*pb.ListEnabledServersResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
servers, err := models.SharedServerDAO.ListEnabledServers(req.Offset, req.Size)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := []*pb.Server{}
|
||||
for _, server := range servers {
|
||||
clusterName, err := models.SharedNodeClusterDAO.FindNodeClusterName(int64(server.ClusterId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = append(result, &pb.Server{
|
||||
Id: int64(server.Id),
|
||||
Config: []byte(server.Config),
|
||||
IncludeNodes: []byte(server.IncludeNodes),
|
||||
ExcludeNodes: []byte(server.ExcludeNodes),
|
||||
CreatedAt: int64(server.CreatedAt),
|
||||
Cluster: &pb.NodeCluster{
|
||||
Id: int64(server.ClusterId),
|
||||
Name: clusterName,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return &pb.ListEnabledServersResponse{Servers: result}, nil
|
||||
}
|
||||
|
||||
// 禁用某服务
|
||||
func (this *ServerService) DisableServer(ctx context.Context, req *pb.DisableServerRequest) (*pb.DisableServerResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 查找服务
|
||||
server, err := models.SharedServerDAO.FindEnabledServer(req.ServerId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if server == nil {
|
||||
return nil, errors.New("can not find the server")
|
||||
}
|
||||
|
||||
// 禁用服务
|
||||
err = models.SharedServerDAO.DisableServer(req.ServerId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 更新节点版本
|
||||
err = models.SharedNodeDAO.UpdateAllNodesLatestVersionMatch(int64(server.ClusterId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.DisableServerResponse{}, nil
|
||||
}
|
||||
|
||||
// 查找单个服务
|
||||
func (this *ServerService) FindEnabledServer(ctx context.Context, req *pb.FindEnabledServerRequest) (*pb.FindEnabledServerResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
server, err := models.SharedServerDAO.FindEnabledServer(req.ServerId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if server == nil {
|
||||
return &pb.FindEnabledServerResponse{}, nil
|
||||
}
|
||||
|
||||
clusterName, err := models.SharedNodeClusterDAO.FindNodeClusterName(int64(server.ClusterId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.FindEnabledServerResponse{Server: &pb.Server{
|
||||
Id: int64(server.Id),
|
||||
Config: []byte(server.Config),
|
||||
IncludeNodes: []byte(server.IncludeNodes),
|
||||
ExcludeNodes: []byte(server.ExcludeNodes),
|
||||
CreatedAt: int64(server.CreatedAt),
|
||||
Cluster: &pb.NodeCluster{
|
||||
Id: int64(server.ClusterId),
|
||||
Name: clusterName,
|
||||
},
|
||||
}}, nil
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
|
||||
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
|
||||
)
|
||||
|
||||
type ServerService struct {
|
||||
}
|
||||
|
||||
func (this *ServerService) CreateServer(ctx context.Context, req *pb.CreateServerRequest) (*pb.CreateServerResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
serverId, err := models.SharedServerDAO.CreateServer(req.AdminId, req.UserId, req.ClusterId, string(req.Config), string(req.IncludeNodesJSON), string(req.ExcludeNodesJSON))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.CreateServerResponse{ServerId: serverId}, nil
|
||||
}
|
||||
|
||||
func (this *ServerService) CountAllEnabledServers(ctx context.Context, req *pb.CountAllEnabledServersRequest) (*pb.CountAllEnabledServersResponse, error) {
|
||||
_ = req
|
||||
_, _, err := rpcutils.ValidateRequest(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
count, err := models.SharedServerDAO.CountAllEnabledServers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &pb.CountAllEnabledServersResponse{Count: count}, nil
|
||||
}
|
||||
|
||||
func (this *ServerService) ListEnabledServers(ctx context.Context, req *pb.ListEnabledServersRequest) (*pb.ListEnabledServersResponse, error) {
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
servers, err := models.SharedServerDAO.ListEnabledServers(req.Offset, req.Size)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := []*pb.Server{}
|
||||
for _, server := range servers {
|
||||
clusterName, err := models.SharedNodeClusterDAO.FindNodeClusterName(int64(server.ClusterId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = append(result, &pb.Server{
|
||||
Id: int64(server.Id),
|
||||
Config: []byte(server.Config),
|
||||
IncludeNodes: []byte(server.IncludeNodes),
|
||||
ExcludeNodes: []byte(server.ExcludeNodes),
|
||||
CreatedAt: int64(server.CreatedAt),
|
||||
Cluster: &pb.NodeCluster{
|
||||
Id: int64(server.ClusterId),
|
||||
Name: clusterName,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return &pb.ListEnabledServersResponse{Servers: result}, nil
|
||||
}
|
||||
@@ -41,14 +41,31 @@ func ValidateRequest(ctx context.Context, userTypes ...UserType) (userType UserT
|
||||
}
|
||||
nodeId := nodeIds[0]
|
||||
|
||||
// 获取Node信息
|
||||
// 获取角色Node信息
|
||||
apiToken, err := models.SharedApiTokenDAO.FindEnabledTokenWithNode(nodeId)
|
||||
if err != nil {
|
||||
utils.PrintError(err)
|
||||
return UserTypeNone, 0, err
|
||||
}
|
||||
nodeUserId := int64(0)
|
||||
if apiToken == nil {
|
||||
return UserTypeNone, 0, errors.New("can not find token from node id: " + err.Error())
|
||||
// 我们从节点中获取
|
||||
node, err := models.SharedNodeDAO.FindEnabledNodeWithUniqueId(nodeId)
|
||||
if err != nil {
|
||||
return UserTypeNone, 0, err
|
||||
}
|
||||
if node == nil {
|
||||
return UserTypeNone, 0, err
|
||||
}
|
||||
|
||||
nodeUserId = int64(node.Id)
|
||||
apiToken = &models.ApiToken{
|
||||
Id: 0,
|
||||
NodeId: nodeId,
|
||||
Secret: node.Secret,
|
||||
Role: "node",
|
||||
State: 1,
|
||||
}
|
||||
}
|
||||
|
||||
tokens := md.Get("token")
|
||||
@@ -92,5 +109,9 @@ func ValidateRequest(ctx context.Context, userTypes ...UserType) (userType UserT
|
||||
return UserTypeNone, 0, errors.New("not supported user type: '" + userType + "'")
|
||||
}
|
||||
|
||||
if nodeUserId > 0 {
|
||||
return t, nodeUserId, nil
|
||||
} else {
|
||||
return t, m.GetInt64("userId"), nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user