节点可以单独设置缓存的磁盘、内存容量

This commit is contained in:
刘祥超
2021-05-12 21:38:02 +08:00
parent 496c9b5e47
commit 8e2e50684b
5 changed files with 765 additions and 694 deletions

View File

@@ -15,6 +15,7 @@ import (
var sharedNodeConfig *NodeConfig = nil var sharedNodeConfig *NodeConfig = nil
// NodeConfig 边缘节点配置
type NodeConfig struct { type NodeConfig struct {
Id int64 `yaml:"id" json:"id"` Id int64 `yaml:"id" json:"id"`
NodeId string `yaml:"nodeId" json:"nodeId"` NodeId string `yaml:"nodeId" json:"nodeId"`
@@ -24,6 +25,8 @@ type NodeConfig struct {
Name string `yaml:"name" json:"name"` Name string `yaml:"name" json:"name"`
MaxCPU int32 `yaml:"maxCPU" json:"maxCPU"` MaxCPU int32 `yaml:"maxCPU" json:"maxCPU"`
RegionId int64 `yaml:"regionId" json:"regionId"` RegionId int64 `yaml:"regionId" json:"regionId"`
MaxCacheDiskCapacity *shared.SizeCapacity `yaml:"maxCacheDiskCapacity" json:"maxCacheDiskCapacity"`
MaxCacheMemoryCapacity *shared.SizeCapacity `yaml:"maxCacheMemoryCapacity" json:"maxCacheMemoryCapacity"`
// 全局配置 // 全局配置
GlobalConfig *serverconfigs.GlobalConfig `yaml:"globalConfig" json:"globalConfig"` // 全局配置 GlobalConfig *serverconfigs.GlobalConfig `yaml:"globalConfig" json:"globalConfig"` // 全局配置
@@ -40,7 +43,7 @@ type NodeConfig struct {
firewallPolicies []*firewallconfigs.HTTPFirewallPolicy firewallPolicies []*firewallconfigs.HTTPFirewallPolicy
} }
// 取得当前节点配置单例 // SharedNodeConfig 取得当前节点配置单例
func SharedNodeConfig() (*NodeConfig, error) { func SharedNodeConfig() (*NodeConfig, error) {
shared.Locker.Lock() shared.Locker.Lock()
defer shared.Locker.Unlock() defer shared.Locker.Unlock()
@@ -64,14 +67,14 @@ func SharedNodeConfig() (*NodeConfig, error) {
return config, nil return config, nil
} }
// 重置节点配置 // ResetNodeConfig 重置节点配置
func ResetNodeConfig(nodeConfig *NodeConfig) { func ResetNodeConfig(nodeConfig *NodeConfig) {
shared.Locker.Lock() shared.Locker.Lock()
sharedNodeConfig = nodeConfig sharedNodeConfig = nodeConfig
shared.Locker.Unlock() shared.Locker.Unlock()
} }
// 初始化 // Init 初始化
func (this *NodeConfig) Init() error { func (this *NodeConfig) Init() error {
this.paddedId = fmt.Sprintf("%08d", this.Id) this.paddedId = fmt.Sprintf("%08d", this.Id)
@@ -141,7 +144,7 @@ func (this *NodeConfig) Init() error {
return nil return nil
} }
// 根据网络地址和协议分组 // AvailableGroups 根据网络地址和协议分组
func (this *NodeConfig) AvailableGroups() []*serverconfigs.ServerGroup { func (this *NodeConfig) AvailableGroups() []*serverconfigs.ServerGroup {
groupMapping := map[string]*serverconfigs.ServerGroup{} // protocol://addr => Server Group groupMapping := map[string]*serverconfigs.ServerGroup{} // protocol://addr => Server Group
for _, server := range this.Servers { for _, server := range this.Servers {
@@ -166,12 +169,12 @@ func (this *NodeConfig) AvailableGroups() []*serverconfigs.ServerGroup {
return result return result
} }
// 获取所有的防火墙策略 // FindAllFirewallPolicies 获取所有的防火墙策略
func (this *NodeConfig) FindAllFirewallPolicies() []*firewallconfigs.HTTPFirewallPolicy { func (this *NodeConfig) FindAllFirewallPolicies() []*firewallconfigs.HTTPFirewallPolicy {
return this.firewallPolicies return this.firewallPolicies
} }
// 写入到文件 // Save 写入到文件
func (this *NodeConfig) Save() error { func (this *NodeConfig) Save() error {
shared.Locker.Lock() shared.Locker.Lock()
defer shared.Locker.Unlock() defer shared.Locker.Unlock()
@@ -184,7 +187,7 @@ func (this *NodeConfig) Save() error {
return ioutil.WriteFile(Tea.ConfigFile("node.json"), data, 0777) return ioutil.WriteFile(Tea.ConfigFile("node.json"), data, 0777)
} }
// 获取填充后的ID // PaddedId 获取填充后的ID
func (this *NodeConfig) PaddedId() string { func (this *NodeConfig) PaddedId() string {
return this.paddedId return this.paddedId
} }

View File

@@ -46,6 +46,8 @@ type Node struct {
IsUp bool `protobuf:"varint,14,opt,name=isUp,proto3" json:"isUp,omitempty"` IsUp bool `protobuf:"varint,14,opt,name=isUp,proto3" json:"isUp,omitempty"`
DnsRoutes []*DNSRoute `protobuf:"bytes,15,rep,name=dnsRoutes,proto3" json:"dnsRoutes,omitempty"` DnsRoutes []*DNSRoute `protobuf:"bytes,15,rep,name=dnsRoutes,proto3" json:"dnsRoutes,omitempty"`
IsActive bool `protobuf:"varint,16,opt,name=isActive,proto3" json:"isActive,omitempty"` IsActive bool `protobuf:"varint,16,opt,name=isActive,proto3" json:"isActive,omitempty"`
MaxCacheDiskCapacity *SizeCapacity `protobuf:"bytes,17,opt,name=maxCacheDiskCapacity,proto3" json:"maxCacheDiskCapacity,omitempty"`
MaxCacheMemoryCapacity *SizeCapacity `protobuf:"bytes,18,opt,name=maxCacheMemoryCapacity,proto3" json:"maxCacheMemoryCapacity,omitempty"`
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"`
Login *NodeLogin `protobuf:"bytes,33,opt,name=login,proto3" json:"login,omitempty"` Login *NodeLogin `protobuf:"bytes,33,opt,name=login,proto3" json:"login,omitempty"`
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"` InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
@@ -198,6 +200,20 @@ func (x *Node) GetIsActive() bool {
return false return false
} }
func (x *Node) GetMaxCacheDiskCapacity() *SizeCapacity {
if x != nil {
return x.MaxCacheDiskCapacity
}
return nil
}
func (x *Node) GetMaxCacheMemoryCapacity() *SizeCapacity {
if x != nil {
return x.MaxCacheMemoryCapacity
}
return nil
}
func (x *Node) GetNodeCluster() *NodeCluster { func (x *Node) GetNodeCluster() *NodeCluster {
if x != nil { if x != nil {
return x.NodeCluster return x.NodeCluster
@@ -259,54 +275,65 @@ var file_models_model_node_proto_rawDesc = []byte{
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x69,
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73,
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, 0x05, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf5, 0x06, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x53, 0x4f, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
0x4e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x53, 0x4f, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a,
0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x4f, 0x4e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75,
0x44, 0x69, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c,
0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x44, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61,
0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x49, 0x6e,
0x71, 0x75, 0x65, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x71, 0x75, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75,
0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12,
0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x6c, 0x61, 0x74,
0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03,
0x65, 0x49, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x03, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x52, 0x0d, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12,
0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x73, 0x12, 0x30, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x4e,
0x16, 0x0a, 0x06, 0x6d, 0x61, 0x78, 0x43, 0x50, 0x55, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x03, 0x52, 0x13, 0x63, 0x6f,
0x06, 0x6d, 0x61, 0x78, 0x43, 0x50, 0x55, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64,
0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x78, 0x43, 0x50, 0x55, 0x18, 0x0c, 0x20, 0x01, 0x28,
0x73, 0x55, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x05, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x43, 0x50, 0x55, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f,
0x2a, 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a,
0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55,
0x52, 0x09, 0x64, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x70, 0x12, 0x2a, 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0f,
0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x4e, 0x53, 0x52, 0x6f, 0x75,
0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x74, 0x65, 0x52, 0x09, 0x64, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a,
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52,
0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x44, 0x0a, 0x14, 0x6d, 0x61, 0x78,
0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, 0x6c, 0x6f, 0x43, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74,
0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x79, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x7a,
0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x65, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x43, 0x61,
0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x63, 0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12,
0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x48, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x72,
0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x69, 0x79, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x33, 0x0a, 0x0b, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x7a, 0x65, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74,
0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x23, 0x20, 0x03, 0x28, 0x79, 0x52, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x72,
0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x79, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64,
0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
0x73, 0x12, 0x23, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05,
0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62,
0x18, 0x25, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69,
0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0x6e, 0x12, 0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74,
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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, 0x23, 0x0a, 0x05, 0x67, 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, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 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, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -325,26 +352,29 @@ var file_models_model_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_models_model_node_proto_goTypes = []interface{}{ var file_models_model_node_proto_goTypes = []interface{}{
(*Node)(nil), // 0: pb.Node (*Node)(nil), // 0: pb.Node
(*DNSRoute)(nil), // 1: pb.DNSRoute (*DNSRoute)(nil), // 1: pb.DNSRoute
(*NodeCluster)(nil), // 2: pb.NodeCluster (*SizeCapacity)(nil), // 2: pb.SizeCapacity
(*NodeLogin)(nil), // 3: pb.NodeLogin (*NodeCluster)(nil), // 3: pb.NodeCluster
(*NodeInstallStatus)(nil), // 4: pb.NodeInstallStatus (*NodeLogin)(nil), // 4: pb.NodeLogin
(*NodeIPAddress)(nil), // 5: pb.NodeIPAddress (*NodeInstallStatus)(nil), // 5: pb.NodeInstallStatus
(*NodeGroup)(nil), // 6: pb.NodeGroup (*NodeIPAddress)(nil), // 6: pb.NodeIPAddress
(*NodeRegion)(nil), // 7: pb.NodeRegion (*NodeGroup)(nil), // 7: pb.NodeGroup
(*NodeRegion)(nil), // 8: pb.NodeRegion
} }
var file_models_model_node_proto_depIdxs = []int32{ var file_models_model_node_proto_depIdxs = []int32{
1, // 0: pb.Node.dnsRoutes:type_name -> pb.DNSRoute 1, // 0: pb.Node.dnsRoutes:type_name -> pb.DNSRoute
2, // 1: pb.Node.nodeCluster:type_name -> pb.NodeCluster 2, // 1: pb.Node.maxCacheDiskCapacity:type_name -> pb.SizeCapacity
3, // 2: pb.Node.login:type_name -> pb.NodeLogin 2, // 2: pb.Node.maxCacheMemoryCapacity:type_name -> pb.SizeCapacity
4, // 3: pb.Node.installStatus:type_name -> pb.NodeInstallStatus 3, // 3: pb.Node.nodeCluster:type_name -> pb.NodeCluster
5, // 4: pb.Node.ipAddresses:type_name -> pb.NodeIPAddress 4, // 4: pb.Node.login:type_name -> pb.NodeLogin
6, // 5: pb.Node.group:type_name -> pb.NodeGroup 5, // 5: pb.Node.installStatus:type_name -> pb.NodeInstallStatus
7, // 6: pb.Node.region:type_name -> pb.NodeRegion 6, // 6: pb.Node.ipAddresses:type_name -> pb.NodeIPAddress
7, // [7:7] is the sub-list for method output_type 7, // 7: pb.Node.group:type_name -> pb.NodeGroup
7, // [7:7] is the sub-list for method input_type 8, // 8: pb.Node.region:type_name -> pb.NodeRegion
7, // [7:7] is the sub-list for extension type_name 9, // [9:9] is the sub-list for method output_type
7, // [7:7] is the sub-list for extension extendee 9, // [9:9] is the sub-list for method input_type
0, // [0:7] is the sub-list for field type_name 9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
} }
func init() { file_models_model_node_proto_init() } func init() { file_models_model_node_proto_init() }
@@ -359,6 +389,7 @@ func file_models_model_node_proto_init() {
file_models_model_node_group_proto_init() file_models_model_node_group_proto_init()
file_models_model_node_region_proto_init() file_models_model_node_region_proto_init()
file_models_model_dns_route_proto_init() file_models_model_dns_route_proto_init()
file_models_model_size_capacity_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_models_model_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_models_model_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Node); i { switch v := v.(*Node); i {

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,7 @@ import "models/model_node_ip_address.proto";
import "models/model_node_group.proto"; import "models/model_node_group.proto";
import "models/model_node_region.proto"; import "models/model_node_region.proto";
import "models/model_dns_route.proto"; import "models/model_dns_route.proto";
import "models/model_size_capacity.proto";
message Node { message Node {
int64 id = 1; int64 id = 1;
@@ -28,6 +29,8 @@ message Node {
bool isUp = 14; bool isUp = 14;
repeated DNSRoute dnsRoutes = 15; repeated DNSRoute dnsRoutes = 15;
bool isActive = 16; bool isActive = 16;
SizeCapacity maxCacheDiskCapacity = 17;
SizeCapacity maxCacheMemoryCapacity = 18;
NodeCluster nodeCluster = 32; NodeCluster nodeCluster = 32;
NodeLogin login = 33; NodeLogin login = 33;

View File

@@ -7,6 +7,7 @@ import "models/model_node.proto";
import "models/model_node_login.proto"; import "models/model_node_login.proto";
import "models/model_node_install_status.proto"; import "models/model_node_install_status.proto";
import "models/model_dns_route.proto"; import "models/model_dns_route.proto";
import "models/model_size_capacity.proto";
import "models/rpc_messages.proto"; import "models/rpc_messages.proto";
service NodeService { service NodeService {
@@ -189,6 +190,8 @@ message UpdateNodeRequest {
int64 dnsDomainId = 8; int64 dnsDomainId = 8;
repeated string dnsRoutes = 9; repeated string dnsRoutes = 9;
int64 regionId = 10; int64 regionId = 10;
SizeCapacity maxCacheDiskCapacity = 11;
SizeCapacity maxCacheMemoryCapacity = 12;
} }
// 查找节点 // 查找节点