From f2fe314f8594d61bb5385334dbe8e2d8b336f175 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Thu, 14 Oct 2021 17:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=97=A5=E5=BF=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=98=AF=E5=90=A6=E5=B7=B2=E8=AF=BB=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/rpc/pb/service_node_log.pb.go | 374 +++++++++++++++++++++----- pkg/rpc/protos/service_node_log.proto | 17 ++ 2 files changed, 318 insertions(+), 73 deletions(-) diff --git a/pkg/rpc/pb/service_node_log.pb.go b/pkg/rpc/pb/service_node_log.pb.go index c2c0fc1..eb7d9d1 100644 --- a/pkg/rpc/pb/service_node_log.pb.go +++ b/pkg/rpc/pb/service_node_log.pb.go @@ -129,6 +129,7 @@ type CountNodeLogsRequest struct { Level string `protobuf:"bytes,6,opt,name=level,proto3" json:"level,omitempty"` ServerId int64 `protobuf:"varint,7,opt,name=serverId,proto3" json:"serverId,omitempty"` OriginId int64 `protobuf:"varint,8,opt,name=originId,proto3" json:"originId,omitempty"` + IsUnread bool `protobuf:"varint,9,opt,name=isUnread,proto3" json:"isUnread,omitempty"` } func (x *CountNodeLogsRequest) Reset() { @@ -219,6 +220,13 @@ func (x *CountNodeLogsRequest) GetOriginId() int64 { return 0 } +func (x *CountNodeLogsRequest) GetIsUnread() bool { + if x != nil { + return x.IsUnread + } + return false +} + // 列出单页日志 type ListNodeLogsRequest struct { state protoimpl.MessageState @@ -237,6 +245,7 @@ type ListNodeLogsRequest struct { FixedState int32 `protobuf:"varint,10,opt,name=fixedState,proto3" json:"fixedState,omitempty"` AllServers bool `protobuf:"varint,11,opt,name=allServers,proto3" json:"allServers,omitempty"` // 是否获取所有服务相关的日志 OriginId int64 `protobuf:"varint,12,opt,name=originId,proto3" json:"originId,omitempty"` + IsUnread bool `protobuf:"varint,13,opt,name=isUnread,proto3" json:"isUnread,omitempty"` } func (x *ListNodeLogsRequest) Reset() { @@ -355,6 +364,13 @@ func (x *ListNodeLogsRequest) GetOriginId() int64 { return 0 } +func (x *ListNodeLogsRequest) GetIsUnread() bool { + if x != nil { + return x.IsUnread + } + return false +} + type ListNodeLogsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -450,6 +466,93 @@ func (x *FixNodeLogRequest) GetNodeLogId() int64 { return 0 } +// 计算未读的日志数量 +type CountAllUnreadNodeLogsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CountAllUnreadNodeLogsRequest) Reset() { + *x = CountAllUnreadNodeLogsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllUnreadNodeLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllUnreadNodeLogsRequest) ProtoMessage() {} + +func (x *CountAllUnreadNodeLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_proto_msgTypes[6] + 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 CountAllUnreadNodeLogsRequest.ProtoReflect.Descriptor instead. +func (*CountAllUnreadNodeLogsRequest) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{6} +} + +// 设置日志为已读 +type UpdateNodeLogsReadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NodeLogIds []int64 `protobuf:"varint,1,rep,packed,name=nodeLogIds,proto3" json:"nodeLogIds,omitempty"` +} + +func (x *UpdateNodeLogsReadRequest) Reset() { + *x = UpdateNodeLogsReadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_node_log_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNodeLogsReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNodeLogsReadRequest) ProtoMessage() {} + +func (x *UpdateNodeLogsReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_node_log_proto_msgTypes[7] + 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 UpdateNodeLogsReadRequest.ProtoReflect.Descriptor instead. +func (*UpdateNodeLogsReadRequest) Descriptor() ([]byte, []int) { + return file_service_node_log_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateNodeLogsReadRequest) GetNodeLogIds() []int64 { + if x != nil { + return x.NodeLogIds + } + return nil +} + var File_service_node_log_proto protoreflect.FileDescriptor var file_service_node_log_proto_rawDesc = []byte{ @@ -464,7 +567,7 @@ var file_service_node_log_proto_rawDesc = []byte{ 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, 0xda, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, + 0x22, 0xf6, 0x01, 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, @@ -477,53 +580,72 @@ var file_service_node_log_proto_rawDesc = []byte{ 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xc5, 0x02, - 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, 0x12, 0x18, 0x0a, - 0x07, 0x64, 0x61, 0x79, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x64, 0x61, 0x79, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x61, 0x79, 0x54, 0x6f, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x61, 0x79, 0x54, 0x6f, 0x12, 0x18, 0x0a, - 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1a, 0x0a, - 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x78, - 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, - 0x69, 0x78, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, - 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x49, 0x64, 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, 0x22, 0x31, 0x0a, 0x11, 0x46, 0x69, 0x78, 0x4e, 0x6f, 0x64, - 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, - 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x32, 0x92, 0x02, 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, 0x3f, 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, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 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, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x69, 0x73, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x69, 0x73, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x22, 0xe1, 0x02, 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, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x61, 0x79, + 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x79, 0x46, + 0x72, 0x6f, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x61, 0x79, 0x54, 0x6f, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x64, 0x61, 0x79, 0x54, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79, + 0x77, 0x6f, 0x72, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77, + 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x78, 0x65, 0x64, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, 0x69, 0x78, 0x65, 0x64, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, + 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 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, 0x22, 0x31, + 0x0a, 0x11, 0x46, 0x69, 0x78, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x49, + 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x55, 0x6e, 0x72, + 0x65, 0x61, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, + 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x73, 0x32, + 0xaa, 0x03, 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, - 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, 0x12, 0x33, 0x0a, 0x0a, 0x66, 0x69, 0x78, - 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x78, - 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, - 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x3f, 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, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 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, 0x12, + 0x33, 0x0a, 0x0a, 0x66, 0x69, 0x78, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x12, 0x15, 0x2e, + 0x70, 0x62, 0x2e, 0x46, 0x69, 0x78, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, 0x0a, 0x16, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, + 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x21, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x55, 0x6e, 0x72, 0x65, + 0x61, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x61, 0x64, 0x12, 0x1d, 0x2e, + 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, + 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, + 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -538,34 +660,40 @@ func file_service_node_log_proto_rawDescGZIP() []byte { return file_service_node_log_proto_rawDescData } -var file_service_node_log_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_service_node_log_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_service_node_log_proto_goTypes = []interface{}{ - (*CreateNodeLogsRequest)(nil), // 0: pb.CreateNodeLogsRequest - (*CreateNodeLogsResponse)(nil), // 1: pb.CreateNodeLogsResponse - (*CountNodeLogsRequest)(nil), // 2: pb.CountNodeLogsRequest - (*ListNodeLogsRequest)(nil), // 3: pb.ListNodeLogsRequest - (*ListNodeLogsResponse)(nil), // 4: pb.ListNodeLogsResponse - (*FixNodeLogRequest)(nil), // 5: pb.FixNodeLogRequest - (*NodeLog)(nil), // 6: pb.NodeLog - (*RPCCountResponse)(nil), // 7: pb.RPCCountResponse - (*RPCSuccess)(nil), // 8: pb.RPCSuccess + (*CreateNodeLogsRequest)(nil), // 0: pb.CreateNodeLogsRequest + (*CreateNodeLogsResponse)(nil), // 1: pb.CreateNodeLogsResponse + (*CountNodeLogsRequest)(nil), // 2: pb.CountNodeLogsRequest + (*ListNodeLogsRequest)(nil), // 3: pb.ListNodeLogsRequest + (*ListNodeLogsResponse)(nil), // 4: pb.ListNodeLogsResponse + (*FixNodeLogRequest)(nil), // 5: pb.FixNodeLogRequest + (*CountAllUnreadNodeLogsRequest)(nil), // 6: pb.CountAllUnreadNodeLogsRequest + (*UpdateNodeLogsReadRequest)(nil), // 7: pb.UpdateNodeLogsReadRequest + (*NodeLog)(nil), // 8: pb.NodeLog + (*RPCCountResponse)(nil), // 9: pb.RPCCountResponse + (*RPCSuccess)(nil), // 10: pb.RPCSuccess } 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 - 3, // 4: pb.NodeLogService.listNodeLogs:input_type -> pb.ListNodeLogsRequest - 5, // 5: pb.NodeLogService.fixNodeLog:input_type -> pb.FixNodeLogRequest - 1, // 6: pb.NodeLogService.createNodeLogs:output_type -> pb.CreateNodeLogsResponse - 7, // 7: pb.NodeLogService.countNodeLogs:output_type -> pb.RPCCountResponse - 4, // 8: pb.NodeLogService.listNodeLogs:output_type -> pb.ListNodeLogsResponse - 8, // 9: pb.NodeLogService.fixNodeLog:output_type -> pb.RPCSuccess - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] 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 + 8, // 0: pb.CreateNodeLogsRequest.nodeLogs:type_name -> pb.NodeLog + 8, // 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 + 3, // 4: pb.NodeLogService.listNodeLogs:input_type -> pb.ListNodeLogsRequest + 5, // 5: pb.NodeLogService.fixNodeLog:input_type -> pb.FixNodeLogRequest + 6, // 6: pb.NodeLogService.countAllUnreadNodeLogs:input_type -> pb.CountAllUnreadNodeLogsRequest + 7, // 7: pb.NodeLogService.updateNodeLogsRead:input_type -> pb.UpdateNodeLogsReadRequest + 1, // 8: pb.NodeLogService.createNodeLogs:output_type -> pb.CreateNodeLogsResponse + 9, // 9: pb.NodeLogService.countNodeLogs:output_type -> pb.RPCCountResponse + 4, // 10: pb.NodeLogService.listNodeLogs:output_type -> pb.ListNodeLogsResponse + 10, // 11: pb.NodeLogService.fixNodeLog:output_type -> pb.RPCSuccess + 9, // 12: pb.NodeLogService.countAllUnreadNodeLogs:output_type -> pb.RPCCountResponse + 10, // 13: pb.NodeLogService.updateNodeLogsRead:output_type -> pb.RPCSuccess + 8, // [8:14] is the sub-list for method output_type + 2, // [2:8] 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() } @@ -648,6 +776,30 @@ func file_service_node_log_proto_init() { return nil } } + file_service_node_log_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllUnreadNodeLogsRequest); 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[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNodeLogsReadRequest); 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{ @@ -655,7 +807,7 @@ func file_service_node_log_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_node_log_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, @@ -689,6 +841,10 @@ type NodeLogServiceClient interface { ListNodeLogs(ctx context.Context, in *ListNodeLogsRequest, opts ...grpc.CallOption) (*ListNodeLogsResponse, error) // 设置日志为已修复 FixNodeLog(ctx context.Context, in *FixNodeLogRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 计算未读的日志数量 + CountAllUnreadNodeLogs(ctx context.Context, in *CountAllUnreadNodeLogsRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) + // 设置日志为已读 + UpdateNodeLogsRead(ctx context.Context, in *UpdateNodeLogsReadRequest, opts ...grpc.CallOption) (*RPCSuccess, error) } type nodeLogServiceClient struct { @@ -735,6 +891,24 @@ func (c *nodeLogServiceClient) FixNodeLog(ctx context.Context, in *FixNodeLogReq return out, nil } +func (c *nodeLogServiceClient) CountAllUnreadNodeLogs(ctx context.Context, in *CountAllUnreadNodeLogsRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) { + out := new(RPCCountResponse) + err := c.cc.Invoke(ctx, "/pb.NodeLogService/countAllUnreadNodeLogs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeLogServiceClient) UpdateNodeLogsRead(ctx context.Context, in *UpdateNodeLogsReadRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.NodeLogService/updateNodeLogsRead", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // NodeLogServiceServer is the server API for NodeLogService service. type NodeLogServiceServer interface { // 创建日志 @@ -745,6 +919,10 @@ type NodeLogServiceServer interface { ListNodeLogs(context.Context, *ListNodeLogsRequest) (*ListNodeLogsResponse, error) // 设置日志为已修复 FixNodeLog(context.Context, *FixNodeLogRequest) (*RPCSuccess, error) + // 计算未读的日志数量 + CountAllUnreadNodeLogs(context.Context, *CountAllUnreadNodeLogsRequest) (*RPCCountResponse, error) + // 设置日志为已读 + UpdateNodeLogsRead(context.Context, *UpdateNodeLogsReadRequest) (*RPCSuccess, error) } // UnimplementedNodeLogServiceServer can be embedded to have forward compatible implementations. @@ -763,6 +941,12 @@ func (*UnimplementedNodeLogServiceServer) ListNodeLogs(context.Context, *ListNod func (*UnimplementedNodeLogServiceServer) FixNodeLog(context.Context, *FixNodeLogRequest) (*RPCSuccess, error) { return nil, status.Errorf(codes.Unimplemented, "method FixNodeLog not implemented") } +func (*UnimplementedNodeLogServiceServer) CountAllUnreadNodeLogs(context.Context, *CountAllUnreadNodeLogsRequest) (*RPCCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllUnreadNodeLogs not implemented") +} +func (*UnimplementedNodeLogServiceServer) UpdateNodeLogsRead(context.Context, *UpdateNodeLogsReadRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeLogsRead not implemented") +} func RegisterNodeLogServiceServer(s *grpc.Server, srv NodeLogServiceServer) { s.RegisterService(&_NodeLogService_serviceDesc, srv) @@ -840,6 +1024,42 @@ func _NodeLogService_FixNodeLog_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _NodeLogService_CountAllUnreadNodeLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllUnreadNodeLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeLogServiceServer).CountAllUnreadNodeLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeLogService/CountAllUnreadNodeLogs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeLogServiceServer).CountAllUnreadNodeLogs(ctx, req.(*CountAllUnreadNodeLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeLogService_UpdateNodeLogsRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNodeLogsReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeLogServiceServer).UpdateNodeLogsRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NodeLogService/UpdateNodeLogsRead", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeLogServiceServer).UpdateNodeLogsRead(ctx, req.(*UpdateNodeLogsReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _NodeLogService_serviceDesc = grpc.ServiceDesc{ ServiceName: "pb.NodeLogService", HandlerType: (*NodeLogServiceServer)(nil), @@ -860,6 +1080,14 @@ var _NodeLogService_serviceDesc = grpc.ServiceDesc{ MethodName: "fixNodeLog", Handler: _NodeLogService_FixNodeLog_Handler, }, + { + MethodName: "countAllUnreadNodeLogs", + Handler: _NodeLogService_CountAllUnreadNodeLogs_Handler, + }, + { + MethodName: "updateNodeLogsRead", + Handler: _NodeLogService_UpdateNodeLogsRead_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_node_log.proto", diff --git a/pkg/rpc/protos/service_node_log.proto b/pkg/rpc/protos/service_node_log.proto index f0865c6..f34cc62 100644 --- a/pkg/rpc/protos/service_node_log.proto +++ b/pkg/rpc/protos/service_node_log.proto @@ -19,6 +19,12 @@ service NodeLogService { // 设置日志为已修复 rpc fixNodeLog (FixNodeLogRequest) returns (RPCSuccess); + + // 计算未读的日志数量 + rpc countAllUnreadNodeLogs(CountAllUnreadNodeLogsRequest) returns (RPCCountResponse); + + // 设置日志为已读 + rpc updateNodeLogsRead(UpdateNodeLogsReadRequest) returns (RPCSuccess); } // 创建日志 @@ -40,6 +46,7 @@ message CountNodeLogsRequest { string level = 6; int64 serverId = 7; int64 originId = 8; + bool isUnread = 9; } // 列出单页日志 @@ -57,6 +64,7 @@ message ListNodeLogsRequest { int32 fixedState = 10; bool allServers = 11; // 是否获取所有服务相关的日志 int64 originId = 12; + bool isUnread = 13; } message ListNodeLogsResponse { @@ -67,3 +75,12 @@ message ListNodeLogsResponse { message FixNodeLogRequest { int64 nodeLogId = 1; } + +// 计算未读的日志数量 +message CountAllUnreadNodeLogsRequest { +} + +// 设置日志为已读 +message UpdateNodeLogsReadRequest { + repeated int64 nodeLogIds = 1; +} \ No newline at end of file