diff --git a/pkg/nodeconfigs/node_config.go b/pkg/nodeconfigs/node_config.go index ad99b6d..22b9eee 100644 --- a/pkg/nodeconfigs/node_config.go +++ b/pkg/nodeconfigs/node_config.go @@ -12,7 +12,8 @@ import ( var sharedNodeConfig *NodeConfig = nil type NodeConfig struct { - Id string `yaml:"id" json:"id"` + Id int64 `yaml:"id" json:"id"` + NodeId string `yaml:"nodeId" json:"nodeId"` IsOn bool `yaml:"isOn" json:"isOn"` Servers []*serverconfigs.ServerConfig `yaml:"servers" json:"servers"` Version int64 `yaml:"version" json:"version"` diff --git a/pkg/rpc/pb/model_node_log.pb.go b/pkg/rpc/pb/model_node_log.pb.go new file mode 100644 index 0000000..cd41472 --- /dev/null +++ b/pkg/rpc/pb/model_node_log.pb.go @@ -0,0 +1,194 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_node_log.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 NodeLog struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Tag string `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Level string `protobuf:"bytes,4,opt,name=level,proto3" json:"level,omitempty"` + NodeId int64 `protobuf:"varint,5,opt,name=nodeId,proto3" json:"nodeId,omitempty"` + CreatedAt int64 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` +} + +func (x *NodeLog) Reset() { + *x = NodeLog{} + if protoimpl.UnsafeEnabled { + mi := &file_model_node_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeLog) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeLog) ProtoMessage() {} + +func (x *NodeLog) ProtoReflect() protoreflect.Message { + mi := &file_model_node_log_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 NodeLog.ProtoReflect.Descriptor instead. +func (*NodeLog) Descriptor() ([]byte, []int) { + return file_model_node_log_proto_rawDescGZIP(), []int{0} +} + +func (x *NodeLog) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *NodeLog) GetTag() string { + if x != nil { + return x.Tag + } + return "" +} + +func (x *NodeLog) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *NodeLog) GetLevel() string { + if x != nil { + return x.Level + } + return "" +} + +func (x *NodeLog) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *NodeLog) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +var File_model_node_log_proto protoreflect.FileDescriptor + +var file_model_node_log_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x9d, 0x01, 0x0a, 0x07, 0x4e, + 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, + 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, + 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x63, 0x72, 0x65, 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_log_proto_rawDescOnce sync.Once + file_model_node_log_proto_rawDescData = file_model_node_log_proto_rawDesc +) + +func file_model_node_log_proto_rawDescGZIP() []byte { + file_model_node_log_proto_rawDescOnce.Do(func() { + file_model_node_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_log_proto_rawDescData) + }) + return file_model_node_log_proto_rawDescData +} + +var file_model_node_log_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_node_log_proto_goTypes = []interface{}{ + (*NodeLog)(nil), // 0: pb.NodeLog +} +var file_model_node_log_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_log_proto_init() } +func file_model_node_log_proto_init() { + if File_model_node_log_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_node_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeLog); 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_log_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_node_log_proto_goTypes, + DependencyIndexes: file_model_node_log_proto_depIdxs, + MessageInfos: file_model_node_log_proto_msgTypes, + }.Build() + File_model_node_log_proto = out.File + file_model_node_log_proto_rawDesc = nil + file_model_node_log_proto_goTypes = nil + file_model_node_log_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/service_node_log.pb.go b/pkg/rpc/pb/service_node_log.pb.go new file mode 100644 index 0000000..20077d3 --- /dev/null +++ b/pkg/rpc/pb/service_node_log.pb.go @@ -0,0 +1,682 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_node_log.proto + +package pb + +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 CreateNodeLogsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeLogs []*NodeLog `protobuf:"bytes,1,rep,name=nodeLogs,proto3" json:"nodeLogs,omitempty"` +} + +func (x *CreateNodeLogsRequest) Reset() { + *x = CreateNodeLogsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNodeLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNodeLogsRequest) ProtoMessage() {} + +func (x *CreateNodeLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_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 CreateNodeLogsRequest.ProtoReflect.Descriptor instead. +func (*CreateNodeLogsRequest) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateNodeLogsRequest) GetNodeLogs() []*NodeLog { + if x != nil { + return x.NodeLogs + } + return nil +} + +type CreateNodeLogsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CreateNodeLogsResponse) Reset() { + *x = CreateNodeLogsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNodeLogsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNodeLogsResponse) ProtoMessage() {} + +func (x *CreateNodeLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_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 CreateNodeLogsResponse.ProtoReflect.Descriptor instead. +func (*CreateNodeLogsResponse) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{1} +} + +// 查询日志数量 +type CountNodeLogsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` +} + +func (x *CountNodeLogsRequest) Reset() { + *x = CountNodeLogsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountNodeLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountNodeLogsRequest) ProtoMessage() {} + +func (x *CountNodeLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountNodeLogsRequest.ProtoReflect.Descriptor instead. +func (*CountNodeLogsRequest) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{2} +} + +func (x *CountNodeLogsRequest) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *CountNodeLogsRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +type CountNodeLogsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` +} + +func (x *CountNodeLogsResponse) Reset() { + *x = CountNodeLogsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountNodeLogsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountNodeLogsResponse) ProtoMessage() {} + +func (x *CountNodeLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountNodeLogsResponse.ProtoReflect.Descriptor instead. +func (*CountNodeLogsResponse) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{3} +} + +func (x *CountNodeLogsResponse) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +// 列出单页日志 +type ListNodeLogsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListNodeLogsRequest) Reset() { + *x = ListNodeLogsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListNodeLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListNodeLogsRequest) ProtoMessage() {} + +func (x *ListNodeLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_proto_msgTypes[4] + 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 ListNodeLogsRequest.ProtoReflect.Descriptor instead. +func (*ListNodeLogsRequest) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{4} +} + +func (x *ListNodeLogsRequest) GetNodeId() int64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *ListNodeLogsRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *ListNodeLogsRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListNodeLogsRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListNodeLogsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeLogs []*NodeLog `protobuf:"bytes,1,rep,name=nodeLogs,proto3" json:"nodeLogs,omitempty"` +} + +func (x *ListNodeLogsResponse) Reset() { + *x = ListNodeLogsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListNodeLogsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListNodeLogsResponse) ProtoMessage() {} + +func (x *ListNodeLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_proto_msgTypes[5] + 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 ListNodeLogsResponse.ProtoReflect.Descriptor instead. +func (*ListNodeLogsResponse) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{5} +} + +func (x *ListNodeLogsResponse) GetNodeLogs() []*NodeLog { + if x != nil { + return x.NodeLogs + } + return nil +} + +var File_service_node_log_proto protoreflect.FileDescriptor + +var file_service_node_log_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, + 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x14, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x40, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x6e, + 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, + 0x4c, 0x6f, 0x67, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, + 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, + 0x0a, 0x14, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, + 0x6c, 0x65, 0x22, 0x2d, 0x0a, 0x15, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, + 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x6d, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x22, 0x3f, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, + 0x4c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, + 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, + 0x73, 0x32, 0xe2, 0x01, 0x0a, 0x0e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, + 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, + 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, + 0x0d, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x18, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, + 0x6f, 0x67, 0x73, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, + 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, + 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_node_log_proto_rawDescOnce sync.Once + file_service_node_log_proto_rawDescData = file_service_node_log_proto_rawDesc +) + +func file_service_node_log_proto_rawDescGZIP() []byte { + file_service_node_log_proto_rawDescOnce.Do(func() { + file_service_node_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_node_log_proto_rawDescData) + }) + return file_service_node_log_proto_rawDescData +} + +var file_service_node_log_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_service_node_log_proto_goTypes = []interface{}{ + (*CreateNodeLogsRequest)(nil), // 0: pb.CreateNodeLogsRequest + (*CreateNodeLogsResponse)(nil), // 1: pb.CreateNodeLogsResponse + (*CountNodeLogsRequest)(nil), // 2: pb.CountNodeLogsRequest + (*CountNodeLogsResponse)(nil), // 3: pb.CountNodeLogsResponse + (*ListNodeLogsRequest)(nil), // 4: pb.ListNodeLogsRequest + (*ListNodeLogsResponse)(nil), // 5: pb.ListNodeLogsResponse + (*NodeLog)(nil), // 6: pb.NodeLog +} +var file_service_node_log_proto_depIdxs = []int32{ + 6, // 0: pb.CreateNodeLogsRequest.nodeLogs:type_name -> pb.NodeLog + 6, // 1: pb.ListNodeLogsResponse.nodeLogs:type_name -> pb.NodeLog + 0, // 2: pb.NodeLogService.createNodeLogs:input_type -> pb.CreateNodeLogsRequest + 2, // 3: pb.NodeLogService.countNodeLogs:input_type -> pb.CountNodeLogsRequest + 4, // 4: pb.NodeLogService.listNodeLogs:input_type -> pb.ListNodeLogsRequest + 1, // 5: pb.NodeLogService.createNodeLogs:output_type -> pb.CreateNodeLogsResponse + 3, // 6: pb.NodeLogService.countNodeLogs:output_type -> pb.CountNodeLogsResponse + 5, // 7: pb.NodeLogService.listNodeLogs:output_type -> pb.ListNodeLogsResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_service_node_log_proto_init() } +func file_service_node_log_proto_init() { + if File_service_node_log_proto != nil { + return + } + file_model_node_log_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_node_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNodeLogsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_log_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNodeLogsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_log_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountNodeLogsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_log_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountNodeLogsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_log_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListNodeLogsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_node_log_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListNodeLogsResponse); 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_service_node_log_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_node_log_proto_goTypes, + DependencyIndexes: file_service_node_log_proto_depIdxs, + MessageInfos: file_service_node_log_proto_msgTypes, + }.Build() + File_service_node_log_proto = out.File + file_service_node_log_proto_rawDesc = nil + file_service_node_log_proto_goTypes = nil + file_service_node_log_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 + +// NodeLogServiceClient is the client API for NodeLogService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NodeLogServiceClient interface { + // 创建日志 + CreateNodeLogs(ctx context.Context, in *CreateNodeLogsRequest, opts ...grpc.CallOption) (*CreateNodeLogsResponse, error) + // 查询日志数量 + CountNodeLogs(ctx context.Context, in *CountNodeLogsRequest, opts ...grpc.CallOption) (*CountNodeLogsResponse, error) + // 列出单页日志 + ListNodeLogs(ctx context.Context, in *ListNodeLogsRequest, opts ...grpc.CallOption) (*ListNodeLogsResponse, error) +} + +type nodeLogServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNodeLogServiceClient(cc grpc.ClientConnInterface) NodeLogServiceClient { + return &nodeLogServiceClient{cc} +} + +func (c *nodeLogServiceClient) CreateNodeLogs(ctx context.Context, in *CreateNodeLogsRequest, opts ...grpc.CallOption) (*CreateNodeLogsResponse, error) { + out := new(CreateNodeLogsResponse) + err := c.cc.Invoke(ctx, "/pb.NodeLogService/createNodeLogs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeLogServiceClient) CountNodeLogs(ctx context.Context, in *CountNodeLogsRequest, opts ...grpc.CallOption) (*CountNodeLogsResponse, error) { + out := new(CountNodeLogsResponse) + err := c.cc.Invoke(ctx, "/pb.NodeLogService/countNodeLogs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeLogServiceClient) ListNodeLogs(ctx context.Context, in *ListNodeLogsRequest, opts ...grpc.CallOption) (*ListNodeLogsResponse, error) { + out := new(ListNodeLogsResponse) + err := c.cc.Invoke(ctx, "/pb.NodeLogService/listNodeLogs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NodeLogServiceServer is the server API for NodeLogService service. +type NodeLogServiceServer interface { + // 创建日志 + CreateNodeLogs(context.Context, *CreateNodeLogsRequest) (*CreateNodeLogsResponse, error) + // 查询日志数量 + CountNodeLogs(context.Context, *CountNodeLogsRequest) (*CountNodeLogsResponse, error) + // 列出单页日志 + ListNodeLogs(context.Context, *ListNodeLogsRequest) (*ListNodeLogsResponse, error) +} + +// UnimplementedNodeLogServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNodeLogServiceServer struct { +} + +func (*UnimplementedNodeLogServiceServer) CreateNodeLogs(context.Context, *CreateNodeLogsRequest) (*CreateNodeLogsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNodeLogs not implemented") +} +func (*UnimplementedNodeLogServiceServer) CountNodeLogs(context.Context, *CountNodeLogsRequest) (*CountNodeLogsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountNodeLogs not implemented") +} +func (*UnimplementedNodeLogServiceServer) ListNodeLogs(context.Context, *ListNodeLogsRequest) (*ListNodeLogsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListNodeLogs not implemented") +} + +func RegisterNodeLogServiceServer(s *grpc.Server, srv NodeLogServiceServer) { + s.RegisterService(&_NodeLogService_serviceDesc, srv) +} + +func _NodeLogService_CreateNodeLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNodeLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeLogServiceServer).CreateNodeLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeLogService/CreateNodeLogs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeLogServiceServer).CreateNodeLogs(ctx, req.(*CreateNodeLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeLogService_CountNodeLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountNodeLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeLogServiceServer).CountNodeLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeLogService/CountNodeLogs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeLogServiceServer).CountNodeLogs(ctx, req.(*CountNodeLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeLogService_ListNodeLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListNodeLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeLogServiceServer).ListNodeLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeLogService/ListNodeLogs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeLogServiceServer).ListNodeLogs(ctx, req.(*ListNodeLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NodeLogService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.NodeLogService", + HandlerType: (*NodeLogServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createNodeLogs", + Handler: _NodeLogService_CreateNodeLogs_Handler, + }, + { + MethodName: "countNodeLogs", + Handler: _NodeLogService_CountNodeLogs_Handler, + }, + { + MethodName: "listNodeLogs", + Handler: _NodeLogService_ListNodeLogs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_node_log.proto", +} diff --git a/pkg/rpc/protos/model_node_log.proto b/pkg/rpc/protos/model_node_log.proto new file mode 100644 index 0000000..6e3911a --- /dev/null +++ b/pkg/rpc/protos/model_node_log.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +message NodeLog { + string role = 1; + string tag = 2; + string description = 3; + string level = 4; + int64 nodeId = 5; + int64 createdAt = 6; +} \ No newline at end of file diff --git a/pkg/rpc/protos/service_node_log.proto b/pkg/rpc/protos/service_node_log.proto new file mode 100644 index 0000000..a8fad1b --- /dev/null +++ b/pkg/rpc/protos/service_node_log.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "model_node_log.proto"; + +// 节点日志相关服务 +service NodeLogService { + // 创建日志 + rpc createNodeLogs (CreateNodeLogsRequest) returns (CreateNodeLogsResponse); + + // 查询日志数量 + rpc countNodeLogs (CountNodeLogsRequest) returns (CountNodeLogsResponse); + + // 列出单页日志 + rpc listNodeLogs (ListNodeLogsRequest) returns (ListNodeLogsResponse); +} + +// 创建日志 +message CreateNodeLogsRequest { + repeated NodeLog nodeLogs = 1; +} + +message CreateNodeLogsResponse { + +} + +// 查询日志数量 +message CountNodeLogsRequest { + int64 nodeId = 1; + string role = 2; +} + +message CountNodeLogsResponse { + int64 count = 1; +} + +// 列出单页日志 +message ListNodeLogsRequest { + int64 nodeId = 1; + string role = 2; + int64 offset = 3; + int64 size = 4; +} + +message ListNodeLogsResponse { + repeated NodeLog nodeLogs = 1; +}