From daf39bc067838accd4c990be7b6216362f78df61 Mon Sep 17 00:00:00 2001 From: soukainna Date: Mon, 19 Dec 2022 09:13:56 +0100 Subject: [PATCH] add code grpc to manage new collection db groupMember --- config.go | 3 +- grpcapi/groupsmanagement.pb.go | 909 ++++++++++++++++++++++++---- grpcapi/groupsmanagement.proto | 61 +- grpcapi/groupsmanagement_grpc.pb.go | 184 +++++- grpcapi/grpcapi.go | 88 +++ storage/groups.go | 7 + storage/mongodb.go | 114 ++++ storage/storage.go | 6 + 8 files changed, 1249 insertions(+), 123 deletions(-) diff --git a/config.go b/config.go index d5a8a05..0806af2 100644 --- a/config.go +++ b/config.go @@ -18,7 +18,8 @@ func ReadConfig() (*viper.Viper, error) { "port": "27017", "db_name": "coopgo_platform", "collections": map[string]any{ - "groups": "groups", + "groups": "groups", + "groups_member": "groups_member", }, }, }, diff --git a/grpcapi/groupsmanagement.pb.go b/grpcapi/groupsmanagement.pb.go index fd3abfc..0ba93c8 100644 --- a/grpcapi/groupsmanagement.pb.go +++ b/grpcapi/groupsmanagement.pb.go @@ -2,8 +2,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.0 -// protoc v3.19.4 +// protoc-gen-go v1.28.1 +// protoc v3.12.4 // source: groupsmanagement.proto package grpcapi @@ -618,81 +618,623 @@ func (x *UnsubscribeResponse) GetOk() bool { return false } +type AddGroupMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Group *GroupMember `protobuf:"bytes,33,opt,name=group,proto3" json:"group,omitempty"` +} + +func (x *AddGroupMemberRequest) Reset() { + *x = AddGroupMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddGroupMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddGroupMemberRequest) ProtoMessage() {} + +func (x *AddGroupMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[12] + 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 AddGroupMemberRequest.ProtoReflect.Descriptor instead. +func (*AddGroupMemberRequest) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{12} +} + +func (x *AddGroupMemberRequest) GetGroup() *GroupMember { + if x != nil { + return x.Group + } + return nil +} + +type AddGroupMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Group *GroupMember `protobuf:"bytes,34,opt,name=group,proto3" json:"group,omitempty"` +} + +func (x *AddGroupMemberResponse) Reset() { + *x = AddGroupMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddGroupMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddGroupMemberResponse) ProtoMessage() {} + +func (x *AddGroupMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[13] + 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 AddGroupMemberResponse.ProtoReflect.Descriptor instead. +func (*AddGroupMemberResponse) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{13} +} + +func (x *AddGroupMemberResponse) GetGroup() *GroupMember { + if x != nil { + return x.Group + } + return nil +} + +type GetGroupMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,35,opt,name=id,proto3" json:"id,omitempty"` + Groupid string `protobuf:"bytes,36,opt,name=groupid,proto3" json:"groupid,omitempty"` +} + +func (x *GetGroupMemberRequest) Reset() { + *x = GetGroupMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGroupMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGroupMemberRequest) ProtoMessage() {} + +func (x *GetGroupMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[14] + 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 GetGroupMemberRequest.ProtoReflect.Descriptor instead. +func (*GetGroupMemberRequest) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{14} +} + +func (x *GetGroupMemberRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *GetGroupMemberRequest) GetGroupid() string { + if x != nil { + return x.Groupid + } + return "" +} + +type GetGroupMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Group *GroupMember `protobuf:"bytes,37,opt,name=group,proto3" json:"group,omitempty"` +} + +func (x *GetGroupMemberResponse) Reset() { + *x = GetGroupMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGroupMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGroupMemberResponse) ProtoMessage() {} + +func (x *GetGroupMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[15] + 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 GetGroupMemberResponse.ProtoReflect.Descriptor instead. +func (*GetGroupMemberResponse) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{15} +} + +func (x *GetGroupMemberResponse) GetGroup() *GroupMember { + if x != nil { + return x.Group + } + return nil +} + +type GetGroupsMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Namespaces []string `protobuf:"bytes,38,rep,name=namespaces,proto3" json:"namespaces,omitempty"` +} + +func (x *GetGroupsMemberRequest) Reset() { + *x = GetGroupsMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGroupsMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGroupsMemberRequest) ProtoMessage() {} + +func (x *GetGroupsMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[16] + 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 GetGroupsMemberRequest.ProtoReflect.Descriptor instead. +func (*GetGroupsMemberRequest) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{16} +} + +func (x *GetGroupsMemberRequest) GetNamespaces() []string { + if x != nil { + return x.Namespaces + } + return nil +} + +type GetGroupsMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Groups []*GroupMember `protobuf:"bytes,39,rep,name=groups,proto3" json:"groups,omitempty"` +} + +func (x *GetGroupsMemberResponse) Reset() { + *x = GetGroupsMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGroupsMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGroupsMemberResponse) ProtoMessage() {} + +func (x *GetGroupsMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[17] + 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 GetGroupsMemberResponse.ProtoReflect.Descriptor instead. +func (*GetGroupsMemberResponse) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{17} +} + +func (x *GetGroupsMemberResponse) GetGroups() []*GroupMember { + if x != nil { + return x.Groups + } + return nil +} + +type GetGroupsBatchMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Groupids []string `protobuf:"bytes,40,rep,name=groupids,proto3" json:"groupids,omitempty"` +} + +func (x *GetGroupsBatchMemberRequest) Reset() { + *x = GetGroupsBatchMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGroupsBatchMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGroupsBatchMemberRequest) ProtoMessage() {} + +func (x *GetGroupsBatchMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[18] + 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 GetGroupsBatchMemberRequest.ProtoReflect.Descriptor instead. +func (*GetGroupsBatchMemberRequest) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{18} +} + +func (x *GetGroupsBatchMemberRequest) GetGroupids() []string { + if x != nil { + return x.Groupids + } + return nil +} + +type GetGroupsBatchMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Groups []*GroupMember `protobuf:"bytes,41,rep,name=groups,proto3" json:"groups,omitempty"` +} + +func (x *GetGroupsBatchMemberResponse) Reset() { + *x = GetGroupsBatchMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetGroupsBatchMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetGroupsBatchMemberResponse) ProtoMessage() {} + +func (x *GetGroupsBatchMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[19] + 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 GetGroupsBatchMemberResponse.ProtoReflect.Descriptor instead. +func (*GetGroupsBatchMemberResponse) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{19} +} + +func (x *GetGroupsBatchMemberResponse) GetGroups() []*GroupMember { + if x != nil { + return x.Groups + } + return nil +} + +type SubscribeMemberRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Group *GroupMember `protobuf:"bytes,42,opt,name=group,proto3" json:"group,omitempty"` +} + +func (x *SubscribeMemberRequest) Reset() { + *x = SubscribeMemberRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeMemberRequest) ProtoMessage() {} + +func (x *SubscribeMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[20] + 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 SubscribeMemberRequest.ProtoReflect.Descriptor instead. +func (*SubscribeMemberRequest) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{20} +} + +func (x *SubscribeMemberRequest) GetGroup() *GroupMember { + if x != nil { + return x.Group + } + return nil +} + +type SubscribeMemberResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Group *GroupMember `protobuf:"bytes,43,opt,name=group,proto3" json:"group,omitempty"` +} + +func (x *SubscribeMemberResponse) Reset() { + *x = SubscribeMemberResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_groupsmanagement_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeMemberResponse) ProtoMessage() {} + +func (x *SubscribeMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_groupsmanagement_proto_msgTypes[21] + 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 SubscribeMemberResponse.ProtoReflect.Descriptor instead. +func (*SubscribeMemberResponse) Descriptor() ([]byte, []int) { + return file_groupsmanagement_proto_rawDescGZIP(), []int{21} +} + +func (x *SubscribeMemberResponse) GetGroup() *GroupMember { + if x != nil { + return x.Group + } + return nil +} + var File_groupsmanagement_proto protoreflect.FileDescriptor var file_groupsmanagement_proto_rawDesc = []byte{ 0x0a, 0x16, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x05, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x30, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3f, 0x0a, 0x0f, 0x47, 0x65, 0x74, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x30, 0x0a, 0x10, 0x47, 0x65, - 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, - 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x4a, 0x0a, 0x10, - 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, - 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, - 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x33, 0x0a, - 0x15, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, - 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, - 0x64, 0x73, 0x22, 0x38, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x06, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x48, 0x0a, 0x10, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x23, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, - 0x6b, 0x18, 0x16, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x4a, 0x0a, 0x12, 0x55, - 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x18, 0x1e, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x25, 0x0a, 0x13, 0x55, 0x6e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x20, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xe5, - 0x02, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, - 0x10, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x11, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, - 0x68, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, - 0x65, 0x12, 0x11, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x55, 0x6e, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x13, 0x2e, 0x55, 0x6e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, - 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, - 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, - 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2d, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, - 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x6d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x0f, 0x41, 0x64, + 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, + 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x30, 0x0a, 0x10, 0x41, + 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1c, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, + 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3f, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x30, + 0x0a, 0x10, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x22, 0x4a, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x33, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1e, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x73, 0x22, 0x33, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x69, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x69, 0x64, 0x73, 0x22, 0x38, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1e, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x06, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, + 0x22, 0x48, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x12, 0x1a, + 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x23, 0x0a, 0x11, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x16, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, + 0x4a, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, + 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x18, 0x1f, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x69, 0x64, 0x22, 0x25, 0x0a, 0x13, 0x55, + 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x20, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, + 0x6f, 0x6b, 0x22, 0x3b, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, + 0x3c, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x41, 0x0a, + 0x15, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x23, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, + 0x64, 0x18, 0x24, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, + 0x22, 0x3c, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x18, 0x25, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x38, + 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x22, 0x3f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x27, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x39, 0x0a, 0x1b, 0x47, 0x65, 0x74, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x69, 0x64, 0x73, 0x18, 0x28, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x69, 0x64, 0x73, 0x22, 0x44, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x29, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x3c, 0x0a, 0x16, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x2a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x3d, 0x0a, 0x17, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x2b, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x32, 0xd6, 0x05, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x08, + 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x41, 0x64, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x31, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x10, 0x2e, 0x47, 0x65, + 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, + 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, + 0x11, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, + 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x11, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x62, 0x65, 0x12, 0x13, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x43, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x12, 0x16, 0x2e, 0x41, 0x64, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x41, 0x64, 0x64, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, + 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x47, 0x65, 0x74, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x47, + 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x55, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x47, 0x65, 0x74, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x73, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, + 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, + 0x6d, 0x2f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -707,45 +1249,73 @@ func file_groupsmanagement_proto_rawDescGZIP() []byte { return file_groupsmanagement_proto_rawDescData } -var file_groupsmanagement_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_groupsmanagement_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_groupsmanagement_proto_goTypes = []interface{}{ - (*AddGroupRequest)(nil), // 0: AddGroupRequest - (*AddGroupResponse)(nil), // 1: AddGroupResponse - (*GetGroupRequest)(nil), // 2: GetGroupRequest - (*GetGroupResponse)(nil), // 3: GetGroupResponse - (*GetGroupsRequest)(nil), // 4: GetGroupsRequest - (*GetGroupsResponse)(nil), // 5: GetGroupsResponse - (*GetGroupsBatchRequest)(nil), // 6: GetGroupsBatchRequest - (*GetGroupsBatchResponse)(nil), // 7: GetGroupsBatchResponse - (*SubscribeRequest)(nil), // 8: SubscribeRequest - (*SubscribeResponse)(nil), // 9: SubscribeResponse - (*UnsubscribeRequest)(nil), // 10: UnsubscribeRequest - (*UnsubscribeResponse)(nil), // 11: UnsubscribeResponse - (*Group)(nil), // 12: Group + (*AddGroupRequest)(nil), // 0: AddGroupRequest + (*AddGroupResponse)(nil), // 1: AddGroupResponse + (*GetGroupRequest)(nil), // 2: GetGroupRequest + (*GetGroupResponse)(nil), // 3: GetGroupResponse + (*GetGroupsRequest)(nil), // 4: GetGroupsRequest + (*GetGroupsResponse)(nil), // 5: GetGroupsResponse + (*GetGroupsBatchRequest)(nil), // 6: GetGroupsBatchRequest + (*GetGroupsBatchResponse)(nil), // 7: GetGroupsBatchResponse + (*SubscribeRequest)(nil), // 8: SubscribeRequest + (*SubscribeResponse)(nil), // 9: SubscribeResponse + (*UnsubscribeRequest)(nil), // 10: UnsubscribeRequest + (*UnsubscribeResponse)(nil), // 11: UnsubscribeResponse + (*AddGroupMemberRequest)(nil), // 12: AddGroupMemberRequest + (*AddGroupMemberResponse)(nil), // 13: AddGroupMemberResponse + (*GetGroupMemberRequest)(nil), // 14: GetGroupMemberRequest + (*GetGroupMemberResponse)(nil), // 15: GetGroupMemberResponse + (*GetGroupsMemberRequest)(nil), // 16: GetGroupsMemberRequest + (*GetGroupsMemberResponse)(nil), // 17: GetGroupsMemberResponse + (*GetGroupsBatchMemberRequest)(nil), // 18: GetGroupsBatchMemberRequest + (*GetGroupsBatchMemberResponse)(nil), // 19: GetGroupsBatchMemberResponse + (*SubscribeMemberRequest)(nil), // 20: SubscribeMemberRequest + (*SubscribeMemberResponse)(nil), // 21: SubscribeMemberResponse + (*Group)(nil), // 22: Group + (*GroupMember)(nil), // 23: GroupMember } var file_groupsmanagement_proto_depIdxs = []int32{ - 12, // 0: AddGroupRequest.group:type_name -> Group - 12, // 1: AddGroupResponse.group:type_name -> Group - 12, // 2: GetGroupResponse.group:type_name -> Group - 12, // 3: GetGroupsResponse.groups:type_name -> Group - 12, // 4: GetGroupsBatchResponse.groups:type_name -> Group - 0, // 5: GroupsManagement.AddGroup:input_type -> AddGroupRequest - 2, // 6: GroupsManagement.GetGroup:input_type -> GetGroupRequest - 4, // 7: GroupsManagement.GetGroups:input_type -> GetGroupsRequest - 6, // 8: GroupsManagement.GetGroupsBatch:input_type -> GetGroupsBatchRequest - 8, // 9: GroupsManagement.Subscribe:input_type -> SubscribeRequest - 10, // 10: GroupsManagement.Unsubscribe:input_type -> UnsubscribeRequest - 1, // 11: GroupsManagement.AddGroup:output_type -> AddGroupResponse - 3, // 12: GroupsManagement.GetGroup:output_type -> GetGroupResponse - 5, // 13: GroupsManagement.GetGroups:output_type -> GetGroupsResponse - 7, // 14: GroupsManagement.GetGroupsBatch:output_type -> GetGroupsBatchResponse - 9, // 15: GroupsManagement.Subscribe:output_type -> SubscribeResponse - 11, // 16: GroupsManagement.Unsubscribe:output_type -> UnsubscribeResponse - 11, // [11:17] is the sub-list for method output_type - 5, // [5:11] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 22, // 0: AddGroupRequest.group:type_name -> Group + 22, // 1: AddGroupResponse.group:type_name -> Group + 22, // 2: GetGroupResponse.group:type_name -> Group + 22, // 3: GetGroupsResponse.groups:type_name -> Group + 22, // 4: GetGroupsBatchResponse.groups:type_name -> Group + 23, // 5: AddGroupMemberRequest.group:type_name -> GroupMember + 23, // 6: AddGroupMemberResponse.group:type_name -> GroupMember + 23, // 7: GetGroupMemberResponse.group:type_name -> GroupMember + 23, // 8: GetGroupsMemberResponse.groups:type_name -> GroupMember + 23, // 9: GetGroupsBatchMemberResponse.groups:type_name -> GroupMember + 23, // 10: SubscribeMemberRequest.group:type_name -> GroupMember + 23, // 11: SubscribeMemberResponse.group:type_name -> GroupMember + 0, // 12: GroupsManagement.AddGroup:input_type -> AddGroupRequest + 2, // 13: GroupsManagement.GetGroup:input_type -> GetGroupRequest + 4, // 14: GroupsManagement.GetGroups:input_type -> GetGroupsRequest + 6, // 15: GroupsManagement.GetGroupsBatch:input_type -> GetGroupsBatchRequest + 8, // 16: GroupsManagement.Subscribe:input_type -> SubscribeRequest + 10, // 17: GroupsManagement.Unsubscribe:input_type -> UnsubscribeRequest + 12, // 18: GroupsManagement.AddGroupMember:input_type -> AddGroupMemberRequest + 14, // 19: GroupsManagement.GetGroupMember:input_type -> GetGroupMemberRequest + 16, // 20: GroupsManagement.GetGroupsMember:input_type -> GetGroupsMemberRequest + 18, // 21: GroupsManagement.GetGroupsBatchMember:input_type -> GetGroupsBatchMemberRequest + 20, // 22: GroupsManagement.SubscribeMember:input_type -> SubscribeMemberRequest + 1, // 23: GroupsManagement.AddGroup:output_type -> AddGroupResponse + 3, // 24: GroupsManagement.GetGroup:output_type -> GetGroupResponse + 5, // 25: GroupsManagement.GetGroups:output_type -> GetGroupsResponse + 7, // 26: GroupsManagement.GetGroupsBatch:output_type -> GetGroupsBatchResponse + 9, // 27: GroupsManagement.Subscribe:output_type -> SubscribeResponse + 11, // 28: GroupsManagement.Unsubscribe:output_type -> UnsubscribeResponse + 13, // 29: GroupsManagement.AddGroupMember:output_type -> AddGroupMemberResponse + 15, // 30: GroupsManagement.GetGroupMember:output_type -> GetGroupMemberResponse + 17, // 31: GroupsManagement.GetGroupsMember:output_type -> GetGroupsMemberResponse + 19, // 32: GroupsManagement.GetGroupsBatchMember:output_type -> GetGroupsBatchMemberResponse + 21, // 33: GroupsManagement.SubscribeMember:output_type -> SubscribeMemberResponse + 23, // [23:34] is the sub-list for method output_type + 12, // [12:23] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_groupsmanagement_proto_init() } @@ -754,6 +1324,7 @@ func file_groupsmanagement_proto_init() { return } file_groups_proto_init() + file_groupsmember_proto_init() if !protoimpl.UnsafeEnabled { file_groupsmanagement_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AddGroupRequest); i { @@ -899,6 +1470,126 @@ func file_groupsmanagement_proto_init() { return nil } } + file_groupsmanagement_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddGroupMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddGroupMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGroupMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGroupMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGroupsMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGroupsMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGroupsBatchMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetGroupsBatchMemberResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeMemberRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_groupsmanagement_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeMemberResponse); 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{ @@ -906,7 +1597,7 @@ func file_groupsmanagement_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_groupsmanagement_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 22, NumExtensions: 0, NumServices: 1, }, diff --git a/grpcapi/groupsmanagement.proto b/grpcapi/groupsmanagement.proto index 61fea9c..f4183cb 100644 --- a/grpcapi/groupsmanagement.proto +++ b/grpcapi/groupsmanagement.proto @@ -5,6 +5,7 @@ syntax = "proto3"; option go_package = "git.coopgo.io/coopgo-platform/groups-management/grpcapi"; import "groups.proto"; +import "groupsmember.proto"; service GroupsManagement { rpc AddGroup(AddGroupRequest) returns (AddGroupResponse) {} @@ -13,56 +14,92 @@ service GroupsManagement { rpc GetGroupsBatch(GetGroupsBatchRequest) returns (GetGroupsBatchResponse) {} rpc Subscribe(SubscribeRequest) returns (SubscribeResponse) {} rpc Unsubscribe(UnsubscribeRequest) returns (UnsubscribeResponse) {} + //////////member + rpc AddGroupMember(AddGroupMemberRequest) returns (AddGroupMemberResponse) {} + rpc GetGroupMember(GetGroupMemberRequest) returns (GetGroupMemberResponse) {} + rpc GetGroupsMember(GetGroupsMemberRequest) returns (GetGroupsMemberResponse) {} + rpc GetGroupsBatchMember(GetGroupsBatchMemberRequest) returns (GetGroupsBatchMemberResponse) {} + rpc SubscribeMember(SubscribeMemberRequest) returns (SubscribeMemberResponse) {} } message AddGroupRequest { Group group = 1; } - message AddGroupResponse { Group group = 2; } - message GetGroupRequest { string id = 3; string namespace = 4; } - message GetGroupResponse { Group group = 5; } - message GetGroupsRequest { repeated string namespaces = 6; string member = 7; } - message GetGroupsResponse { repeated Group groups = 8; } - message GetGroupsBatchRequest { repeated string groupids = 10; } - message GetGroupsBatchResponse { repeated Group groups = 11; } - message SubscribeRequest { string groupid = 20; string memberid = 21; } - message SubscribeResponse { bool ok = 22; } - message UnsubscribeRequest { string groupid = 30; string memberid = 31; } - message UnsubscribeResponse { bool ok = 32; -} \ No newline at end of file +} +//////////////////member + +message AddGroupMemberRequest { + GroupMember group = 33; +} + +message AddGroupMemberResponse { + GroupMember group = 34; +} + +message GetGroupMemberRequest { + string id = 35; + string groupid = 36; +} + +message GetGroupMemberResponse { + GroupMember group = 37; +} + +message GetGroupsMemberRequest { + repeated string namespaces = 38; +} + +message GetGroupsMemberResponse { + repeated GroupMember groups = 39; +} + +message GetGroupsBatchMemberRequest { + repeated string groupids = 40; +} + +message GetGroupsBatchMemberResponse { + repeated GroupMember groups = 41; +} +message SubscribeMemberRequest { + GroupMember group = 42; +} + +message SubscribeMemberResponse { + GroupMember group = 43; +} diff --git a/grpcapi/groupsmanagement_grpc.pb.go b/grpcapi/groupsmanagement_grpc.pb.go index aec34f8..58833ed 100644 --- a/grpcapi/groupsmanagement_grpc.pb.go +++ b/grpcapi/groupsmanagement_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.4 +// - protoc v3.12.4 // source: groupsmanagement.proto package grpcapi @@ -28,6 +28,12 @@ type GroupsManagementClient interface { GetGroupsBatch(ctx context.Context, in *GetGroupsBatchRequest, opts ...grpc.CallOption) (*GetGroupsBatchResponse, error) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SubscribeResponse, error) Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*UnsubscribeResponse, error) + //////////member + AddGroupMember(ctx context.Context, in *AddGroupMemberRequest, opts ...grpc.CallOption) (*AddGroupMemberResponse, error) + GetGroupMember(ctx context.Context, in *GetGroupMemberRequest, opts ...grpc.CallOption) (*GetGroupMemberResponse, error) + GetGroupsMember(ctx context.Context, in *GetGroupsMemberRequest, opts ...grpc.CallOption) (*GetGroupsMemberResponse, error) + GetGroupsBatchMember(ctx context.Context, in *GetGroupsBatchMemberRequest, opts ...grpc.CallOption) (*GetGroupsBatchMemberResponse, error) + SubscribeMember(ctx context.Context, in *SubscribeMemberRequest, opts ...grpc.CallOption) (*SubscribeMemberResponse, error) } type groupsManagementClient struct { @@ -92,6 +98,51 @@ func (c *groupsManagementClient) Unsubscribe(ctx context.Context, in *Unsubscrib return out, nil } +func (c *groupsManagementClient) AddGroupMember(ctx context.Context, in *AddGroupMemberRequest, opts ...grpc.CallOption) (*AddGroupMemberResponse, error) { + out := new(AddGroupMemberResponse) + err := c.cc.Invoke(ctx, "/GroupsManagement/AddGroupMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *groupsManagementClient) GetGroupMember(ctx context.Context, in *GetGroupMemberRequest, opts ...grpc.CallOption) (*GetGroupMemberResponse, error) { + out := new(GetGroupMemberResponse) + err := c.cc.Invoke(ctx, "/GroupsManagement/GetGroupMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *groupsManagementClient) GetGroupsMember(ctx context.Context, in *GetGroupsMemberRequest, opts ...grpc.CallOption) (*GetGroupsMemberResponse, error) { + out := new(GetGroupsMemberResponse) + err := c.cc.Invoke(ctx, "/GroupsManagement/GetGroupsMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *groupsManagementClient) GetGroupsBatchMember(ctx context.Context, in *GetGroupsBatchMemberRequest, opts ...grpc.CallOption) (*GetGroupsBatchMemberResponse, error) { + out := new(GetGroupsBatchMemberResponse) + err := c.cc.Invoke(ctx, "/GroupsManagement/GetGroupsBatchMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *groupsManagementClient) SubscribeMember(ctx context.Context, in *SubscribeMemberRequest, opts ...grpc.CallOption) (*SubscribeMemberResponse, error) { + out := new(SubscribeMemberResponse) + err := c.cc.Invoke(ctx, "/GroupsManagement/SubscribeMember", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // GroupsManagementServer is the server API for GroupsManagement service. // All implementations must embed UnimplementedGroupsManagementServer // for forward compatibility @@ -102,6 +153,12 @@ type GroupsManagementServer interface { GetGroupsBatch(context.Context, *GetGroupsBatchRequest) (*GetGroupsBatchResponse, error) Subscribe(context.Context, *SubscribeRequest) (*SubscribeResponse, error) Unsubscribe(context.Context, *UnsubscribeRequest) (*UnsubscribeResponse, error) + //////////member + AddGroupMember(context.Context, *AddGroupMemberRequest) (*AddGroupMemberResponse, error) + GetGroupMember(context.Context, *GetGroupMemberRequest) (*GetGroupMemberResponse, error) + GetGroupsMember(context.Context, *GetGroupsMemberRequest) (*GetGroupsMemberResponse, error) + GetGroupsBatchMember(context.Context, *GetGroupsBatchMemberRequest) (*GetGroupsBatchMemberResponse, error) + SubscribeMember(context.Context, *SubscribeMemberRequest) (*SubscribeMemberResponse, error) mustEmbedUnimplementedGroupsManagementServer() } @@ -127,6 +184,21 @@ func (UnimplementedGroupsManagementServer) Subscribe(context.Context, *Subscribe func (UnimplementedGroupsManagementServer) Unsubscribe(context.Context, *UnsubscribeRequest) (*UnsubscribeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Unsubscribe not implemented") } +func (UnimplementedGroupsManagementServer) AddGroupMember(context.Context, *AddGroupMemberRequest) (*AddGroupMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddGroupMember not implemented") +} +func (UnimplementedGroupsManagementServer) GetGroupMember(context.Context, *GetGroupMemberRequest) (*GetGroupMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGroupMember not implemented") +} +func (UnimplementedGroupsManagementServer) GetGroupsMember(context.Context, *GetGroupsMemberRequest) (*GetGroupsMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGroupsMember not implemented") +} +func (UnimplementedGroupsManagementServer) GetGroupsBatchMember(context.Context, *GetGroupsBatchMemberRequest) (*GetGroupsBatchMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetGroupsBatchMember not implemented") +} +func (UnimplementedGroupsManagementServer) SubscribeMember(context.Context, *SubscribeMemberRequest) (*SubscribeMemberResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubscribeMember not implemented") +} func (UnimplementedGroupsManagementServer) mustEmbedUnimplementedGroupsManagementServer() {} // UnsafeGroupsManagementServer may be embedded to opt out of forward compatibility for this service. @@ -248,6 +320,96 @@ func _GroupsManagement_Unsubscribe_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _GroupsManagement_AddGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddGroupMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GroupsManagementServer).AddGroupMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/GroupsManagement/AddGroupMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GroupsManagementServer).AddGroupMember(ctx, req.(*AddGroupMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GroupsManagement_GetGroupMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGroupMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GroupsManagementServer).GetGroupMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/GroupsManagement/GetGroupMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GroupsManagementServer).GetGroupMember(ctx, req.(*GetGroupMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GroupsManagement_GetGroupsMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGroupsMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GroupsManagementServer).GetGroupsMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/GroupsManagement/GetGroupsMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GroupsManagementServer).GetGroupsMember(ctx, req.(*GetGroupsMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GroupsManagement_GetGroupsBatchMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetGroupsBatchMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GroupsManagementServer).GetGroupsBatchMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/GroupsManagement/GetGroupsBatchMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GroupsManagementServer).GetGroupsBatchMember(ctx, req.(*GetGroupsBatchMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GroupsManagement_SubscribeMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubscribeMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GroupsManagementServer).SubscribeMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/GroupsManagement/SubscribeMember", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GroupsManagementServer).SubscribeMember(ctx, req.(*SubscribeMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + // GroupsManagement_ServiceDesc is the grpc.ServiceDesc for GroupsManagement service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -279,6 +441,26 @@ var GroupsManagement_ServiceDesc = grpc.ServiceDesc{ MethodName: "Unsubscribe", Handler: _GroupsManagement_Unsubscribe_Handler, }, + { + MethodName: "AddGroupMember", + Handler: _GroupsManagement_AddGroupMember_Handler, + }, + { + MethodName: "GetGroupMember", + Handler: _GroupsManagement_GetGroupMember_Handler, + }, + { + MethodName: "GetGroupsMember", + Handler: _GroupsManagement_GetGroupsMember_Handler, + }, + { + MethodName: "GetGroupsBatchMember", + Handler: _GroupsManagement_GetGroupsBatchMember_Handler, + }, + { + MethodName: "SubscribeMember", + Handler: _GroupsManagement_SubscribeMember_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "groupsmanagement.proto", diff --git a/grpcapi/grpcapi.go b/grpcapi/grpcapi.go index f4d99e6..97b6086 100644 --- a/grpcapi/grpcapi.go +++ b/grpcapi/grpcapi.go @@ -122,3 +122,91 @@ func Run(done chan error, cfg *viper.Viper, handler handlers.GroupsManagementHan done <- err } } + +//////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +func (s GroupsManagementServerImpl) AddGroupMember(ctx context.Context, req *AddGroupMemberRequest) (*AddGroupMemberResponse, error) { + + g := req.Group.ToStorageType() + group, err := s.handler.AddGroupMember(g) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.AlreadyExists, "group creation failed : %v", err) + } + response, err := GroupFromStorageTypeMember(group) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.Internal, "issue while retrieving group : %v", err) + } + return &AddGroupMemberResponse{Group: response}, nil +} +func (s GroupsManagementServerImpl) GetGroupMember(ctx context.Context, req *GetGroupMemberRequest) (*GetGroupMemberResponse, error) { + group, err := s.handler.GetGroupMember(req.Id) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.AlreadyExists, "issue while retrieving group : %v", err) + } + response, err := GroupFromStorageTypeMember(group) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.Internal, "issue while retrieving group : %v", err) + } + return &GetGroupMemberResponse{Group: response}, nil +} +func (s GroupsManagementServerImpl) GetGroupsMember(ctx context.Context, req *GetGroupsMemberRequest) (*GetGroupsMemberResponse, error) { + responses, err := s.handler.GetGroupsMember(req.Namespaces) + if err != nil { + return nil, status.Errorf(codes.NotFound, "could not get groups : %v", err) + } + var groups []*GroupMember + + for _, g := range responses { + group, err := GroupFromStorageTypeMember(&g) + if err != nil { + return nil, status.Errorf(codes.Internal, "could not get groups : %v", err) + } + groups = append(groups, group) + } + return &GetGroupsMemberResponse{Groups: groups}, nil +} +func (s GroupsManagementServerImpl) GetGroupsBatchMember(ctx context.Context, req *GetGroupsBatchMemberRequest) (*GetGroupsBatchMemberResponse, error) { + responses, err := s.handler.GetGroupsBatchMember(req.Groupids) + if err != nil { + return nil, status.Errorf(codes.NotFound, "could not get groups : %v", err) + } + var groups []*GroupMember + + for _, g := range responses { + group, err := GroupFromStorageTypeMember(&g) + if err != nil { + return nil, status.Errorf(codes.Internal, "could not get groups : %v", err) + } + groups = append(groups, group) + } + return &GetGroupsBatchMemberResponse{Groups: groups}, nil +} + +func (s GroupsManagementServerImpl) SubscribeMember(ctx context.Context, req *SubscribeMemberRequest) (*SubscribeMemberResponse, error) { + g := req.Group.ToStorageType() + // err := s.handler.SubscribeMember(g) + // if err != nil { + // return nil, status.Errorf(codes.AlreadyExists, "could not subscribe : %v", err) + // } + // return &SubscribeMemberResponse{ + // Ok: true, + // }, nil + + group, err := s.handler.SubscribeMember(g) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.AlreadyExists, "group creation failed : %v", err) + } + response, err := GroupFromStorageTypeMember(group) + if err != nil { + fmt.Println(err) + return nil, status.Errorf(codes.Internal, "issue while retrieving group : %v", err) + } + return &SubscribeMemberResponse{Group: response}, nil + +} diff --git a/storage/groups.go b/storage/groups.go index efcb0ac..fd4e473 100644 --- a/storage/groups.go +++ b/storage/groups.go @@ -6,3 +6,10 @@ type Group struct { Members []string `json:"members"` Data map[string]any `json:"data"` } + +///////////////////code +type GroupMember struct { + ID string `json:"id" bson:"_id"` + Groupid string `json:"grouid" bson:"_groupid"` + Data map[string]any `json:"data"` +} diff --git a/storage/mongodb.go b/storage/mongodb.go index d5b0ff5..5e8c1b6 100644 --- a/storage/mongodb.go +++ b/storage/mongodb.go @@ -23,6 +23,8 @@ func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) { mongodb_port = cfg.GetString("storage.db.mongodb.port") mongodb_dbname = cfg.GetString("storage.db.mongodb.db_name") mongodb_groups = cfg.GetString("storage.db.mongodb.collections.groups") + ////////////////////////code + mongodb_groups_members = cfg.GetString("storage.db.mongodb.collections.groups_member") ) client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://" + mongodb_host + ":" + mongodb_port)) @@ -41,6 +43,8 @@ func NewMongoDBStorage(cfg *viper.Viper) (MongoDBStorage, error) { DbName: mongodb_dbname, Collections: map[string]string{ "groups": mongodb_groups, + /////////////////////////////code + "groups_member": mongodb_groups_members, }, } //TODO Indexes @@ -147,3 +151,113 @@ func (s MongoDBStorage) UpdateGroup(group Group) error { return nil } + +/*********************************************************************************************************************************/ +/*********************************************************Code********************************************************************/ +/*********************************************************************************************************************************/ +/*********************************************************************************************************************************/ + +func (s MongoDBStorage) CreateGroupMember(groupMember GroupMember) error { + collection := s.Client.Database(s.DbName).Collection(s.Collections["groups_member"]) + if _, err := collection.InsertOne(context.TODO(), groupMember); err != nil { + return err + } + + return nil +} + +func (s MongoDBStorage) GetGroupMember(id string) (*GroupMember, error) { + collection := s.Client.Database(s.DbName).Collection(s.Collections["groups_member"]) + + groupMember := &GroupMember{} + if err := collection.FindOne(context.TODO(), bson.M{"_id": id}).Decode(groupMember); err != nil { + return nil, err + } + + return groupMember, nil +} + +func (s MongoDBStorage) GetGroupsMember(namespaces []string) (groupsMember []GroupMember, err error) { + collection := s.Client.Database(s.DbName).Collection(s.Collections["groups_member"]) + + var cur *mongo.Cursor + + findOptions := options.Find() + + cur, err = collection.Find(context.TODO(), bson.D{}, findOptions) + if err != nil { + return groupsMember, err + } + // if len(namespaces) == 0 { + // cur, err = collection.Find(context.TODO(), bson.D{}, findOptions) + // if err != nil { + // return groupsMember, err + // } + // } else { + // cur, err = collection.Find(context.TODO(), bson.M{"namespace": bson.M{"$in": namespaces}}, findOptions) + // if err != nil { + // return groupsMember, err + // } + // } + + for cur.Next(context.TODO()) { + var group GroupMember + var elem bson.M + + if err := cur.Decode(&elem); err != nil { + return groupsMember, err + } + + bsonBytes, _ := bson.Marshal(elem) + bson.Unmarshal(bsonBytes, &group) + + groupsMember = append(groupsMember, group) + + } + + return +} + +func (s MongoDBStorage) GetGroupsMemberByIds(groupids []string) (groupsMember []GroupMember, err error) { + collection := s.Client.Database(s.DbName).Collection(s.Collections["groups_member"]) + + var cur *mongo.Cursor + + findOptions := options.Find() + + if len(groupids) == 0 { + return groupsMember, errors.New("no group id provided") + } else { + cur, err = collection.Find(context.TODO(), bson.M{"_id": bson.M{"$in": groupids}}, findOptions) + if err != nil { + return groupsMember, err + } + } + + for cur.Next(context.TODO()) { + var group GroupMember + var elem bson.M + + if err := cur.Decode(&elem); err != nil { + return groupsMember, err + } + + bsonBytes, _ := bson.Marshal(elem) + bson.Unmarshal(bsonBytes, &group) + + groupsMember = append(groupsMember, group) + + } + + return +} + +func (s MongoDBStorage) UpdateGroupMember(group GroupMember) error { + collection := s.Client.Database(s.DbName).Collection(s.Collections["groups_member"]) + if _, err := collection.ReplaceOne(context.TODO(), bson.M{"_id": group.ID}, group); err != nil { + fmt.Println(err) + return err + } + + return nil +} diff --git a/storage/storage.go b/storage/storage.go index f397a32..ea6214f 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -12,6 +12,12 @@ type Storage interface { GetGroups([]string) ([]Group, error) GetGroupsByIds([]string) ([]Group, error) UpdateGroup(Group) error + /*******************************************************/ + CreateGroupMember(GroupMember) error + GetGroupMember(string) (*GroupMember, error) + GetGroupsMember([]string) ([]GroupMember, error) + GetGroupsMemberByIds([]string) ([]GroupMember, error) + UpdateGroupMember(GroupMember) error } func NewStorage(cfg *viper.Viper) (Storage, error) {