275 lines
7.4 KiB
Go
275 lines
7.4 KiB
Go
package pb
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"google.golang.org/protobuf/encoding/protowire"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// FindAllUpgradeNSNodesWithNSClusterIdRequest 列出所有需要升级的NS节点
|
|
type FindAllUpgradeNSNodesWithNSClusterIdRequest struct {
|
|
NsClusterId int64 `protobuf:"varint,1,opt,name=nsClusterId,proto3" json:"nsClusterId,omitempty"`
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdRequest) Reset() { *x = FindAllUpgradeNSNodesWithNSClusterIdRequest{} }
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdRequest) String() string { return fmt.Sprintf("%+v", *x) }
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdRequest) ProtoMessage() {}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdRequest) GetNsClusterId() int64 {
|
|
if x != nil {
|
|
return x.NsClusterId
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdRequest) Marshal() ([]byte, error) {
|
|
var b []byte
|
|
if x.NsClusterId != 0 {
|
|
b = protowire.AppendTag(b, 1, protowire.VarintType)
|
|
b = protowire.AppendVarint(b, uint64(x.NsClusterId))
|
|
}
|
|
return b, nil
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdRequest) Unmarshal(data []byte) error {
|
|
for len(data) > 0 {
|
|
num, typ, n := protowire.ConsumeTag(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid tag")
|
|
}
|
|
data = data[n:]
|
|
switch num {
|
|
case 1:
|
|
if typ == protowire.VarintType {
|
|
v, n := protowire.ConsumeVarint(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid varint")
|
|
}
|
|
x.NsClusterId = int64(v)
|
|
data = data[n:]
|
|
}
|
|
default:
|
|
n := protowire.ConsumeFieldValue(num, typ, data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid field value")
|
|
}
|
|
data = data[n:]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade 单个待升级NS节点信息
|
|
type FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade struct {
|
|
NsNode *NSNode `protobuf:"bytes,1,opt,name=nsNode,proto3" json:"nsNode,omitempty"`
|
|
Os string `protobuf:"bytes,2,opt,name=os,proto3" json:"os,omitempty"`
|
|
Arch string `protobuf:"bytes,3,opt,name=arch,proto3" json:"arch,omitempty"`
|
|
OldVersion string `protobuf:"bytes,4,opt,name=oldVersion,proto3" json:"oldVersion,omitempty"`
|
|
NewVersion string `protobuf:"bytes,5,opt,name=newVersion,proto3" json:"newVersion,omitempty"`
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade) Reset() {
|
|
*x = FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade{}
|
|
}
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade) String() string {
|
|
return fmt.Sprintf("%+v", *x)
|
|
}
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade) ProtoMessage() {}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade) Marshal() ([]byte, error) {
|
|
var b []byte
|
|
if x.NsNode != nil {
|
|
nodeData, err := proto.Marshal(x.NsNode)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
b = protowire.AppendTag(b, 1, protowire.BytesType)
|
|
b = protowire.AppendBytes(b, nodeData)
|
|
}
|
|
if x.Os != "" {
|
|
b = protowire.AppendTag(b, 2, protowire.BytesType)
|
|
b = protowire.AppendString(b, x.Os)
|
|
}
|
|
if x.Arch != "" {
|
|
b = protowire.AppendTag(b, 3, protowire.BytesType)
|
|
b = protowire.AppendString(b, x.Arch)
|
|
}
|
|
if x.OldVersion != "" {
|
|
b = protowire.AppendTag(b, 4, protowire.BytesType)
|
|
b = protowire.AppendString(b, x.OldVersion)
|
|
}
|
|
if x.NewVersion != "" {
|
|
b = protowire.AppendTag(b, 5, protowire.BytesType)
|
|
b = protowire.AppendString(b, x.NewVersion)
|
|
}
|
|
return b, nil
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade) Unmarshal(data []byte) error {
|
|
for len(data) > 0 {
|
|
num, typ, n := protowire.ConsumeTag(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid tag")
|
|
}
|
|
data = data[n:]
|
|
switch num {
|
|
case 1:
|
|
if typ == protowire.BytesType {
|
|
v, n := protowire.ConsumeBytes(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid bytes")
|
|
}
|
|
x.NsNode = &NSNode{}
|
|
if err := proto.Unmarshal(v, x.NsNode); err != nil {
|
|
return err
|
|
}
|
|
data = data[n:]
|
|
}
|
|
case 2, 3, 4, 5:
|
|
if typ == protowire.BytesType {
|
|
v, n := protowire.ConsumeString(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid string")
|
|
}
|
|
switch num {
|
|
case 2:
|
|
x.Os = v
|
|
case 3:
|
|
x.Arch = v
|
|
case 4:
|
|
x.OldVersion = v
|
|
case 5:
|
|
x.NewVersion = v
|
|
}
|
|
data = data[n:]
|
|
}
|
|
default:
|
|
n := protowire.ConsumeFieldValue(num, typ, data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid field value")
|
|
}
|
|
data = data[n:]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// FindAllUpgradeNSNodesWithNSClusterIdResponse 列出所有需要升级的NS节点
|
|
type FindAllUpgradeNSNodesWithNSClusterIdResponse struct {
|
|
Nodes []*FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse) Reset() {
|
|
*x = FindAllUpgradeNSNodesWithNSClusterIdResponse{}
|
|
}
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse) String() string {
|
|
return fmt.Sprintf("%+v", *x)
|
|
}
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse) ProtoMessage() {}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse) GetNodes() []*FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade {
|
|
if x != nil {
|
|
return x.Nodes
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse) Marshal() ([]byte, error) {
|
|
var b []byte
|
|
for _, node := range x.Nodes {
|
|
nodeData, err := node.Marshal()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
b = protowire.AppendTag(b, 1, protowire.BytesType)
|
|
b = protowire.AppendBytes(b, nodeData)
|
|
}
|
|
return b, nil
|
|
}
|
|
|
|
func (x *FindAllUpgradeNSNodesWithNSClusterIdResponse) Unmarshal(data []byte) error {
|
|
for len(data) > 0 {
|
|
num, typ, n := protowire.ConsumeTag(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid tag")
|
|
}
|
|
data = data[n:]
|
|
switch num {
|
|
case 1:
|
|
if typ == protowire.BytesType {
|
|
v, n := protowire.ConsumeBytes(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid bytes")
|
|
}
|
|
node := &FindAllUpgradeNSNodesWithNSClusterIdResponse_NSNodeUpgrade{}
|
|
if err := node.Unmarshal(v); err != nil {
|
|
return err
|
|
}
|
|
x.Nodes = append(x.Nodes, node)
|
|
data = data[n:]
|
|
}
|
|
default:
|
|
n := protowire.ConsumeFieldValue(num, typ, data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid field value")
|
|
}
|
|
data = data[n:]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// UpgradeNSNodeRequest 升级单个NS节点
|
|
type UpgradeNSNodeRequest struct {
|
|
NsNodeId int64 `protobuf:"varint,1,opt,name=nsNodeId,proto3" json:"nsNodeId,omitempty"`
|
|
}
|
|
|
|
func (x *UpgradeNSNodeRequest) Reset() { *x = UpgradeNSNodeRequest{} }
|
|
func (x *UpgradeNSNodeRequest) String() string { return fmt.Sprintf("%+v", *x) }
|
|
func (x *UpgradeNSNodeRequest) ProtoMessage() {}
|
|
|
|
func (x *UpgradeNSNodeRequest) GetNsNodeId() int64 {
|
|
if x != nil {
|
|
return x.NsNodeId
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *UpgradeNSNodeRequest) Marshal() ([]byte, error) {
|
|
var b []byte
|
|
if x.NsNodeId != 0 {
|
|
b = protowire.AppendTag(b, 1, protowire.VarintType)
|
|
b = protowire.AppendVarint(b, uint64(x.NsNodeId))
|
|
}
|
|
return b, nil
|
|
}
|
|
|
|
func (x *UpgradeNSNodeRequest) Unmarshal(data []byte) error {
|
|
for len(data) > 0 {
|
|
num, typ, n := protowire.ConsumeTag(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid tag")
|
|
}
|
|
data = data[n:]
|
|
switch num {
|
|
case 1:
|
|
if typ == protowire.VarintType {
|
|
v, n := protowire.ConsumeVarint(data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid varint")
|
|
}
|
|
x.NsNodeId = int64(v)
|
|
data = data[n:]
|
|
}
|
|
default:
|
|
n := protowire.ConsumeFieldValue(num, typ, data)
|
|
if n < 0 {
|
|
return fmt.Errorf("invalid field value")
|
|
}
|
|
data = data[n:]
|
|
}
|
|
}
|
|
return nil
|
|
}
|