阶段性提交

This commit is contained in:
GoEdgeLab
2020-09-09 18:53:53 +08:00
parent ea05b2f236
commit 5a941ec9d7
115 changed files with 7910 additions and 744 deletions

View File

@@ -1,299 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: node/service.proto
package node
import (
context "context"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type ConfigRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NodeId string `protobuf:"bytes,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
}
func (x *ConfigRequest) Reset() {
*x = ConfigRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_node_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ConfigRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigRequest) ProtoMessage() {}
func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
mi := &file_node_service_proto_msgTypes[0]
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 ConfigRequest.ProtoReflect.Descriptor instead.
func (*ConfigRequest) Descriptor() ([]byte, []int) {
return file_node_service_proto_rawDescGZIP(), []int{0}
}
func (x *ConfigRequest) GetNodeId() string {
if x != nil {
return x.NodeId
}
return ""
}
type ConfigResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *ConfigResponse) Reset() {
*x = ConfigResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_node_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ConfigResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigResponse) ProtoMessage() {}
func (x *ConfigResponse) ProtoReflect() protoreflect.Message {
mi := &file_node_service_proto_msgTypes[1]
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 ConfigResponse.ProtoReflect.Descriptor instead.
func (*ConfigResponse) Descriptor() ([]byte, []int) {
return file_node_service_proto_rawDescGZIP(), []int{1}
}
func (x *ConfigResponse) GetId() string {
if x != nil {
return x.Id
}
return ""
}
var File_node_service_proto protoreflect.FileDescriptor
var file_node_service_proto_rawDesc = []byte{
0x0a, 0x12, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x27, 0x0a, 0x0d, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e,
0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64,
0x65, 0x49, 0x64, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x40, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x35, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x13, 0x2e, 0x6e, 0x6f, 0x64,
0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x14, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x6e, 0x6f, 0x64,
0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_node_service_proto_rawDescOnce sync.Once
file_node_service_proto_rawDescData = file_node_service_proto_rawDesc
)
func file_node_service_proto_rawDescGZIP() []byte {
file_node_service_proto_rawDescOnce.Do(func() {
file_node_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_node_service_proto_rawDescData)
})
return file_node_service_proto_rawDescData
}
var file_node_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_node_service_proto_goTypes = []interface{}{
(*ConfigRequest)(nil), // 0: node.ConfigRequest
(*ConfigResponse)(nil), // 1: node.ConfigResponse
}
var file_node_service_proto_depIdxs = []int32{
0, // 0: node.Service.config:input_type -> node.ConfigRequest
1, // 1: node.Service.config:output_type -> node.ConfigResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_node_service_proto_init() }
func file_node_service_proto_init() {
if File_node_service_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_node_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ConfigRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_node_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ConfigResponse); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_node_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_node_service_proto_goTypes,
DependencyIndexes: file_node_service_proto_depIdxs,
MessageInfos: file_node_service_proto_msgTypes,
}.Build()
File_node_service_proto = out.File
file_node_service_proto_rawDesc = nil
file_node_service_proto_goTypes = nil
file_node_service_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// ServiceClient is the client API for Service service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ServiceClient interface {
Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error)
}
type serviceClient struct {
cc grpc.ClientConnInterface
}
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
return &serviceClient{cc}
}
func (c *serviceClient) Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) {
out := new(ConfigResponse)
err := c.cc.Invoke(ctx, "/node.Service/config", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServiceServer is the server API for Service service.
type ServiceServer interface {
Config(context.Context, *ConfigRequest) (*ConfigResponse, error)
}
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
type UnimplementedServiceServer struct {
}
func (*UnimplementedServiceServer) Config(context.Context, *ConfigRequest) (*ConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Config not implemented")
}
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
s.RegisterService(&_Service_serviceDesc, srv)
}
func _Service_Config_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServiceServer).Config(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.Service/Config",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServiceServer).Config(ctx, req.(*ConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Service_serviceDesc = grpc.ServiceDesc{
ServiceName: "node.Service",
HandlerType: (*ServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "config",
Handler: _Service_Config_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "node/service.proto",
}

View File

@@ -1,19 +0,0 @@
syntax = "proto3";
package node;
option go_package = "./node";
service Service {
rpc config (ConfigRequest) returns (ConfigResponse) {
}
}
message ConfigRequest {
string nodeId = 1;
}
message ConfigResponse {
string id = 1;
}

View File

@@ -0,0 +1,260 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_node.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Node struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"`
InstallDir string `protobuf:"bytes,4,opt,name=installDir,proto3" json:"installDir,omitempty"`
IsInstalled bool `protobuf:"varint,5,opt,name=isInstalled,proto3" json:"isInstalled,omitempty"`
Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"`
UniqueId string `protobuf:"bytes,7,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
Secret string `protobuf:"bytes,8,opt,name=secret,proto3" json:"secret,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"`
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
}
func (x *Node) Reset() {
*x = Node{}
if protoimpl.UnsafeEnabled {
mi := &file_model_node_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Node) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Node) ProtoMessage() {}
func (x *Node) ProtoReflect() protoreflect.Message {
mi := &file_model_node_proto_msgTypes[0]
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 Node.ProtoReflect.Descriptor instead.
func (*Node) Descriptor() ([]byte, []int) {
return file_model_node_proto_rawDescGZIP(), []int{0}
}
func (x *Node) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *Node) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *Node) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
func (x *Node) GetInstallDir() string {
if x != nil {
return x.InstallDir
}
return ""
}
func (x *Node) GetIsInstalled() bool {
if x != nil {
return x.IsInstalled
}
return false
}
func (x *Node) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *Node) GetUniqueId() string {
if x != nil {
return x.UniqueId
}
return ""
}
func (x *Node) GetSecret() string {
if x != nil {
return x.Secret
}
return ""
}
func (x *Node) GetCluster() *NodeCluster {
if x != nil {
return x.Cluster
}
return nil
}
func (x *Node) GetLogin() *NodeLogin {
if x != nil {
return x.Login
}
return nil
}
func (x *Node) GetInstallStatus() *NodeInstallStatus {
if x != nil {
return x.InstallStatus
}
return nil
}
var File_model_node_proto protoreflect.FileDescriptor
var file_model_node_proto_rawDesc = []byte{
0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f,
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, 0x1a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x02, 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, 0x1e,
0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x20,
0x0a, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20,
0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64,
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 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, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_model_node_proto_rawDescOnce sync.Once
file_model_node_proto_rawDescData = file_model_node_proto_rawDesc
)
func file_model_node_proto_rawDescGZIP() []byte {
file_model_node_proto_rawDescOnce.Do(func() {
file_model_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_proto_rawDescData)
})
return file_model_node_proto_rawDescData
}
var file_model_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_node_proto_goTypes = []interface{}{
(*Node)(nil), // 0: pb.Node
(*NodeCluster)(nil), // 1: pb.NodeCluster
(*NodeLogin)(nil), // 2: pb.NodeLogin
(*NodeInstallStatus)(nil), // 3: pb.NodeInstallStatus
}
var file_model_node_proto_depIdxs = []int32{
1, // 0: pb.Node.cluster:type_name -> pb.NodeCluster
2, // 1: pb.Node.login:type_name -> pb.NodeLogin
3, // 2: pb.Node.installStatus:type_name -> pb.NodeInstallStatus
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_model_node_proto_init() }
func file_model_node_proto_init() {
if File_model_node_proto != nil {
return
}
file_model_node_cluster_proto_init()
file_model_node_login_proto_init()
file_model_node_install_status_proto_init()
if !protoimpl.UnsafeEnabled {
file_model_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Node); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_node_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_node_proto_goTypes,
DependencyIndexes: file_model_node_proto_depIdxs,
MessageInfos: file_model_node_proto_msgTypes,
}.Build()
File_model_node_proto = out.File
file_model_node_proto_rawDesc = nil
file_model_node_proto_goTypes = nil
file_model_node_proto_depIdxs = nil
}

View File

@@ -0,0 +1,185 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_node_cluster.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type NodeCluster struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
GrantId int64 `protobuf:"varint,4,opt,name=grantId,proto3" json:"grantId,omitempty"`
InstallDir string `protobuf:"bytes,5,opt,name=installDir,proto3" json:"installDir,omitempty"`
}
func (x *NodeCluster) Reset() {
*x = NodeCluster{}
if protoimpl.UnsafeEnabled {
mi := &file_model_node_cluster_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeCluster) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeCluster) ProtoMessage() {}
func (x *NodeCluster) ProtoReflect() protoreflect.Message {
mi := &file_model_node_cluster_proto_msgTypes[0]
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 NodeCluster.ProtoReflect.Descriptor instead.
func (*NodeCluster) Descriptor() ([]byte, []int) {
return file_model_node_cluster_proto_rawDescGZIP(), []int{0}
}
func (x *NodeCluster) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *NodeCluster) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *NodeCluster) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *NodeCluster) GetGrantId() int64 {
if x != nil {
return x.GrantId
}
return 0
}
func (x *NodeCluster) GetInstallDir() string {
if x != nil {
return x.InstallDir
}
return ""
}
var File_model_node_cluster_proto protoreflect.FileDescriptor
var file_model_node_cluster_proto_rawDesc = []byte{
0x0a, 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, 0x12, 0x02, 0x70, 0x62, 0x22, 0x89,
0x01, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 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, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
0x03, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e,
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_model_node_cluster_proto_rawDescOnce sync.Once
file_model_node_cluster_proto_rawDescData = file_model_node_cluster_proto_rawDesc
)
func file_model_node_cluster_proto_rawDescGZIP() []byte {
file_model_node_cluster_proto_rawDescOnce.Do(func() {
file_model_node_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_cluster_proto_rawDescData)
})
return file_model_node_cluster_proto_rawDescData
}
var file_model_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_node_cluster_proto_goTypes = []interface{}{
(*NodeCluster)(nil), // 0: pb.NodeCluster
}
var file_model_node_cluster_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_model_node_cluster_proto_init() }
func file_model_node_cluster_proto_init() {
if File_model_node_cluster_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_model_node_cluster_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeCluster); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_node_cluster_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_node_cluster_proto_goTypes,
DependencyIndexes: file_model_node_cluster_proto_depIdxs,
MessageInfos: file_model_node_cluster_proto_msgTypes,
}.Build()
File_model_node_cluster_proto = out.File
file_model_node_cluster_proto_rawDesc = nil
file_model_node_cluster_proto_goTypes = nil
file_model_node_cluster_proto_depIdxs = nil
}

View File

@@ -0,0 +1,223 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_node_grant.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type NodeGrant struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"`
Su bool `protobuf:"varint,6,opt,name=su,proto3" json:"su,omitempty"`
PrivateKey string `protobuf:"bytes,7,opt,name=privateKey,proto3" json:"privateKey,omitempty"`
Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"`
NodeId int64 `protobuf:"varint,9,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
}
func (x *NodeGrant) Reset() {
*x = NodeGrant{}
if protoimpl.UnsafeEnabled {
mi := &file_model_node_grant_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeGrant) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeGrant) ProtoMessage() {}
func (x *NodeGrant) ProtoReflect() protoreflect.Message {
mi := &file_model_node_grant_proto_msgTypes[0]
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 NodeGrant.ProtoReflect.Descriptor instead.
func (*NodeGrant) Descriptor() ([]byte, []int) {
return file_model_node_grant_proto_rawDescGZIP(), []int{0}
}
func (x *NodeGrant) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *NodeGrant) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *NodeGrant) GetMethod() string {
if x != nil {
return x.Method
}
return ""
}
func (x *NodeGrant) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *NodeGrant) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *NodeGrant) GetSu() bool {
if x != nil {
return x.Su
}
return false
}
func (x *NodeGrant) GetPrivateKey() string {
if x != nil {
return x.PrivateKey
}
return ""
}
func (x *NodeGrant) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *NodeGrant) GetNodeId() int64 {
if x != nil {
return x.NodeId
}
return 0
}
var File_model_node_grant_proto protoreflect.FileDescriptor
var file_model_node_grant_proto_rawDesc = []byte{
0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x72, 0x61,
0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xe9, 0x01, 0x0a,
0x09, 0x4e, 0x6f, 0x64, 0x65, 0x47, 0x72, 0x61, 0x6e, 0x74, 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, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x0e,
0x0a, 0x02, 0x73, 0x75, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x73, 0x75, 0x12, 0x1e,
0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20,
0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_model_node_grant_proto_rawDescOnce sync.Once
file_model_node_grant_proto_rawDescData = file_model_node_grant_proto_rawDesc
)
func file_model_node_grant_proto_rawDescGZIP() []byte {
file_model_node_grant_proto_rawDescOnce.Do(func() {
file_model_node_grant_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_grant_proto_rawDescData)
})
return file_model_node_grant_proto_rawDescData
}
var file_model_node_grant_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_node_grant_proto_goTypes = []interface{}{
(*NodeGrant)(nil), // 0: pb.NodeGrant
}
var file_model_node_grant_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_model_node_grant_proto_init() }
func file_model_node_grant_proto_init() {
if File_model_node_grant_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_model_node_grant_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeGrant); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_node_grant_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_node_grant_proto_goTypes,
DependencyIndexes: file_model_node_grant_proto_depIdxs,
MessageInfos: file_model_node_grant_proto_msgTypes,
}.Build()
File_model_node_grant_proto = out.File
file_model_node_grant_proto_rawDesc = nil
file_model_node_grant_proto_goTypes = nil
file_model_node_grant_proto_depIdxs = nil
}

View File

@@ -0,0 +1,187 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_node_install_status.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type NodeInstallStatus struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
IsRunning bool `protobuf:"varint,1,opt,name=isRunning,proto3" json:"isRunning,omitempty"`
IsFinished bool `protobuf:"varint,2,opt,name=isFinished,proto3" json:"isFinished,omitempty"`
IsOk bool `protobuf:"varint,3,opt,name=isOk,proto3" json:"isOk,omitempty"`
Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
UpdatedAt int64 `protobuf:"varint,5,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
}
func (x *NodeInstallStatus) Reset() {
*x = NodeInstallStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_model_node_install_status_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeInstallStatus) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeInstallStatus) ProtoMessage() {}
func (x *NodeInstallStatus) ProtoReflect() protoreflect.Message {
mi := &file_model_node_install_status_proto_msgTypes[0]
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 NodeInstallStatus.ProtoReflect.Descriptor instead.
func (*NodeInstallStatus) Descriptor() ([]byte, []int) {
return file_model_node_install_status_proto_rawDescGZIP(), []int{0}
}
func (x *NodeInstallStatus) GetIsRunning() bool {
if x != nil {
return x.IsRunning
}
return false
}
func (x *NodeInstallStatus) GetIsFinished() bool {
if x != nil {
return x.IsFinished
}
return false
}
func (x *NodeInstallStatus) GetIsOk() bool {
if x != nil {
return x.IsOk
}
return false
}
func (x *NodeInstallStatus) GetError() string {
if x != nil {
return x.Error
}
return ""
}
func (x *NodeInstallStatus) GetUpdatedAt() int64 {
if x != nil {
return x.UpdatedAt
}
return 0
}
var File_model_node_install_status_proto protoreflect.FileDescriptor
var file_model_node_install_status_proto_rawDesc = []byte{
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x73,
0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x99, 0x01, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e,
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69,
0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x69, 0x73, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x46,
0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69,
0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f,
0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x14, 0x0a,
0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41,
0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_model_node_install_status_proto_rawDescOnce sync.Once
file_model_node_install_status_proto_rawDescData = file_model_node_install_status_proto_rawDesc
)
func file_model_node_install_status_proto_rawDescGZIP() []byte {
file_model_node_install_status_proto_rawDescOnce.Do(func() {
file_model_node_install_status_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_install_status_proto_rawDescData)
})
return file_model_node_install_status_proto_rawDescData
}
var file_model_node_install_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_node_install_status_proto_goTypes = []interface{}{
(*NodeInstallStatus)(nil), // 0: pb.NodeInstallStatus
}
var file_model_node_install_status_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_model_node_install_status_proto_init() }
func file_model_node_install_status_proto_init() {
if File_model_node_install_status_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_model_node_install_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeInstallStatus); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_node_install_status_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_node_install_status_proto_goTypes,
DependencyIndexes: file_model_node_install_status_proto_depIdxs,
MessageInfos: file_model_node_install_status_proto_msgTypes,
}.Build()
File_model_node_install_status_proto = out.File
file_model_node_install_status_proto_rawDesc = nil
file_model_node_install_status_proto_goTypes = nil
file_model_node_install_status_proto_depIdxs = nil
}

View File

@@ -0,0 +1,174 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_node_login.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type NodeLogin struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Params []byte `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"`
}
func (x *NodeLogin) Reset() {
*x = NodeLogin{}
if protoimpl.UnsafeEnabled {
mi := &file_model_node_login_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeLogin) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeLogin) ProtoMessage() {}
func (x *NodeLogin) ProtoReflect() protoreflect.Message {
mi := &file_model_node_login_proto_msgTypes[0]
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 NodeLogin.ProtoReflect.Descriptor instead.
func (*NodeLogin) Descriptor() ([]byte, []int) {
return file_model_node_login_proto_rawDescGZIP(), []int{0}
}
func (x *NodeLogin) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *NodeLogin) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *NodeLogin) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *NodeLogin) GetParams() []byte {
if x != nil {
return x.Params
}
return nil
}
var File_model_node_login_proto protoreflect.FileDescriptor
var file_model_node_login_proto_rawDesc = []byte{
0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67,
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x5b, 0x0a, 0x09,
0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 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, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_model_node_login_proto_rawDescOnce sync.Once
file_model_node_login_proto_rawDescData = file_model_node_login_proto_rawDesc
)
func file_model_node_login_proto_rawDescGZIP() []byte {
file_model_node_login_proto_rawDescOnce.Do(func() {
file_model_node_login_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_login_proto_rawDescData)
})
return file_model_node_login_proto_rawDescData
}
var file_model_node_login_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_node_login_proto_goTypes = []interface{}{
(*NodeLogin)(nil), // 0: pb.NodeLogin
}
var file_model_node_login_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_model_node_login_proto_init() }
func file_model_node_login_proto_init() {
if File_model_node_login_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_model_node_login_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeLogin); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_node_login_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_node_login_proto_goTypes,
DependencyIndexes: file_model_node_login_proto_depIdxs,
MessageInfos: file_model_node_login_proto_msgTypes,
}.Build()
File_model_node_login_proto = out.File
file_model_node_login_proto_rawDesc = nil
file_model_node_login_proto_goTypes = nil
file_model_node_login_proto_depIdxs = nil
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,174 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "model_node.proto";
import "model_node_login.proto";
service NodeService {
// 创建节点
rpc createNode (CreateNodeRequest) returns (CreateNodeResponse);
// 节点数量
rpc countAllEnabledNodes (CountAllEnabledNodesRequest) returns (CountAllEnabledNodesResponse);
// 计算匹配的节点数量
rpc countAllEnabledNodesMatch (CountAllEnabledNodesMatchRequest) returns (CountAllEnabledNodesMatchResponse);
// 列出单页节点
rpc listEnabledNodesMatch (ListEnabledNodesMatchRequest) returns (ListEnabledNodesMatchResponse);
// 禁用节点
rpc disableNode (DisableNodeRequest) returns (DisableNodeResponse);
// 修改节点
rpc updateNode (UpdateNodeRequest) returns (UpdateNodeResponse);
// 查看单个节点
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);
// 修改节点安装状态
rpc updateNodeIsInstalled (UpdateNodeIsInstalledRequest) returns (UpdateNodeIsInstalledResponse);
// 安装节点
rpc installNode (InstallNodeRequest) returns (InstallNodeResponse);
}
// 创建节点
message CreateNodeRequest {
string name = 1;
int64 clusterId = 2;
NodeLogin Login = 3;
}
message CreateNodeResponse {
int64 nodeId = 1;
}
// 节点数量
message CountAllEnabledNodesRequest {
}
message CountAllEnabledNodesResponse {
int64 count = 1;
}
// 列出单页节点
message ListEnabledNodesMatchRequest {
int64 offset = 1;
int64 size = 2;
int64 clusterId = 3;
int32 installState = 4;
}
message ListEnabledNodesMatchResponse {
repeated Node nodes = 1;
}
// 禁用节点
message DisableNodeRequest {
int64 nodeId = 1;
}
message DisableNodeResponse {
}
// 修改节点
message UpdateNodeRequest {
int64 nodeId = 1;
string name = 2;
int64 clusterId = 3;
NodeLogin Login = 4;
}
message UpdateNodeResponse {
}
// 查找节点
message FindEnabledNodeRequest {
int64 nodeId = 1;
}
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 {
}
// 计算匹配的节点数量
message CountAllEnabledNodesMatchRequest {
int64 clusterId = 1;
int32 installState = 2;
}
message CountAllEnabledNodesMatchResponse {
int64 count = 1;
}
// 修改节点安装状态
message UpdateNodeIsInstalledRequest {
int64 nodeId = 1;
bool isInstalled = 2;
}
message UpdateNodeIsInstalledResponse {
}
// 安装节点
message InstallNodeRequest {
int64 nodeId = 1;
}
message InstallNodeResponse {
}

View File

@@ -0,0 +1,81 @@
package rpc
import (
"context"
"encoding/base64"
"errors"
"github.com/TeaOSLab/EdgeNode/internal/configs"
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"github.com/TeaOSLab/EdgeNode/internal/encrypt"
"github.com/TeaOSLab/EdgeNode/internal/rpc/pb"
"github.com/TeaOSLab/EdgeNode/internal/utils"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/rands"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"time"
)
type RPCClient struct {
apiConfig *configs.APIConfig
nodeClients []pb.NodeServiceClient
}
func NewRPCClient(apiConfig *configs.APIConfig) (*RPCClient, error) {
if apiConfig == nil {
return nil, errors.New("api config should not be nil")
}
nodeClients := []pb.NodeServiceClient{}
conns := []*grpc.ClientConn{}
for _, endpoint := range apiConfig.RPC.Endpoints {
conn, err := grpc.Dial(endpoint, grpc.WithInsecure())
if err != nil {
return nil, err
}
conns = append(conns, conn)
}
if len(conns) == 0 {
return nil, errors.New("[RPC]no available endpoints")
}
// node clients
for _, conn := range conns {
nodeClients = append(nodeClients, pb.NewNodeServiceClient(conn))
}
return &RPCClient{
apiConfig: apiConfig,
nodeClients: nodeClients,
}, nil
}
func (this *RPCClient) NodeRPC() pb.NodeServiceClient {
if len(this.nodeClients) > 0 {
return this.nodeClients[rands.Int(0, len(this.nodeClients)-1)]
}
return nil
}
func (this *RPCClient) Context() context.Context {
ctx := context.Background()
m := maps.Map{
"timestamp": time.Now().Unix(),
"type": "node",
"userId": 0,
}
method, err := encrypt.NewMethodInstance(teaconst.EncryptMethod, this.apiConfig.Secret, this.apiConfig.NodeId)
if err != nil {
utils.PrintError(err)
return context.Background()
}
data, err := method.Encrypt(m.AsJSON())
if err != nil {
utils.PrintError(err)
return context.Background()
}
token := base64.StdEncoding.EncodeToString(data)
ctx = metadata.AppendToOutgoingContext(ctx, "nodeId", this.apiConfig.NodeId, "token", token)
return ctx
}

View File

@@ -0,0 +1,51 @@
package rpc
import (
"github.com/TeaOSLab/EdgeNode/internal/configs"
"github.com/TeaOSLab/EdgeNode/internal/rpc/pb"
_ "github.com/iwind/TeaGo/bootstrap"
"testing"
"time"
)
func TestRPCClient_NodeRPC(t *testing.T) {
before := time.Now()
defer func() {
t.Log(time.Since(before).Seconds()*1000, "ms")
}()
config, err := configs.LoadAPIConfig()
if err != nil {
t.Fatal(err)
}
rpc, err := NewRPCClient(config)
if err != nil {
t.Fatal(err)
}
resp, err := rpc.NodeRPC().ComposeNodeConfig(rpc.Context(), &pb.ComposeNodeConfigRequest{})
if err != nil {
t.Fatal(err)
}
t.Log(resp)
}
func TestSharedRPC_Stream(t *testing.T) {
config, err := configs.LoadAPIConfig()
if err != nil {
t.Fatal(err)
}
rpc, err := NewRPCClient(config)
if err != nil {
t.Fatal(err)
}
client, err := rpc.NodeRPC().NodeStream(rpc.Context())
if err != nil {
t.Fatal(err)
}
for {
resp, err := client.Recv()
if err != nil {
t.Fatal(err)
}
t.Log("recv:", resp)
}
}

30
internal/rpc/rpc_utils.go Normal file
View File

@@ -0,0 +1,30 @@
package rpc
import (
"github.com/TeaOSLab/EdgeNode/internal/configs"
"sync"
)
var sharedRPC *RPCClient = nil
var locker = &sync.Mutex{}
func SharedRPC() (*RPCClient, error) {
locker.Lock()
defer locker.Unlock()
if sharedRPC != nil {
return sharedRPC, nil
}
config, err := configs.LoadAPIConfig()
if err != nil {
return nil, err
}
client, err := NewRPCClient(config)
if err != nil {
return nil, err
}
sharedRPC = client
return sharedRPC, nil
}