mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 20:31:54 +08:00
支持L2节点配置
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package nodeconfigs
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -35,6 +36,7 @@ type NodeConfig struct {
|
||||
SupportCNAME bool `yaml:"supportCNAME" json:"supportCNAME"`
|
||||
Version int64 `yaml:"version" json:"version"`
|
||||
Name string `yaml:"name" json:"name"`
|
||||
GroupId int64 `yaml:"groupId" json:"groupId"`
|
||||
RegionId int64 `yaml:"regionId" json:"regionId"`
|
||||
OCSPVersion int64 `yaml:"ocspVersion" json:"ocspVersion"`
|
||||
|
||||
@@ -46,6 +48,10 @@ type NodeConfig struct {
|
||||
MaxThreads int `yaml:"maxThreads" json:"maxThreads"`
|
||||
TCPMaxConnections int `yaml:"tcpMaxConnections" json:"tcpMaxConnections"`
|
||||
|
||||
// 级别
|
||||
Level int32 `yaml:"level" json:"level"`
|
||||
ParentNodes map[int64][]*ParentNodeConfig `yaml:"parentNodes" json:"parentNodes"` // clusterId => []*ParentNodeConfig
|
||||
|
||||
// 全局配置
|
||||
GlobalConfig *serverconfigs.GlobalConfig `yaml:"globalConfig" json:"globalConfig"` // 全局配置
|
||||
ProductConfig *ProductConfig `yaml:"productConfig" json:"productConfig"`
|
||||
@@ -69,7 +75,7 @@ type NodeConfig struct {
|
||||
CommonScripts []*serverconfigs.CommonScript `yaml:"commonScripts" json:"commonScripts"`
|
||||
|
||||
// WebP
|
||||
WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"`
|
||||
WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"` // clusterId => *WebPImagePolicy
|
||||
|
||||
paddedId string
|
||||
|
||||
@@ -87,6 +93,8 @@ type NodeConfig struct {
|
||||
|
||||
// syn flood
|
||||
synFlood *firewallconfigs.SYNFloodConfig
|
||||
|
||||
secretHash string
|
||||
}
|
||||
|
||||
// SharedNodeConfig 取得当前节点配置单例
|
||||
@@ -149,6 +157,7 @@ func CloneNodeConfig(nodeConfig *NodeConfig) (*NodeConfig, error) {
|
||||
|
||||
// Init 初始化
|
||||
func (this *NodeConfig) Init() (err error, serverErrors []*ServerError) {
|
||||
this.secretHash = fmt.Sprintf("%x", sha256.Sum256([]byte(this.NodeId+"@"+this.Secret)))
|
||||
this.paddedId = fmt.Sprintf("%08d", this.Id)
|
||||
|
||||
// servers
|
||||
@@ -473,3 +482,8 @@ func (this *NodeConfig) FindWebPImagePolicyWithClusterId(clusterId int64) *WebPI
|
||||
}
|
||||
return this.WebPImagePolicies[clusterId]
|
||||
}
|
||||
|
||||
// SecretHash 对Id和Secret的Hash计算
|
||||
func (this *NodeConfig) SecretHash() string {
|
||||
return this.secretHash
|
||||
}
|
||||
|
||||
37
pkg/nodeconfigs/node_levels.go
Normal file
37
pkg/nodeconfigs/node_levels.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package nodeconfigs
|
||||
|
||||
type NodeLevel struct {
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Code int `yaml:"code" json:"code"`
|
||||
Description string `yaml:"description" json:"description"`
|
||||
}
|
||||
|
||||
func FindAllNodeLevels() []*NodeLevel {
|
||||
return []*NodeLevel{
|
||||
{
|
||||
Name: "边缘节点",
|
||||
Code: 1,
|
||||
Description: "普通的边缘节点。",
|
||||
},
|
||||
{
|
||||
Name: "L2节点",
|
||||
Code: 2,
|
||||
Description: "特殊的边缘节点,同时负责同组上一级节点的回源。",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func FindNodeLevel(level int) *NodeLevel {
|
||||
level--
|
||||
|
||||
var levels = FindAllNodeLevels()
|
||||
if level < 0 {
|
||||
return levels[0]
|
||||
}
|
||||
if level < len(levels) {
|
||||
return levels[level]
|
||||
}
|
||||
return levels[0]
|
||||
}
|
||||
10
pkg/nodeconfigs/node_parent_config.go
Normal file
10
pkg/nodeconfigs/node_parent_config.go
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package nodeconfigs
|
||||
|
||||
// ParentNodeConfig 父级节点配置
|
||||
type ParentNodeConfig struct {
|
||||
Id int64 `yaml:"id" json:"id"`
|
||||
Addrs []string `yaml:"addrs" json:"addrs"`
|
||||
SecretHash string `yaml:"secretHash" json:"secretHash"`
|
||||
}
|
||||
@@ -49,6 +49,7 @@ type Node struct {
|
||||
MaxCacheDiskCapacity *SizeCapacity `protobuf:"bytes,17,opt,name=maxCacheDiskCapacity,proto3" json:"maxCacheDiskCapacity,omitempty"`
|
||||
MaxCacheMemoryCapacity *SizeCapacity `protobuf:"bytes,18,opt,name=maxCacheMemoryCapacity,proto3" json:"maxCacheMemoryCapacity,omitempty"`
|
||||
CacheDiskDir string `protobuf:"bytes,19,opt,name=cacheDiskDir,proto3" json:"cacheDiskDir,omitempty"`
|
||||
Level int32 `protobuf:"varint,20,opt,name=level,proto3" json:"level,omitempty"`
|
||||
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
||||
NodeLogin *NodeLogin `protobuf:"bytes,33,opt,name=nodeLogin,proto3" json:"nodeLogin,omitempty"`
|
||||
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
||||
@@ -223,6 +224,13 @@ func (x *Node) GetCacheDiskDir() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Node) GetLevel() int32 {
|
||||
if x != nil {
|
||||
return x.Level
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Node) GetNodeCluster() *NodeCluster {
|
||||
if x != nil {
|
||||
return x.NodeCluster
|
||||
@@ -281,6 +289,7 @@ type BasicNode struct {
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||
IsUp bool `protobuf:"varint,4,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
||||
Level int32 `protobuf:"varint,5,opt,name=level,proto3" json:"level,omitempty"`
|
||||
NodeCluster *NodeCluster `protobuf:"bytes,30,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
||||
}
|
||||
|
||||
@@ -344,6 +353,13 @@ func (x *BasicNode) GetIsUp() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *BasicNode) GetLevel() int32 {
|
||||
if x != nil {
|
||||
return x.Level
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *BasicNode) GetNodeCluster() *NodeCluster {
|
||||
if x != nil {
|
||||
return x.NodeCluster
|
||||
@@ -372,7 +388,7 @@ var file_models_model_node_proto_rawDesc = []byte{
|
||||
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
|
||||
0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69,
|
||||
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf8, 0x07, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
|
||||
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x08, 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, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a,
|
||||
@@ -412,40 +428,43 @@ var file_models_model_node_proto_rawDesc = []byte{
|
||||
0x79, 0x52, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x72,
|
||||
0x79, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x63,
|
||||
0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0c, 0x63, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x12, 0x31, 0x0a,
|
||||
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 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, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 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, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x3b, 0x0a,
|
||||
0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x22,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e,
|
||||
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x69, 0x6e, 0x73,
|
||||
0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x33, 0x0a, 0x0b, 0x69, 0x70,
|
||||
0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12,
|
||||
0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x24, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75,
|
||||
0x70, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x2e, 0x0a, 0x0a,
|
||||
0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x25, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x15,
|
||||
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75,
|
||||
0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x15, 0x73, 0x65,
|
||||
0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 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, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x55,
|
||||
0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x31, 0x0a,
|
||||
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73,
|
||||
0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x0c, 0x63, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65,
|
||||
0x76, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 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, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43,
|
||||
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 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, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f,
|
||||
0x67, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x12, 0x33, 0x0a, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18,
|
||||
0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49,
|
||||
0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f,
|
||||
0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x12, 0x2e, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x25, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x67, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e,
|
||||
0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x52, 0x15, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x09, 0x42, 0x61,
|
||||
0x73, 0x69, 0x63, 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, 0x12, 0x0a, 0x04, 0x69,
|
||||
0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
||||
0x73, 0x55, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64,
|
||||
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
|
||||
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04,
|
||||
0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,7 @@ message Node {
|
||||
SizeCapacity maxCacheDiskCapacity = 17;
|
||||
SizeCapacity maxCacheMemoryCapacity = 18;
|
||||
string cacheDiskDir = 19;
|
||||
int32 level = 20;
|
||||
|
||||
NodeCluster nodeCluster = 32; // 主集群
|
||||
NodeLogin nodeLogin = 33;
|
||||
@@ -47,6 +48,7 @@ message BasicNode {
|
||||
string name = 2;
|
||||
bool isOn = 3;
|
||||
bool isUp = 4;
|
||||
int32 level = 5;
|
||||
|
||||
NodeCluster nodeCluster = 30; // 主集群
|
||||
}
|
||||
@@ -130,6 +130,9 @@ service NodeService {
|
||||
|
||||
// 修改节点缓存设置
|
||||
rpc updateNodeCache(UpdateNodeCacheRequest) returns (RPCSuccess);
|
||||
|
||||
// 读取节点级别信息
|
||||
rpc findNodeLevelInfo(FindNodeLevelInfoRequest) returns (FindNodeLevelInfoResponse);
|
||||
}
|
||||
|
||||
// 创建节点
|
||||
@@ -173,6 +176,7 @@ message ListEnabledNodesMatchRequest {
|
||||
string keyword = 6;
|
||||
int64 nodeGroupId = 7;
|
||||
int64 nodeRegionId = 8;
|
||||
int32 level = 9;
|
||||
|
||||
bool cpuAsc = 20;
|
||||
bool cpuDesc = 21;
|
||||
@@ -217,6 +221,7 @@ message UpdateNodeRequest {
|
||||
bool isOn = 6;
|
||||
int64 nodeGroupId = 7;
|
||||
int64 nodeRegionId = 10;
|
||||
int32 level = 14;
|
||||
}
|
||||
|
||||
// 获取单个节点信息
|
||||
@@ -277,6 +282,7 @@ message CountAllEnabledNodesMatchRequest {
|
||||
string keyword = 4;
|
||||
int64 nodeGroupId = 5;
|
||||
int64 nodeRegionId = 6;
|
||||
int32 level = 7;
|
||||
}
|
||||
|
||||
// 修改节点安装状态
|
||||
@@ -495,3 +501,12 @@ message UpdateNodeCacheRequest {
|
||||
SizeCapacity maxCacheMemoryCapacity = 3;
|
||||
string cacheDiskDir = 4;
|
||||
}
|
||||
|
||||
// 读取节点级别信息
|
||||
message FindNodeLevelInfoRequest {
|
||||
}
|
||||
|
||||
message FindNodeLevelInfoResponse {
|
||||
int32 level = 1;
|
||||
bytes parentNodesMapJSON = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user