diff --git a/internal/rpc/cache/cache.go b/internal/rpc/cache/cache.go index 6e1eed5aa..dc2fb0d17 100644 --- a/internal/rpc/cache/cache.go +++ b/internal/rpc/cache/cache.go @@ -6,10 +6,12 @@ import ( rocksCache "Open_IM/pkg/common/db/rocks_cache" "Open_IM/pkg/common/log" promePkg "Open_IM/pkg/common/prometheus" - "Open_IM/pkg/grpc-etcdv3/getcdv3" + "Open_IM/pkg/common/trace_log" pbCache "Open_IM/pkg/proto/cache" + sdkws "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" + "github.com/OpenIMSDK/getcdv3" "net" "strconv" "strings" @@ -75,7 +77,7 @@ func (s *cacheServer) Run() { } } log.NewInfo("", "rpcRegisterIP", rpcRegisterIP) - err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), rpcRegisterIP, s.rpcPort, s.rpcRegisterName, 10) + err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), rpcRegisterIP, s.rpcPort, s.rpcRegisterName, 10, "") if err != nil { log.NewError("0", "RegisterEtcd failed ", err.Error()) panic(utils.Wrap(err, "register cache module rpc to etcd err")) @@ -89,91 +91,97 @@ func (s *cacheServer) Run() { log.NewInfo("0", "message cms rpc success") } -func (s *cacheServer) GetFriendIDListFromCache(_ context.Context, req *pbCache.GetFriendIDListFromCacheReq) (resp *pbCache.GetFriendIDListFromCacheResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp = &pbCache.GetFriendIDListFromCacheResp{CommonResp: &pbCache.CommonResp{}} - friendIDList, err := rocksCache.GetFriendIDListFromCache(req.UserID) +func (s *cacheServer) GetFriendIDListFromCache(ctx context.Context, req *pbCache.GetFriendIDListFromCacheReq) (resp *pbCache.GetFriendIDListFromCacheResp, err error) { + resp = &pbCache.GetFriendIDListFromCacheResp{CommonResp: &sdkws.CommonResp{}} + ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), nil, "req", req.String(), "resp", resp.String()) + trace_log.ShowLog(ctx) + }() + friendIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.UserID) if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetFriendIDListFromCache", err.Error()) - resp.CommonResp.ErrCode = constant.ErrDB.ErrCode - resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg - return resp, nil + constant.SetErrorForResp(err, resp.CommonResp) + return } - log.NewDebug(req.OperationID, utils.GetSelfFuncName(), friendIDList) resp.UserIDList = friendIDList - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) - return resp, nil + return } // this is for dtm call -func (s *cacheServer) DelFriendIDListFromCache(_ context.Context, req *pbCache.DelFriendIDListFromCacheReq) (resp *pbCache.DelFriendIDListFromCacheResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp = &pbCache.DelFriendIDListFromCacheResp{CommonResp: &pbCache.CommonResp{}} - if err := rocksCache.DelFriendIDListFromCache(req.UserID); err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "args: ", req.UserID, err.Error()) - resp.CommonResp.ErrCode = constant.ErrDB.ErrCode - resp.CommonResp.ErrMsg = err.Error() - return resp, nil +func (s *cacheServer) DelFriendIDListFromCache(ctx context.Context, req *pbCache.DelFriendIDListFromCacheReq) (resp *pbCache.DelFriendIDListFromCacheResp, err error) { + resp = &pbCache.DelFriendIDListFromCacheResp{CommonResp: &sdkws.CommonResp{}} + ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), nil, "req", req.String(), "resp", resp.String()) + trace_log.ShowLog(ctx) + }() + if err := rocksCache.DelFriendIDListFromCache(ctx, req.UserID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) + return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", resp.String()) - return resp, nil + return } -func (s *cacheServer) GetBlackIDListFromCache(_ context.Context, req *pbCache.GetBlackIDListFromCacheReq) (resp *pbCache.GetBlackIDListFromCacheResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp = &pbCache.GetBlackIDListFromCacheResp{CommonResp: &pbCache.CommonResp{}} - blackUserIDList, err := rocksCache.GetBlackListFromCache(req.UserID) +func (s *cacheServer) GetBlackIDListFromCache(ctx context.Context, req *pbCache.GetBlackIDListFromCacheReq) (resp *pbCache.GetBlackIDListFromCacheResp, err error) { + resp = &pbCache.GetBlackIDListFromCacheResp{CommonResp: &sdkws.CommonResp{}} + ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), nil, "req", req.String(), "resp", resp.String()) + trace_log.ShowLog(ctx) + }() + blackUserIDList, err := rocksCache.GetBlackListFromCache(ctx, req.UserID) if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "AddFriendToCache failed", err.Error()) - resp.CommonResp.ErrCode = constant.ErrDB.ErrCode - resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg - return resp, nil + constant.SetErrorForResp(err, resp.CommonResp) + return } - log.NewDebug(req.OperationID, utils.GetSelfFuncName(), blackUserIDList) resp.UserIDList = blackUserIDList - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) - return resp, nil + return } -func (s *cacheServer) DelBlackIDListFromCache(_ context.Context, req *pbCache.DelBlackIDListFromCacheReq) (resp *pbCache.DelBlackIDListFromCacheResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp = &pbCache.DelBlackIDListFromCacheResp{CommonResp: &pbCache.CommonResp{}} - if err := rocksCache.DelBlackIDListFromCache(req.UserID); err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "args: ", req.UserID, err.Error()) - resp.CommonResp.ErrCode = constant.ErrDB.ErrCode - resp.CommonResp.ErrMsg = err.Error() - return resp, nil +func (s *cacheServer) DelBlackIDListFromCache(ctx context.Context, req *pbCache.DelBlackIDListFromCacheReq) (resp *pbCache.DelBlackIDListFromCacheResp, err error) { + resp = &pbCache.DelBlackIDListFromCacheResp{CommonResp: &sdkws.CommonResp{}} + ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), nil, "req", req.String(), "resp", resp.String()) + trace_log.ShowLog(ctx) + }() + if err := rocksCache.DelBlackIDListFromCache(ctx, req.UserID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) + return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", resp.String()) return resp, nil } -func (s *cacheServer) GetGroupMemberIDListFromCache(_ context.Context, req *pbCache.GetGroupMemberIDListFromCacheReq) (resp *pbCache.GetGroupMemberIDListFromCacheResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) +func (s *cacheServer) GetGroupMemberIDListFromCache(ctx context.Context, req *pbCache.GetGroupMemberIDListFromCacheReq) (resp *pbCache.GetGroupMemberIDListFromCacheResp, err error) { resp = &pbCache.GetGroupMemberIDListFromCacheResp{ - CommonResp: &pbCache.CommonResp{}, + CommonResp: &sdkws.CommonResp{}, } - userIDList, err := rocksCache.GetGroupMemberIDListFromCache(req.GroupID) + ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), nil, "req", req.String(), "resp", resp.String()) + trace_log.ShowLog(ctx) + }() + userIDList, err := rocksCache.GetGroupMemberIDListFromCache(ctx, req.GroupID) if err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMemberIDListFromCache failed", err.Error()) - resp.CommonResp.ErrCode = constant.ErrDB.ErrCode - resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg + constant.SetErrorForResp(err, resp.CommonResp) return resp, nil } resp.UserIDList = userIDList - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } -func (s *cacheServer) DelGroupMemberIDListFromCache(_ context.Context, req *pbCache.DelGroupMemberIDListFromCacheReq) (resp *pbCache.DelGroupMemberIDListFromCacheResp, err error) { - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp = &pbCache.DelGroupMemberIDListFromCacheResp{CommonResp: &pbCache.CommonResp{}} - if err := rocksCache.DelGroupMemberIDListFromCache(req.GroupID); err != nil { - log.NewError(req.OperationID, utils.GetSelfFuncName(), "args: ", req.GroupID, err.Error()) - resp.CommonResp.ErrCode = constant.ErrDB.ErrCode - resp.CommonResp.ErrMsg = err.Error() +func (s *cacheServer) DelGroupMemberIDListFromCache(ctx context.Context, req *pbCache.DelGroupMemberIDListFromCacheReq) (resp *pbCache.DelGroupMemberIDListFromCacheResp, err error) { + resp = &pbCache.DelGroupMemberIDListFromCacheResp{CommonResp: &sdkws.CommonResp{}} + ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), nil, "req", req.String(), "resp", resp.String()) + trace_log.ShowLog(ctx) + }() + if err := rocksCache.DelGroupMemberIDListFromCache(ctx, req.GroupID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return resp, nil } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", resp.String()) return resp, nil } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index e42047a1d..a3ec213bd 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -23,7 +23,6 @@ import ( "Open_IM/pkg/utils" "context" "errors" - "fmt" "math/big" "net" "strconv" @@ -123,7 +122,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR trace_log.ShowLog(ctx) }() if err := token_verify.CheckAccessV2(ctx, req.OpUserID, req.OwnerUserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } var groupOwnerNum int @@ -139,32 +138,32 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR userIDs = append(userIDs, req.OwnerUserID) } if groupOwnerNum != 1 { - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrArgs, resp.CommonResp) return } if utils.IsRepeatStringSlice(userIDs) { - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrArgs, resp.CommonResp) return } - users, err := rocksCache.GetUserInfoFromCacheBatch(userIDs) + users, err := rocksCache.GetUserInfoFromCacheBatch(ctx, userIDs) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if len(users) != len(userIDs) { - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrArgs, resp.CommonResp) return } userMap := make(map[string]*imdb.User) for i, user := range users { userMap[user.UserID] = users[i] } - if err := s.DelGroupAndUserCache(req.OperationID, "", userIDs); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := s.DelGroupAndUserCache(ctx, "", userIDs); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } if err := callbackBeforeCreateGroup(ctx, req); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupId := req.GroupInfo.GroupID @@ -196,28 +195,28 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR } if req.OwnerUserID == "" { if err := joinGroup(req.OwnerUserID, constant.GroupOwner); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } for _, info := range req.InitMemberList { if err := joinGroup(info.UserID, info.RoleLevel); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } if err := (*imdb.GroupMember)(nil).Create(ctx, groupMembers); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } else { if err := db.DB.CreateSuperGroup(groupId, userIDs, len(userIDs)); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } if err := (*imdb.Group)(nil).Create(ctx, []*imdb.Group{&groupInfo}); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } utils.CopyStructFields(resp.GroupInfo, groupInfo) @@ -226,7 +225,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR chat.GroupCreatedNotification(req.OperationID, req.OpUserID, groupId, userIDs) } else { for _, userID := range userIDs { - if err := rocksCache.DelJoinedSuperGroupIDListFromCache(userID); err != nil { + if err := rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, userID); err != nil { trace_log.SetContextInfo(ctx, "DelJoinedSuperGroupIDListFromCache", err, "userID", userID) } } @@ -247,19 +246,19 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo trace_log.ShowLog(ctx) }() if err := token_verify.CheckAccessV2(ctx, req.OpUserID, req.FromUserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - joinedGroupList, err := rocksCache.GetJoinedGroupIDListFromCache(req.FromUserID) + joinedGroupList, err := rocksCache.GetJoinedGroupIDListFromCache(ctx, req.FromUserID) if err != nil { - SetErr(ctx, "GetJoinedGroupIDListFromCache", err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg, "userID", req.FromUserID) + constant.SetErrorForResp(err, resp.CommonResp) return } for _, groupID := range joinedGroupList { var groupNode open_im_sdk.GroupInfo - num, err := rocksCache.GetGroupMemberNumFromCache(groupID) + num, err := rocksCache.GetGroupMemberNumFromCache(ctx, groupID) if err != nil { - trace_log.SetContextInfo(ctx, "GetGroupMemberNumFromCache", err, "groupID", groupID) + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), groupID) continue } owner, err := (*imdb.GroupMember)(nil).TakeOwnerInfo(ctx, groupID) @@ -270,14 +269,13 @@ func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJo } group, err := rocksCache.GetGroupInfoFromCache(ctx, groupID) if err != nil { - trace_log.SetContextInfo(ctx, "GetGroupInfoFromCache", err, "groupID", groupID) continue } if group.GroupType == constant.SuperGroup { continue } if group.Status == constant.GroupStatusDismissed { - trace_log.SetContextInfo(ctx, "group.Status == constant.GroupStatusDismissed", nil, "groupID", groupID) + trace_log.SetContextInfo(ctx, "GetGroupInfoFromCache", err, "groupID", groupID) continue } utils.CopyStructFields(&groupNode, group) @@ -302,19 +300,16 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite trace_log.ShowLog(ctx) }() if !imdb.IsExistGroupMember(req.GroupID, req.OpUserID) && !token_verify.IsManagerUserID(req.OpUserID) { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(constant.ErrIdentity, resp.CommonResp) return } groupInfo, err := (*imdb.Group)(nil).Take(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if groupInfo.Status == constant.GroupStatusDismissed { - // TODO - //errMsg := " group status is dismissed " - //return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}, nil - SetErrorForResp(constant.ErrStatus, resp.CommonResp) + constant.SetErrorForResp(constant.ErrDismissedAlready, resp.CommonResp) return } if groupInfo.NeedVerification == constant.AllNeedVerification && @@ -333,8 +328,6 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite resultNode.UserID = v resp.Id2ResultList = append(resp.Id2ResultList, &resultNode) continue - // log.NewError(req.OperationID, "InsertIntoGroupRequest failed ", err.Error(), groupRequest) - // return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } else { var resultNode pbGroup.Id2Result resultNode.Result = 0 @@ -349,10 +342,8 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } return } - if err := s.DelGroupAndUserCache(req.OperationID, req.GroupID, req.InvitedUserIDList); err != nil { - //log.NewError(req.OperationID, "DelGroupAndUserCache failed", err.Error()) - //return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: err.Error()}, nil - SetErrorForResp(err, resp.CommonResp) + if err := s.DelGroupAndUserCache(ctx, req.GroupID, req.InvitedUserIDList); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } //from User: invite: applicant @@ -385,7 +376,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite toInsertInfo.InviterUserID = req.OpUserID toInsertInfo.JoinSource = constant.JoinByInvitation if err := CallbackBeforeMemberJoinGroup(ctx, req.OperationID, &toInsertInfo, groupInfo.Ex); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } err = imdb.InsertIntoGroupMember(toInsertInfo) @@ -405,76 +396,17 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } else { okUserIDList = req.InvitedUserIDList if err := db.DB.AddUserToSuperGroup(req.GroupID, req.InvitedUserIDList); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } - // set conversations - var haveConUserID []string - var sessionType int - if groupInfo.GroupType == constant.NormalGroup { - sessionType = constant.GroupChatType - } else { - sessionType = constant.SuperGroupChatType - } - conversations, err := imdb.GetConversationsByConversationIDMultipleOwner(okUserIDList, utils.GetConversationIDBySessionType(req.GroupID, sessionType)) - if err != nil { - trace_log.SetContextInfo(ctx, "GetConversationsByConversationIDMultipleOwner", err, "OwnerUserIDList", okUserIDList, "groupID", req.GroupID, "sessionType", sessionType) - } - for _, v := range conversations { - haveConUserID = append(haveConUserID, v.OwnerUserID) - } - var reqPb pbUser.SetConversationReq - var c pbConversation.Conversation - for _, v := range conversations { - reqPb.OperationID = req.OperationID - c.OwnerUserID = v.OwnerUserID - c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, sessionType) - c.RecvMsgOpt = v.RecvMsgOpt - c.ConversationType = int32(sessionType) - c.GroupID = req.GroupID - c.IsPinned = v.IsPinned - c.AttachedInfo = v.AttachedInfo - c.IsPrivateChat = v.IsPrivateChat - c.GroupAtType = v.GroupAtType - c.IsNotInGroup = false - c.Ex = v.Ex - reqPb.Conversation = &c - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) - if err != nil { - SetErrorForResp(err, resp.CommonResp) - return - } - client := pbUser.NewUserClient(etcdConn) - respPb, err := client.SetConversation(ctx, &reqPb) - trace_log.SetContextInfo(ctx, "SetConversation", err, "req", &reqPb, "resp", respPb) - } - for _, v := range utils.DifferenceString(haveConUserID, okUserIDList) { - reqPb.OperationID = req.OperationID - c.OwnerUserID = v - c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, sessionType) - c.ConversationType = int32(sessionType) - c.GroupID = req.GroupID - c.IsNotInGroup = false - c.UpdateUnreadCountTime = utils.GetCurrentTimestampByMill() - reqPb.Conversation = &c - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) - if err != nil { - SetErrorForResp(err, resp.CommonResp) - return - } - client := pbUser.NewUserClient(etcdConn) - respPb, err := client.SetConversation(context.Background(), &reqPb) - trace_log.SetContextInfo(ctx, "SetConversation", err, "req", &reqPb, "resp", respPb) - } - if groupInfo.GroupType != constant.SuperGroup { chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList) } else { - for _, v := range req.InvitedUserIDList { - if err := rocksCache.DelJoinedSuperGroupIDListFromCache(v); err != nil { - trace_log.SetContextInfo(ctx, "DelJoinedSuperGroupIDListFromCache", err, "userID", v) + for _, userID := range req.InvitedUserIDList { + if err := rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, userID); err != nil { + trace_log.SetContextInfo(ctx, "DelJoinedSuperGroupIDListFromCache", err, "userID", userID) } } for _, v := range req.InvitedUserIDList { @@ -493,13 +425,13 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGro }() groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if groupInfo.GroupType != constant.SuperGroup { - memberList, err := rocksCache.GetGroupMembersInfoFromCache(req.Count, req.Offset, req.GroupID) + memberList, err := rocksCache.GetGroupMembersInfoFromCache(ctx, req.Count, req.Offset, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } for _, v := range memberList { @@ -520,7 +452,7 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr }() memberList, err := imdb.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } @@ -567,24 +499,20 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou }() groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } var okUserIDList []string if groupInfo.GroupType != constant.SuperGroup { opFlag := 0 if !token_verify.IsManagerUserID(req.OpUserID) { - opInfo, err := rocksCache.GetGroupMemberInfoFromCache(req.GroupID, req.OpUserID) + opInfo, err := rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if opInfo.RoleLevel == constant.GroupOrdinaryUsers { - // TODO - //errMsg := req.OperationID + " opInfo.RoleLevel == constant.GroupOrdinaryUsers " + opInfo.UserID + opInfo.GroupID - //log.Error(req.OperationID, errMsg) - //return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(constant.ErrNoPermission, resp.CommonResp) return } else if opInfo.RoleLevel == constant.GroupOwner { opFlag = 2 //owner @@ -599,16 +527,16 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou if len(req.KickedUserIDList) == 0 { //log.NewError(req.OperationID, "failed, kick list 0") //return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}, nil - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrArgs, resp.CommonResp) return } - if err := s.DelGroupAndUserCache(req.OperationID, req.GroupID, req.KickedUserIDList); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := s.DelGroupAndUserCache(ctx, req.GroupID, req.KickedUserIDList); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } //remove for _, v := range req.KickedUserIDList { - kickedInfo, err := rocksCache.GetGroupMemberInfoFromCache(req.GroupID, v) + kickedInfo, err := rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, v) if err != nil { resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) trace_log.SetContextInfo(ctx, "GetGroupMemberInfoFromCache", err, "groupID", req.GroupID, "userID", v) @@ -646,9 +574,9 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou c.GroupID = req.GroupID c.IsNotInGroup = true reqPb.Conversation = &c - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn, err := utils.GetConn(ctx, config.Config.RpcRegisterName.OpenImUserName) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } client := pbUser.NewUserClient(etcdConn) @@ -658,21 +586,21 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } else { okUserIDList = req.KickedUserIDList if err := db.DB.RemoverUserFromSuperGroup(req.GroupID, okUserIDList); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } if groupInfo.GroupType != constant.SuperGroup { for _, userID := range okUserIDList { - if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, userID); err != nil { + if err := rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, userID); err != nil { trace_log.SetContextInfo(ctx, "DelGroupMemberInfoFromCache", err, "groupID", req.GroupID, "userID", userID) } } chat.MemberKickedNotification(req, okUserIDList) } else { for _, userID := range okUserIDList { - if err = rocksCache.DelJoinedSuperGroupIDListFromCache(userID); err != nil { + if err = rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, userID); err != nil { trace_log.SetContextInfo(ctx, "DelGroupMemberInfoFromCache", err, "userID", userID) } } @@ -692,22 +620,20 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetG trace_log.ShowLog(ctx) }() ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) - resp = &pbGroup.GetGroupMembersInfoResp{CommonResp: &open_im_sdk.CommonResp{}} resp.MemberList = []*open_im_sdk.GroupMemberFullInfo{} for _, userID := range req.MemberList { - groupMember, err := rocksCache.GetGroupMemberInfoFromCache(req.GroupID, userID) + groupMember, err := rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, userID) if err != nil { - trace_log.SetContextInfo(ctx, "GetGroupMemberInfoFromCache", err, "groupID", req.GroupID, "userID", userID) - continue + constant.SetErrorForResp(err, resp.CommonResp) + return } var memberNode open_im_sdk.GroupMemberFullInfo utils.CopyStructFields(&memberNode, groupMember) memberNode.JoinTime = int32(groupMember.JoinTime.Unix()) resp.MemberList = append(resp.MemberList, &memberNode) } - SetErr(ctx, "GetGroupMemberInfoFromCache", err, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg, "groupID", req.GroupID) - return + return resp, nil } func FillGroupInfoByGroupID(operationID, groupID string, groupInfo *open_im_sdk.GroupInfo) error { @@ -733,26 +659,6 @@ func FillPublicUserInfoByUserID(operationID, userID string, userInfo *open_im_sd return nil } -func SetErr(ctx context.Context, funcName string, err error, errCode *int32, errMsg *string, args ...interface{}) { - errInfo := constant.ToAPIErrWithErr(err) - *errCode = errInfo.ErrCode - *errMsg = errInfo.WrapErrMsg - trace_log.SetContextInfo(ctx, funcName, err, args) -} - -func SetErrCodeMsg(ctx context.Context, funcName string, errCodeFrom int32, errMsgFrom string, errCode *int32, errMsg *string, args ...interface{}) { - *errCode = errCodeFrom - *errMsg = errMsgFrom - trace_log.SetContextInfo(ctx, funcName, constant.ToAPIErrWithErrCode(errCodeFrom), args) -} - -func SetErrorForResp(err error, commonResp *open_im_sdk.CommonResp) { - errInfo := constant.ToAPIErrWithErr(err) - commonResp.ErrCode = errInfo.ErrCode - commonResp.ErrMsg = errInfo.ErrMsg - commonResp.DetailErrMsg = err.Error() -} - func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (resp *pbGroup.GetGroupApplicationListResp, err error) { ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), err, "rpc req ", req.String(), "rpc resp ", resp.String()) @@ -761,7 +667,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. resp = &pbGroup.GetGroupApplicationListResp{CommonResp: &open_im_sdk.CommonResp{}} reply, err := imdb.GetRecvGroupApplicationList(req.FromUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return resp, nil } var errResult error @@ -785,7 +691,7 @@ func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup. resp.GroupRequestList = append(resp.GroupRequestList, &node) } if errResult != nil && len(resp.GroupRequestList) == 0 { - SetErr(ctx, "", errResult, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg) + constant.SetErrorForResp(err, resp.CommonResp) return resp, nil } trace_log.SetRpcRespInfo(ctx, utils.GetSelfFuncName(), resp.String()) @@ -803,7 +709,7 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI for _, groupID := range req.GroupIDList { groupInfoFromRedis, err := rocksCache.GetGroupInfoFromCache(ctx, groupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) continue } var groupInfo open_im_sdk.GroupInfo @@ -833,7 +739,7 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup trace_log.ShowLog(ctx) }() if err := CheckPermission(ctx, req.GroupID, req.OpUserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupRequest := imdb.GroupRequest{} @@ -842,23 +748,23 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup groupRequest.HandleUserID = req.OpUserID groupRequest.HandledTime = time.Now() if err := (&imdb.GroupRequest{}).Update(ctx, []*imdb.GroupRequest{&groupRequest}); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if req.HandleResult == constant.GroupResponseAgree { user, err := imdb.GetUserByUserID(req.FromUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } request, err := (&imdb.GroupRequest{}).Take(ctx, req.GroupID, req.FromUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } member := imdb.GroupMember{} @@ -873,46 +779,39 @@ func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup member.MuteEndTime = time.Unix(int64(time.Now().Second()), 0) err = CallbackBeforeMemberJoinGroup(ctx, req.OperationID, &member, groupInfo.Ex) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } err = (&imdb.GroupMember{}).Create(ctx, []*imdb.GroupMember{&member}) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } etcdCacheConn, err := fault_tolerant.GetDefaultConn(config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } cacheClient := pbCache.NewCacheClient(etcdCacheConn) cacheResp, err := cacheClient.DelGroupMemberIDListFromCache(context.Background(), &pbCache.DelGroupMemberIDListFromCacheReq{OperationID: req.OperationID, GroupID: req.GroupID}) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if cacheResp.CommonResp.ErrCode != 0 { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - if err := rocksCache.DelGroupMemberListHashFromCache(req.GroupID); err != nil { - trace_log.SetContextInfo(ctx, "DelGroupMemberListHashFromCache", err, "groupID ", req.GroupID) - } - if err := rocksCache.DelJoinedGroupIDListFromCache(req.FromUserID); err != nil { - trace_log.SetContextInfo(ctx, "DelJoinedGroupIDListFromCache", err, "userID ", req.FromUserID) - } - if err := rocksCache.DelGroupMemberNumFromCache(req.GroupID); err != nil { - trace_log.SetContextInfo(ctx, "DelJoinedGroupIDListFromCache", err, "groupID ", req.GroupID) - } + _ = rocksCache.DelGroupMemberListHashFromCache(ctx, req.GroupID) + _ = rocksCache.DelJoinedGroupIDListFromCache(ctx, req.FromUserID) + _ = rocksCache.DelGroupMemberNumFromCache(ctx, req.GroupID) chat.GroupApplicationAcceptedNotification(req) chat.MemberEnterNotification(req) } else if req.HandleResult == constant.GroupResponseRefuse { chat.GroupApplicationRejectedNotification(req) } else { - // TODO - SetErr(ctx, "", constant.ErrArgs, &resp.CommonResp.ErrCode, &resp.CommonResp.ErrMsg) + constant.SetErrorForResp(constant.ErrArgs, resp.CommonResp) return } return @@ -926,19 +825,16 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) trace_log.ShowLog(ctx) }() if _, err := imdb.GetUserByUserID(req.OpUserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupInfo, err := rocksCache.GetGroupInfoFromCache(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if groupInfo.Status == constant.GroupStatusDismissed { - // TODO - //errMsg := " group status is dismissed " - //return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}}, nil - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrDismissedAlready, resp.CommonResp) return } @@ -946,25 +842,23 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) if groupInfo.GroupType != constant.SuperGroup { us, err := imdb.GetUserByUserID(req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } //to group member groupMember := imdb.GroupMember{GroupID: req.GroupID, RoleLevel: constant.GroupOrdinaryUsers, OperatorUserID: req.OpUserID} utils.CopyStructFields(&groupMember, us) if err := CallbackBeforeMemberJoinGroup(ctx, req.OperationID, &groupMember, groupInfo.Ex); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - - if err := s.DelGroupAndUserCache(req.OperationID, req.GroupID, []string{req.OpUserID}); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := s.DelGroupAndUserCache(ctx, req.GroupID, []string{req.OpUserID}); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } - err = imdb.InsertIntoGroupMember(groupMember) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } @@ -984,9 +878,9 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) c.IsNotInGroup = false c.UpdateUnreadCountTime = utils.GetCurrentTimestampByMill() reqPb.Conversation = &c - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn, err := utils.GetConn(ctx, config.Config.RpcRegisterName.OpenImUserName) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } client := pbUser.NewUserClient(etcdConn) @@ -995,11 +889,9 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) chat.MemberEnterDirectlyNotification(req.GroupID, req.OpUserID, req.OperationID) return } else { - // todo - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrGroupTypeNotSupport, resp.CommonResp) + log.Error(req.OperationID, "JoinGroup rpc failed, group type: ", groupInfo.GroupType, "not support directly") return - //log.Error(req.OperationID, "JoinGroup rpc failed, group type: ", groupInfo.GroupType, "not support directly") - //return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil } } var groupRequest imdb.GroupRequest @@ -1009,14 +901,9 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) groupRequest.JoinSource = req.JoinSource err = imdb.InsertIntoGroupRequest(groupRequest) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - //_, err = imdb.GetGroupMemberListByGroupIDAndRoleLevel(req.GroupID, constant.GroupOwner) - //if err != nil { - // log.NewError(req.OperationID, "GetGroupMemberListByGroupIDAndRoleLevel failed ", err.Error(), req.GroupID, constant.GroupOwner) - // return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil - chat.JoinGroupApplicationNotification(req) return } @@ -1030,70 +917,38 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) }() groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if groupInfo.GroupType != constant.SuperGroup { - _, err = imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.OpUserID) + _, err = rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - - if err := s.DelGroupAndUserCache(req.OperationID, req.GroupID, []string{req.OpUserID}); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := s.DelGroupAndUserCache(ctx, req.GroupID, []string{req.OpUserID}); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } - err = imdb.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + log.Error(req.OperationID, "JoinGroup rpc failed, group type: ", groupInfo.GroupType, "not support directly") return } - - err = db.DB.DelGroupMember(req.GroupID, req.OpUserID) - if err != nil { - SetErrorForResp(err, resp.CommonResp) - return - } - //modify quitter conversation info - var reqPb pbUser.SetConversationReq - var c pbConversation.Conversation - reqPb.OperationID = req.OperationID - c.OwnerUserID = req.OpUserID - c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType) - c.ConversationType = constant.GroupChatType - c.GroupID = req.GroupID - c.IsNotInGroup = true - reqPb.Conversation = &c - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) - if etcdConn == nil { - SetErrorForResp(err, resp.CommonResp) - return - } - client := pbUser.NewUserClient(etcdConn) - respPb, err := client.SetConversation(context.Background(), &reqPb) - trace_log.SetContextInfo(ctx, "SetConversation", err, "req", &reqPb, "resp", respPb) } else { okUserIDList := []string{req.OpUserID} if err := db.DB.RemoverUserFromSuperGroup(req.GroupID, okUserIDList); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } if groupInfo.GroupType != constant.SuperGroup { - if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.OpUserID); err != nil { - trace_log.SetContextInfo(ctx, "DelGroupMemberInfoFromCache", err, "groupID", req.GroupID, "userID", req.OpUserID) - } + _ = rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.OpUserID) chat.MemberQuitNotification(req) } else { - if err := rocksCache.DelJoinedSuperGroupIDListFromCache(req.OpUserID); err != nil { - trace_log.SetContextInfo(ctx, "DelJoinedSuperGroupIDListFromCache", err, "userID", req.OpUserID) - } - if err := rocksCache.DelGroupMemberListHashFromCache(req.GroupID); err != nil { - trace_log.SetContextInfo(ctx, "DelGroupMemberListHashFromCache", err, "groupID", req.GroupID) - } + _ = rocksCache.DelJoinedSuperGroupIDListFromCache(ctx, req.OpUserID) + _ = rocksCache.DelGroupMemberListHashFromCache(ctx, req.GroupID) chat.SuperGroupNotification(req.OperationID, req.OpUserID, req.OpUserID) } return @@ -1123,23 +978,19 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf trace_log.ShowLog(ctx) }() if !hasAccess(req) { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(constant.ErrIdentity, resp.CommonResp) return } group, err := imdb.GetGroupInfoByGroupID(req.GroupInfoForSet.GroupID) if err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if group.Status == constant.GroupStatusDismissed { - // TODO - //errMsg := " group status is dismissed " - //return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}}, nil - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrDismissedAlready, resp.CommonResp) return } - ////bitwise operators: 0001:groupName; 0010:Notification 0100:Introduction; 1000:FaceUrl; 10000:owner var changedType int32 groupName := "" notification := "" @@ -1167,7 +1018,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf m := make(map[string]interface{}) m["need_verification"] = req.GroupInfoForSet.NeedVerification.Value if err := imdb.UpdateGroupInfoDefaultZero(req.GroupInfoForSet.GroupID, m); err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } @@ -1176,7 +1027,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf m := make(map[string]interface{}) m["look_member_info"] = req.GroupInfoForSet.LookMemberInfo.Value if err := imdb.UpdateGroupInfoDefaultZero(req.GroupInfoForSet.GroupID, m); err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } @@ -1185,14 +1036,10 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf m := make(map[string]interface{}) m["apply_member_friend"] = req.GroupInfoForSet.ApplyMemberFriend.Value if err := imdb.UpdateGroupInfoDefaultZero(req.GroupInfoForSet.GroupID, m); err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(constant.ErrIdentity, resp.CommonResp) return } } - // - //if req.RoleLevel != nil { - // - //} //only administrators can set group information var groupInfo imdb.Group utils.CopyStructFields(&groupInfo, req.GroupInfoForSet) @@ -1200,43 +1047,37 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf groupInfo.NotificationUserID = req.OpUserID groupInfo.NotificationUpdateTime = time.Now() } - if err := rocksCache.DelGroupInfoFromCache(req.GroupInfoForSet.GroupID); err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + if err := rocksCache.DelGroupInfoFromCache(ctx, req.GroupInfoForSet.GroupID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } err = imdb.SetGroupInfo(groupInfo) if err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - log.NewInfo(req.OperationID, "SetGroupInfo rpc return ", pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}) if changedType != 0 { chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfoForSet.GroupID, groupName, notification, introduction, faceURL, req.GroupInfoForSet.NeedVerification) } if req.GroupInfoForSet.Notification != "" { //get group member user id getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: req.OperationID, GroupID: req.GroupInfoForSet.GroupID} - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn, err := utils.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) if err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } client := pbCache.NewCacheClient(etcdConn) cacheResp, err := client.GetGroupMemberIDListFromCache(ctx, getGroupMemberIDListFromCacheReq) if err != nil { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - if cacheResp.CommonResp.ErrCode != 0 { - //log.NewError(req.OperationID, "GetGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String()) - //return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil - // TODO - resp.CommonResp.ErrCode = cacheResp.CommonResp.ErrCode - resp.CommonResp.ErrMsg = cacheResp.CommonResp.ErrMsg + if err = constant.CommonResp2Err(cacheResp.CommonResp); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } var conversationReq pbConversation.ModifyConversationFieldReq - conversation := pbConversation.Conversation{ OwnerUserID: req.OpUserID, ConversationID: utils.GetConversationIDBySessionType(req.GroupInfoForSet.GroupID, constant.GroupChatType), @@ -1248,9 +1089,9 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf conversationReq.FieldType = constant.FieldGroupAtType conversation.GroupAtType = constant.GroupNotification conversationReq.UserIDList = cacheResp.UserIDList - nEtcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID) + nEtcdConn, err := utils.GetConn(ctx, config.Config.RpcRegisterName.OpenImConversationName) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } nClient := pbConversation.NewConversationClient(nEtcdConn) @@ -1270,42 +1111,39 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if groupInfo.Status == constant.GroupStatusDismissed { - // TODO - //errMsg := " group status is dismissed " - //return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrStatus.ErrCode, ErrMsg: errMsg}}, nil - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(constant.ErrDismissedAlready, resp.CommonResp) return } if req.OldOwnerUserID == req.NewOwnerUserID { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - err = rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.NewOwnerUserID) + err = rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.NewOwnerUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - err = rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.OldOwnerUserID) + err = rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.OldOwnerUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupMemberInfo := imdb.GroupMember{GroupID: req.GroupID, UserID: req.OldOwnerUserID, RoleLevel: constant.GroupOrdinaryUsers} err = imdb.UpdateGroupMemberInfo(groupMemberInfo) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupMemberInfo = imdb.GroupMember{GroupID: req.GroupID, UserID: req.NewOwnerUserID, RoleLevel: constant.GroupOwner} err = imdb.UpdateGroupMemberInfo(groupMemberInfo) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } chat.GroupOwnerTransferredNotification(req) @@ -1315,7 +1153,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.Trans func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) (resp *pbGroup.GetGroupsResp, err error) { resp = &pbGroup.GetGroupsResp{ CommonResp: &open_im_sdk.CommonResp{}, - CMSGroups: []*pbGroup.CMSGroup{}, + Groups: []*pbGroup.CMSGroup{}, Pagination: &open_im_sdk.ResponsePagination{CurrentPage: req.Pagination.PageNumber, ShowNumber: req.Pagination.ShowNumber}, } ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) @@ -1329,7 +1167,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) if errors.Is(err, gorm.ErrRecordNotFound) { return resp, nil } - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } resp.GroupNum = 1 @@ -1337,17 +1175,17 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) utils.CopyStructFields(groupInfo, groupInfoDB) groupMember, err := imdb.GetGroupOwnerInfoByGroupID(req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } memberNum, err := imdb.GetGroupMembersCount(req.GroupID, "") if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupInfo.MemberCount = uint32(memberNum) groupInfo.CreateTime = uint32(groupInfoDB.CreateTime.Unix()) - resp.CMSGroups = append(resp.CMSGroups, &pbGroup.CMSGroup{GroupInfo: groupInfo, GroupOwnerUserName: groupMember.Nickname, GroupOwnerUserID: groupMember.UserID}) + resp.Groups = append(resp.Groups, &pbGroup.CMSGroup{GroupInfo: groupInfo, GroupOwnerUserName: groupMember.Nickname, GroupOwnerUserID: groupMember.UserID}) } else { groups, count, err := imdb.GetGroupsByName(req.GroupName, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { @@ -1364,7 +1202,7 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) group.GroupInfo.CreateTime = uint32(v.CreateTime.Unix()) group.GroupOwnerUserID = groupMember.UserID group.GroupOwnerUserName = groupMember.Nickname - resp.CMSGroups = append(resp.CMSGroups, group) + resp.Groups = append(resp.Groups, group) } resp.GroupNum = int32(count) } @@ -1380,12 +1218,12 @@ func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGr }() groupMembers, err := imdb.GetGroupMembersByGroupIdCMS(req.GroupID, req.UserName, req.Pagination.ShowNumber, req.Pagination.PageNumber) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupMembersCount, err := imdb.GetGroupMembersCount(req.GroupID, req.UserName) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } log.NewInfo(req.OperationID, groupMembersCount) @@ -1413,7 +1251,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou }() groupRequests, err := imdb.GetUserReqGroupByUserID(req.UserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } for _, groupReq := range groupRequests { @@ -1444,27 +1282,27 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou trace_log.ShowLog(ctx) }() if !token_verify.IsManagerUserID(req.OpUserID) && !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(constant.ErrIdentity, resp.CommonResp) return } - if err := rocksCache.DelGroupInfoFromCache(req.GroupID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupInfoFromCache(ctx, req.GroupID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } - if err := s.DelGroupAndUserCache(req.OperationID, req.GroupID, nil); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := s.DelGroupAndUserCache(ctx, req.GroupID, nil); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } err := imdb.OperateGroupStatus(req.GroupID, constant.GroupStatusDismissed) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupInfo, err := imdb.GetGroupInfoByGroupID(req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if groupInfo.GroupType != constant.SuperGroup { @@ -1483,36 +1321,27 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou c.GroupID = req.GroupID c.IsNotInGroup = true reqPb.Conversation = &c - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) - if err != nil { - SetErrorForResp(err, resp.CommonResp) - return - } + etcdConn, err := utils.GetConn(ctx, config.Config.RpcRegisterName.OpenImUserName) client := pbUser.NewUserClient(etcdConn) respPb, err := client.SetConversation(context.Background(), &reqPb) trace_log.SetContextInfo(ctx, "SetConversation", err, "req", &reqPb, "resp", respPb) } err = imdb.DeleteGroupMemberByGroupID(req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } chat.GroupDismissedNotification(req) } else { err = db.DB.DeleteSuperGroup(req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } } return } -// rpc MuteGroupMember(MuteGroupMemberReq) returns(MuteGroupMemberResp); -// rpc CancelMuteGroupMember(CancelMuteGroupMemberReq) returns(CancelMuteGroupMemberResp); -// rpc MuteGroup(MuteGroupReq) returns(MuteGroupResp); -// rpc CancelMuteGroup(CancelMuteGroupReq) returns(CancelMuteGroupResp); - func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (resp *pbGroup.MuteGroupMemberResp, _ error) { resp = &pbGroup.MuteGroupMemberResp{CommonResp: &open_im_sdk.CommonResp{}} ctx = trace_log.NewRpcCtx(ctx, utils.GetSelfFuncName(), req.OperationID) @@ -1522,41 +1351,37 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou }() opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if opFlag == 0 { - // TODO - //errMsg := req.OperationID + "opFlag == 0 " + req.GroupID + req.OpUserID - //log.Error(req.OperationID, errMsg) - //return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(constant.ErrNoPermission, resp.CommonResp) return } - mutedInfo, err := rocksCache.GetGroupMemberInfoFromCache(req.GroupID, req.UserID) + mutedInfo, err := rocksCache.GetGroupMemberInfoFromCache(ctx, req.GroupID, req.UserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if mutedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 { - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if mutedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 { - SetErrorForResp(constant.ErrArgs, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.UserID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } groupMemberInfo := imdb.GroupMember{GroupID: req.GroupID, UserID: req.UserID} groupMemberInfo.MuteEndTime = time.Unix(int64(time.Now().Second())+int64(req.MutedSeconds), time.Now().UnixNano()) err = imdb.UpdateGroupMemberInfo(groupMemberInfo) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } chat.GroupMemberMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, req.MutedSeconds) @@ -1573,29 +1398,29 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if opFlag == 0 { - SetErrorForResp(constant.ErrAccess, resp.CommonResp) + constant.SetErrorForResp(constant.ErrNoPermission, resp.CommonResp) return } mutedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.UserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if mutedInfo.RoleLevel == constant.GroupOwner && opFlag != 1 { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if mutedInfo.RoleLevel == constant.GroupAdmin && opFlag == 3 { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } - if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.UserID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } @@ -1603,7 +1428,7 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca groupMemberInfo.MuteEndTime = time.Unix(0, 0) err = imdb.UpdateGroupMemberInfo(groupMemberInfo) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } chat.GroupMemberCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID) @@ -1619,14 +1444,14 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) }() opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if opFlag == 0 { //errMsg := req.OperationID + "opFlag == 0 " + req.GroupID + req.OpUserID //log.Error(req.OperationID, errMsg) //return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil - SetErrorForResp(constant.ErrAccess, resp.CommonResp) + constant.SetErrorForResp(constant.ErrNoPermission, resp.CommonResp) return } @@ -1643,14 +1468,14 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) // errMsg := req.OperationID + " mutedInfo.RoleLevel == constant.GroupAdmin " + req.GroupID + req.OpUserID + err.Error() // return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil //} - if err := rocksCache.DelGroupInfoFromCache(req.GroupID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupInfoFromCache(ctx, req.GroupID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } err = imdb.OperateGroupStatus(req.GroupID, constant.GroupStatusMuted) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } @@ -1667,11 +1492,11 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu }() opFlag, err := s.getGroupUserLevel(req.GroupID, req.OpUserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if opFlag == 0 { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } //mutedInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.) @@ -1688,13 +1513,13 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu // return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: errMsg}}, nil //} log.Debug(req.OperationID, "UpdateGroupInfoDefaultZero ", req.GroupID, map[string]interface{}{"status": constant.GroupOk}) - if err := rocksCache.DelGroupInfoFromCache(req.GroupID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupInfoFromCache(ctx, req.GroupID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } err = imdb.UpdateGroupInfoDefaultZero(req.GroupID, map[string]interface{}{"status": constant.GroupOk}) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } chat.GroupCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID) @@ -1709,7 +1534,7 @@ func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.S trace_log.ShowLog(ctx) }() if req.OpUserID != req.UserID && !token_verify.IsManagerUserID(req.OpUserID) { - SetErrorForResp(constant.ErrIdentity, resp.CommonResp) + constant.SetErrorForResp(constant.ErrIdentity, resp.CommonResp) return } cbReq := &pbGroup.SetGroupMemberInfoReq{ @@ -1720,7 +1545,7 @@ func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.S Nickname: &wrapperspb.StringValue{Value: req.Nickname}, } if err := CallbackBeforeSetGroupMemberInfo(ctx, cbReq); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } nickName := cbReq.Nickname.Value @@ -1730,7 +1555,7 @@ func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.S if nickName == "" { userNickname, err := imdb.GetUserNameByUserID(groupMemberInfo.UserID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupMemberInfo.Nickname = userNickname @@ -1738,13 +1563,13 @@ func (s *groupServer) SetGroupMemberNickname(ctx context.Context, req *pbGroup.S groupMemberInfo.Nickname = nickName } - if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.UserID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } if err := imdb.UpdateGroupMemberInfo(groupMemberInfo); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } chat.GroupMemberInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID) @@ -1758,12 +1583,12 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), nil, "rpc req ", req.String(), "rpc resp ", resp.String()) trace_log.ShowLog(ctx) }() - if err := rocksCache.DelGroupMemberInfoFromCache(req.GroupID, req.UserID); err != nil { - SetErrorForResp(err, resp.CommonResp) + if err := rocksCache.DelGroupMemberInfoFromCache(ctx, req.GroupID, req.UserID); err != nil { + constant.SetErrorForResp(err, resp.CommonResp) return } if err := CallbackBeforeSetGroupMemberInfo(ctx, req); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } groupMember := imdb.GroupMember{ @@ -1786,7 +1611,7 @@ func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGr m["ex"] = nil } if err := imdb.UpdateGroupMemberInfoByMap(groupMember, m); err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } if req.RoleLevel != nil { @@ -1811,28 +1636,27 @@ func (s *groupServer) GetGroupAbstractInfo(ctx context.Context, req *pbGroup.Get trace_log.SetContextInfo(ctx, utils.GetSelfFuncName(), nil, "rpc req ", req.String(), "rpc resp ", resp.String()) trace_log.ShowLog(ctx) }() - hashCode, err := rocksCache.GetGroupMemberListHashFromCache(req.GroupID) + hashCode, err := rocksCache.GetGroupMemberListHashFromCache(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } resp.GroupMemberListHash = hashCode - num, err := rocksCache.GetGroupMemberNumFromCache(req.GroupID) + num, err := rocksCache.GetGroupMemberNumFromCache(ctx, req.GroupID) if err != nil { - SetErrorForResp(err, resp.CommonResp) + constant.SetErrorForResp(err, resp.CommonResp) return } resp.GroupMemberNumber = int32(num) return resp, nil } -func (s *groupServer) DelGroupAndUserCache(operationID, groupID string, userIDList []string) error { +func (s *groupServer) DelGroupAndUserCache(ctx context.Context, groupID string, userIDList []string) error { + operationID := trace_log.GetOperationID(ctx) if groupID != "" { - etcdConn, err := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, operationID) - if etcdConn == nil { - errMsg := operationID + "getcdv3.GetDefaultConn == nil" - log.NewError(operationID, errMsg) - return errors.New("etcdConn is nil") + etcdConn, err := utils.GetConn(ctx, config.Config.RpcRegisterName.OpenImCacheName) + if err != nil { + return err } cacheClient := pbCache.NewCacheClient(etcdConn) cacheResp, err := cacheClient.DelGroupMemberIDListFromCache(context.Background(), &pbCache.DelGroupMemberIDListFromCacheReq{ @@ -1843,16 +1667,13 @@ func (s *groupServer) DelGroupAndUserCache(operationID, groupID string, userIDLi log.NewError(operationID, "DelGroupMemberIDListFromCache rpc call failed ", err.Error()) return utils.Wrap(err, "") } - if cacheResp.CommonResp.ErrCode != 0 { - log.NewError(operationID, "DelGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String()) - return errors.New(fmt.Sprintf("errMsg is %s, errCode is %d", cacheResp.CommonResp.ErrMsg, cacheResp.CommonResp.ErrCode)) - } - err = rocksCache.DelGroupMemberListHashFromCache(groupID) + err = constant.CommonResp2Err(cacheResp.CommonResp) + err = rocksCache.DelGroupMemberListHashFromCache(ctx, groupID) if err != nil { log.NewError(operationID, utils.GetSelfFuncName(), groupID, err.Error()) return utils.Wrap(err, "") } - err = rocksCache.DelGroupMemberNumFromCache(groupID) + err = rocksCache.DelGroupMemberNumFromCache(ctx, groupID) if err != nil { log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), groupID) return utils.Wrap(err, "") @@ -1860,7 +1681,7 @@ func (s *groupServer) DelGroupAndUserCache(operationID, groupID string, userIDLi } if userIDList != nil { for _, userID := range userIDList { - err := rocksCache.DelJoinedGroupIDListFromCache(userID) + err := rocksCache.DelJoinedGroupIDListFromCache(ctx, userID) if err != nil { log.NewError(operationID, utils.GetSelfFuncName(), err.Error()) return utils.Wrap(err, "") diff --git a/pkg/common/constant/error.go b/pkg/common/constant/error.go index 6bc32c675..94b4270b0 100644 --- a/pkg/common/constant/error.go +++ b/pkg/common/constant/error.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "gorm.io/gorm" ) @@ -49,6 +50,7 @@ var ( ErrDismissedAlready = ErrInfo{DismissedAlreadyError, "DismissedAlreadyError", ""} ErrOwnerNotAllowedQuit = ErrInfo{OwnerNotAllowedQuitError, "OwnerNotAllowedQuitError", ""} ErrRegisteredAlready = ErrInfo{RegisteredAlreadyError, "RegisteredAlreadyError", ""} + ErrGroupTypeNotSupport = ErrInfo{GroupTypeNotSupport, "", ""} ErrDefaultOther = ErrInfo{DefaultOtherError, "DefaultOtherError", ""} ErrData = ErrInfo{DataError, "DataError", ""} @@ -102,6 +104,20 @@ func ToAPIErrWithErr(err error) ErrInfo { return ErrDefaultOther } +func SetErrorForResp(err error, commonResp *sdkws.CommonResp) { + errInfo := ToAPIErrWithErr(err) + commonResp.ErrCode = errInfo.ErrCode + commonResp.ErrMsg = errInfo.ErrMsg + commonResp.DetailErrMsg = err.Error() +} + +func CommonResp2Err(resp *sdkws.CommonResp) error { + if resp.ErrCode != NoError { + return errors.New(fmt.Sprintf("call rpc error, errCode is %d, errMsg is %s, detailErrMsg is %s", resp.ErrCode, resp.ErrMsg, resp.DetailErrMsg)) + } + return nil +} + func Error2CommResp(ctx context.Context, info ErrInfo, detailErrMsg string) *sdkws.CommonResp { err := &sdkws.CommonResp{ ErrCode: info.ErrCode, @@ -166,6 +182,7 @@ const ( NotInGroupYetError = 93004 //不在群组中 DismissedAlreadyError = 93004 //群组已经解散 OwnerNotAllowedQuitError = 93004 //群主不能退群 + GroupTypeNotSupport = 93005 ) // 用户错误码 diff --git a/pkg/common/db/rocks_cache/rocks_cache.go b/pkg/common/db/rocks_cache/rocks_cache.go index d11459110..2403a4038 100644 --- a/pkg/common/db/rocks_cache/rocks_cache.go +++ b/pkg/common/db/rocks_cache/rocks_cache.go @@ -5,6 +5,7 @@ import ( "Open_IM/pkg/common/db" imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" + "Open_IM/pkg/common/trace_log" "Open_IM/pkg/utils" "context" "encoding/json" @@ -69,7 +70,7 @@ func DelKeys() { } } -func GetFriendIDListFromCache(userID string) ([]string, error) { +func GetFriendIDListFromCache(ctx context.Context, userID string) (friendIDList []string, err error) { getFriendIDList := func() (string, error) { friendIDList, err := imdb.GetFriendIDListByUserID(userID) if err != nil { @@ -81,21 +82,25 @@ func GetFriendIDListFromCache(userID string) ([]string, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "friendIDList", friendIDList) + }() friendIDListStr, err := db.DB.Rc.Fetch(friendRelationCache+userID, time.Second*30*60, getFriendIDList) if err != nil { return nil, utils.Wrap(err, "") } - var friendIDList []string err = json.Unmarshal([]byte(friendIDListStr), &friendIDList) return friendIDList, utils.Wrap(err, "") } -func DelFriendIDListFromCache(userID string) error { - err := db.DB.Rc.TagAsDeleted(friendRelationCache + userID) - return err +func DelFriendIDListFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID) + }() + return db.DB.Rc.TagAsDeleted(friendRelationCache + userID) } -func GetBlackListFromCache(userID string) ([]string, error) { +func GetBlackListFromCache(ctx context.Context, userID string) (blackIDList []string, err error) { getBlackIDList := func() (string, error) { blackIDList, err := imdb.GetBlackIDListByUserID(userID) if err != nil { @@ -107,20 +112,25 @@ func GetBlackListFromCache(userID string) ([]string, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "blackIDList", blackIDList) + }() blackIDListStr, err := db.DB.Rc.Fetch(blackListCache+userID, time.Second*30*60, getBlackIDList) if err != nil { return nil, utils.Wrap(err, "") } - var blackIDList []string err = json.Unmarshal([]byte(blackIDListStr), &blackIDList) return blackIDList, utils.Wrap(err, "") } -func DelBlackIDListFromCache(userID string) error { +func DelBlackIDListFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ctx", ctx) + }() return db.DB.Rc.TagAsDeleted(blackListCache + userID) } -func GetJoinedGroupIDListFromCache(userID string) ([]string, error) { +func GetJoinedGroupIDListFromCache(ctx context.Context, userID string) (joinedGroupList []string, err error) { getJoinedGroupIDList := func() (string, error) { joinedGroupList, err := imdb.GetJoinedGroupIDListByUserID(userID) if err != nil { @@ -132,22 +142,27 @@ func GetJoinedGroupIDListFromCache(userID string) ([]string, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedGroupList", joinedGroupList) + }() joinedGroupIDListStr, err := db.DB.Rc.Fetch(joinedGroupListCache+userID, time.Second*30*60, getJoinedGroupIDList) if err != nil { return nil, utils.Wrap(err, "") } - var joinedGroupList []string err = json.Unmarshal([]byte(joinedGroupIDListStr), &joinedGroupList) return joinedGroupList, utils.Wrap(err, "") } -func DelJoinedGroupIDListFromCache(userID string) error { +func DelJoinedGroupIDListFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID) + }() return db.DB.Rc.TagAsDeleted(joinedGroupListCache + userID) } -func GetGroupMemberIDListFromCache(groupID string) ([]string, error) { +func GetGroupMemberIDListFromCache(ctx context.Context, groupID string) (groupMemberIDList []string, err error) { f := func() (string, error) { - groupInfo, err := GetGroupInfoFromCache(groupID) + groupInfo, err := GetGroupInfoFromCache(ctx, groupID) if err != nil { return "", utils.Wrap(err, "GetGroupInfoFromCache failed") } @@ -170,21 +185,25 @@ func GetGroupMemberIDListFromCache(groupID string) ([]string, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMemberIDList", groupMemberIDList) + }() groupIDListStr, err := db.DB.Rc.Fetch(groupCache+groupID, time.Second*30*60, f) if err != nil { return nil, utils.Wrap(err, "") } - var groupMemberIDList []string err = json.Unmarshal([]byte(groupIDListStr), &groupMemberIDList) return groupMemberIDList, utils.Wrap(err, "") } -func DelGroupMemberIDListFromCache(groupID string) error { - err := db.DB.Rc.TagAsDeleted(groupCache + groupID) - return err +func DelGroupMemberIDListFromCache(ctx context.Context, groupID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID) + }() + return db.DB.Rc.TagAsDeleted(groupCache + groupID) } -func GetUserInfoFromCache(userID string) (*imdb.User, error) { +func GetUserInfoFromCache(ctx context.Context, userID string) (userInfo *imdb.User, err error) { getUserInfo := func() (string, error) { userInfo, err := imdb.GetUserByUserID(userID) if err != nil { @@ -196,19 +215,22 @@ func GetUserInfoFromCache(userID string) (*imdb.User, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "userInfo", *userInfo) + }() userInfoStr, err := db.DB.Rc.Fetch(userInfoCache+userID, time.Second*30*60, getUserInfo) if err != nil { return nil, utils.Wrap(err, "") } - userInfo := &imdb.User{} + userInfo = &imdb.User{} err = json.Unmarshal([]byte(userInfoStr), userInfo) return userInfo, utils.Wrap(err, "") } -func GetUserInfoFromCacheBatch(userIDs []string) ([]*imdb.User, error) { +func GetUserInfoFromCacheBatch(ctx context.Context, userIDs []string) ([]*imdb.User, error) { var users []*imdb.User for _, userID := range userIDs { - user, err := GetUserInfoFromCache(userID) + user, err := GetUserInfoFromCache(ctx, userID) if err != nil { return nil, err } @@ -217,11 +239,14 @@ func GetUserInfoFromCacheBatch(userIDs []string) ([]*imdb.User, error) { return users, nil } -func DelUserInfoFromCache(userID string) error { +func DelUserInfoFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID) + }() return db.DB.Rc.TagAsDeleted(userInfoCache + userID) } -func GetGroupMemberInfoFromCache(groupID, userID string) (*imdb.GroupMember, error) { +func GetGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (groupMember *imdb.GroupMember, err error) { getGroupMemberInfo := func() (string, error) { groupMemberInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) if err != nil { @@ -233,21 +258,30 @@ func GetGroupMemberInfoFromCache(groupID, userID string) (*imdb.GroupMember, err } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember) + }() groupMemberInfoStr, err := db.DB.Rc.Fetch(groupMemberInfoCache+groupID+"-"+userID, time.Second*30*60, getGroupMemberInfo) if err != nil { return nil, utils.Wrap(err, "") } - groupMember := &imdb.GroupMember{} + groupMember = &imdb.GroupMember{} err = json.Unmarshal([]byte(groupMemberInfoStr), groupMember) return groupMember, utils.Wrap(err, "") } -func DelGroupMemberInfoFromCache(groupID, userID string) error { +func DelGroupMemberInfoFromCache(ctx context.Context, groupID, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID) + }() return db.DB.Rc.TagAsDeleted(groupMemberInfoCache + groupID + "-" + userID) } -func GetGroupMembersInfoFromCache(count, offset int32, groupID string) ([]*imdb.GroupMember, error) { - groupMemberIDList, err := GetGroupMemberIDListFromCache(groupID) +func GetGroupMembersInfoFromCache(ctx context.Context, count, offset int32, groupID string) (groupMembers []*imdb.GroupMember, err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "count", count, "offset", offset, "groupID", groupID, "groupMember", groupMembers) + }() + groupMemberIDList, err := GetGroupMemberIDListFromCache(ctx, groupID) if err != nil { return nil, err } @@ -280,17 +314,20 @@ func GetGroupMembersInfoFromCache(count, offset int32, groupID string) ([]*imdb. } //log.NewDebug("", utils.GetSelfFuncName(), "ID list: ", groupMemberIDList) for _, userID := range groupMemberIDList { - groupMembers, err := GetGroupMemberInfoFromCache(groupID, userID) + groupMember, err := GetGroupMemberInfoFromCache(ctx, groupID, userID) if err != nil { log.NewError("", utils.GetSelfFuncName(), err.Error(), groupID, userID) continue } - groupMemberList = append(groupMemberList, groupMembers) + groupMembers = append(groupMembers, groupMember) } return groupMemberList, nil } -func GetAllGroupMembersInfoFromCache(groupID string) ([]*imdb.GroupMember, error) { +func GetAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (groupMembers []*imdb.GroupMember, err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMembers", groupMembers) + }() getGroupMemberInfo := func() (string, error) { groupMembers, err := imdb.GetGroupMemberListByGroupID(groupID) if err != nil { @@ -306,16 +343,18 @@ func GetAllGroupMembersInfoFromCache(groupID string) ([]*imdb.GroupMember, error if err != nil { return nil, utils.Wrap(err, "") } - var groupMembers []*imdb.GroupMember err = json.Unmarshal([]byte(groupMembersStr), &groupMembers) return groupMembers, utils.Wrap(err, "") } -func DelAllGroupMembersInfoFromCache(groupID string) error { +func DelAllGroupMembersInfoFromCache(ctx context.Context, groupID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID) + }() return db.DB.Rc.TagAsDeleted(groupAllMemberInfoCache + groupID) } -func GetGroupInfoFromCache(ctx context.Context, groupID string) (*imdb.Group, error) { +func GetGroupInfoFromCache(ctx context.Context, groupID string) (groupInfo *imdb.Group, err error) { getGroupInfo := func() (string, error) { groupInfo, err := imdb.GetGroupInfoByGroupID(groupID) if err != nil { @@ -327,20 +366,25 @@ func GetGroupInfoFromCache(ctx context.Context, groupID string) (*imdb.Group, er } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupInfo", *groupInfo) + }() groupInfoStr, err := db.DB.Rc.Fetch(groupInfoCache+groupID, time.Second*30*60, getGroupInfo) if err != nil { return nil, utils.Wrap(err, "") } - groupInfo := &imdb.Group{} err = json.Unmarshal([]byte(groupInfoStr), groupInfo) return groupInfo, utils.Wrap(err, "") } -func DelGroupInfoFromCache(groupID string) error { +func DelGroupInfoFromCache(ctx context.Context, groupID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID) + }() return db.DB.Rc.TagAsDeleted(groupInfoCache + groupID) } -func GetAllFriendsInfoFromCache(userID string) ([]*imdb.Friend, error) { +func GetAllFriendsInfoFromCache(ctx context.Context, userID string) (friends []*imdb.Friend, err error) { getAllFriendInfo := func() (string, error) { friendInfoList, err := imdb.GetFriendListByUserID(userID) if err != nil { @@ -352,16 +396,21 @@ func GetAllFriendsInfoFromCache(userID string) ([]*imdb.Friend, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "friends", friends) + }() allFriendInfoStr, err := db.DB.Rc.Fetch(allFriendInfoCache+userID, time.Second*30*60, getAllFriendInfo) if err != nil { return nil, utils.Wrap(err, "") } - var friendInfoList []*imdb.Friend - err = json.Unmarshal([]byte(allFriendInfoStr), &friendInfoList) - return friendInfoList, utils.Wrap(err, "") + err = json.Unmarshal([]byte(allFriendInfoStr), &friends) + return friends, utils.Wrap(err, "") } -func DelAllFriendsInfoFromCache(userID string) error { +func DelAllFriendsInfoFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID) + }() return db.DB.Rc.TagAsDeleted(allFriendInfoCache + userID) } @@ -415,7 +464,7 @@ func DelAllDepartmentMembersFromCache() error { return db.DB.Rc.TagAsDeleted(allDepartmentMemberCache) } -func GetJoinedSuperGroupListFromCache(userID string) ([]string, error) { +func GetJoinedSuperGroupListFromCache(ctx context.Context, userID string) (joinedSuperGroupIDs []string, err error) { getJoinedSuperGroupIDList := func() (string, error) { userToSuperGroup, err := db.DB.GetSuperGroupByUserID(userID) if err != nil { @@ -427,30 +476,34 @@ func GetJoinedSuperGroupListFromCache(userID string) ([]string, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "joinedSuperGroupIDs", joinedSuperGroupIDs) + }() joinedSuperGroupListStr, err := db.DB.Rc.Fetch(joinedSuperGroupListCache+userID, time.Second*30*60, getJoinedSuperGroupIDList) if err != nil { return nil, err } - var joinedSuperGroupList []string - err = json.Unmarshal([]byte(joinedSuperGroupListStr), &joinedSuperGroupList) - return joinedSuperGroupList, utils.Wrap(err, "") + err = json.Unmarshal([]byte(joinedSuperGroupListStr), &joinedSuperGroupIDs) + return joinedSuperGroupIDs, utils.Wrap(err, "") } -func DelJoinedSuperGroupIDListFromCache(userID string) error { - err := db.DB.Rc.TagAsDeleted(joinedSuperGroupListCache + userID) - return err +func DelJoinedSuperGroupIDListFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID) + }() + return db.DB.Rc.TagAsDeleted(joinedSuperGroupListCache + userID) } -func GetGroupMemberListHashFromCache(groupID string) (uint64, error) { +func GetGroupMemberListHashFromCache(ctx context.Context, groupID string) (hashCodeUint64 uint64, err error) { generateHash := func() (string, error) { - groupInfo, err := GetGroupInfoFromCache(groupID) + groupInfo, err := GetGroupInfoFromCache(ctx, groupID) if err != nil { return "0", utils.Wrap(err, "GetGroupInfoFromCache failed") } if groupInfo.Status == constant.GroupStatusDismissed { return "0", nil } - groupMemberIDList, err := GetGroupMemberIDListFromCache(groupID) + groupMemberIDList, err := GetGroupMemberIDListFromCache(ctx, groupID) if err != nil { return "", utils.Wrap(err, "GetGroupMemberIDListFromCache failed") } @@ -463,20 +516,25 @@ func GetGroupMemberListHashFromCache(groupID string) (uint64, error) { bi.SetString(utils.Md5(all)[0:8], 16) return strconv.Itoa(int(bi.Uint64())), nil } - hashCode, err := db.DB.Rc.Fetch(groupMemberListHashCache+groupID, time.Second*30*60, generateHash) + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "hashCodeUint64", hashCodeUint64) + }() + hashCodeStr, err := db.DB.Rc.Fetch(groupMemberListHashCache+groupID, time.Second*30*60, generateHash) if err != nil { return 0, utils.Wrap(err, "fetch failed") } - hashCodeUint64, err := strconv.Atoi(hashCode) - return uint64(hashCodeUint64), err + hashCode, err := strconv.Atoi(hashCodeStr) + return uint64(hashCode), err } -func DelGroupMemberListHashFromCache(groupID string) error { - err := db.DB.Rc.TagAsDeleted(groupMemberListHashCache + groupID) - return err +func DelGroupMemberListHashFromCache(ctx context.Context, groupID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID) + }() + return db.DB.Rc.TagAsDeleted(groupMemberListHashCache + groupID) } -func GetGroupMemberNumFromCache(groupID string) (int64, error) { +func GetGroupMemberNumFromCache(ctx context.Context, groupID string) (num int, err error) { getGroupMemberNum := func() (string, error) { num, err := imdb.GetGroupMemberNumByGroupID(groupID) if err != nil { @@ -484,19 +542,24 @@ func GetGroupMemberNumFromCache(groupID string) (int64, error) { } return strconv.Itoa(int(num)), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID, "num", num) + }() groupMember, err := db.DB.Rc.Fetch(groupMemberNumCache+groupID, time.Second*30*60, getGroupMemberNum) if err != nil { return 0, utils.Wrap(err, "") } - num, err := strconv.Atoi(groupMember) - return int64(num), err + return strconv.Atoi(groupMember) } -func DelGroupMemberNumFromCache(groupID string) error { +func DelGroupMemberNumFromCache(ctx context.Context, groupID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "groupID", groupID) + }() return db.DB.Rc.TagAsDeleted(groupMemberNumCache + groupID) } -func GetUserConversationIDListFromCache(userID string) ([]string, error) { +func GetUserConversationIDListFromCache(ctx context.Context, userID string) (conversationIDs []string, err error) { getConversationIDList := func() (string, error) { conversationIDList, err := imdb.GetConversationIDListByUserID(userID) if err != nil { @@ -509,20 +572,25 @@ func GetUserConversationIDListFromCache(userID string) ([]string, error) { } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID, "conversationIDs", conversationIDs) + }() conversationIDListStr, err := db.DB.Rc.Fetch(conversationIDListCache+userID, time.Second*30*60, getConversationIDList) - var conversationIDList []string - err = json.Unmarshal([]byte(conversationIDListStr), &conversationIDList) + err = json.Unmarshal([]byte(conversationIDListStr), &conversationIDs) if err != nil { return nil, utils.Wrap(err, "") } - return conversationIDList, nil + return conversationIDs, nil } -func DelUserConversationIDListFromCache(userID string) error { +func DelUserConversationIDListFromCache(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "userID", userID) + }() return utils.Wrap(db.DB.Rc.TagAsDeleted(conversationIDListCache+userID), "DelUserConversationIDListFromCache err") } -func GetConversationFromCache(ownerUserID, conversationID string) (*imdb.Conversation, error) { +func GetConversationFromCache(ctx context.Context, ownerUserID, conversationID string) (conversation *imdb.Conversation, err error) { getConversation := func() (string, error) { conversation, err := imdb.GetConversation(ownerUserID, conversationID) if err != nil { @@ -534,39 +602,44 @@ func GetConversationFromCache(ownerUserID, conversationID string) (*imdb.Convers } return string(bytes), nil } + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID, "conversation", *conversation) + }() conversationStr, err := db.DB.Rc.Fetch(conversationCache+ownerUserID+":"+conversationID, time.Second*30*60, getConversation) if err != nil { return nil, utils.Wrap(err, "Fetch failed") } - conversation := imdb.Conversation{} + conversation = &imdb.Conversation{} err = json.Unmarshal([]byte(conversationStr), &conversation) - if err != nil { - return nil, utils.Wrap(err, "Unmarshal failed") - } - return &conversation, nil + return conversation, utils.Wrap(err, "Unmarshal failed") } -func GetConversationsFromCache(ownerUserID string, conversationIDList []string) ([]imdb.Conversation, error) { - var conversationList []imdb.Conversation - for _, conversationID := range conversationIDList { - conversation, err := GetConversationFromCache(ownerUserID, conversationID) +func GetConversationsFromCache(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []imdb.Conversation, err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationIDs", conversationIDs, "conversations", conversations) + }() + for _, conversationID := range conversationIDs { + conversation, err := GetConversationFromCache(ctx, ownerUserID, conversationID) if err != nil { return nil, utils.Wrap(err, "GetConversationFromCache failed") } - conversationList = append(conversationList, *conversation) + conversations = append(conversations, *conversation) } - return conversationList, nil + return conversations, nil } -func GetUserAllConversationList(ownerUserID string) ([]imdb.Conversation, error) { - IDList, err := GetUserConversationIDListFromCache(ownerUserID) +func GetUserAllConversationList(ctx context.Context, ownerUserID string) (conversations []imdb.Conversation, err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversations", conversations) + }() + IDList, err := GetUserConversationIDListFromCache(ctx, ownerUserID) if err != nil { return nil, err } var conversationList []imdb.Conversation log.NewDebug("", utils.GetSelfFuncName(), IDList) for _, conversationID := range IDList { - conversation, err := GetConversationFromCache(ownerUserID, conversationID) + conversation, err := GetConversationFromCache(ctx, ownerUserID, conversationID) if err != nil { return nil, utils.Wrap(err, "GetConversationFromCache failed") } @@ -575,11 +648,14 @@ func GetUserAllConversationList(ownerUserID string) ([]imdb.Conversation, error) return conversationList, nil } -func DelConversationFromCache(ownerUserID, conversationID string) error { +func DelConversationFromCache(ctx context.Context, ownerUserID, conversationID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "ownerUserID", ownerUserID, "conversationID", conversationID) + }() return utils.Wrap(db.DB.Rc.TagAsDeleted(conversationCache+ownerUserID+":"+conversationID), "DelConversationFromCache err") } -func GetExtendMsg(sourceID string, sessionType int32, clientMsgID string, firstModifyTime int64) (*db.ExtendMsg, error) { +func GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, firstModifyTime int64) (extendMsg *db.ExtendMsg, err error) { getExtendMsg := func() (string, error) { extendMsg, err := db.DB.GetExtendMsg(sourceID, sessionType, clientMsgID, firstModifyTime) if err != nil { @@ -591,19 +667,22 @@ func GetExtendMsg(sourceID string, sessionType int32, clientMsgID string, firstM } return string(bytes), nil } - + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "sourceID", sourceID, "sessionType", + sessionType, "clientMsgID", clientMsgID, "firstModifyTime", firstModifyTime, "extendMsg", extendMsg) + }() extendMsgStr, err := db.DB.Rc.Fetch(extendMsgCache+clientMsgID, time.Second*30*60, getExtendMsg) if err != nil { return nil, utils.Wrap(err, "Fetch failed") } - extendMsg := &db.ExtendMsg{} + extendMsg = &db.ExtendMsg{} err = json.Unmarshal([]byte(extendMsgStr), extendMsg) - if err != nil { - return nil, utils.Wrap(err, "Unmarshal failed") - } - return extendMsg, nil + return extendMsg, utils.Wrap(err, "Unmarshal failed") } -func DelExtendMsg(ID string, index int32, clientMsgID string) error { +func DelExtendMsg(ctx context.Context, clientMsgID string) (err error) { + defer func() { + trace_log.SetContextInfo(ctx, utils.GetFuncName(1), err, "clientMsgID", clientMsgID) + }() return utils.Wrap(db.DB.Rc.TagAsDeleted(extendMsgCache+clientMsgID), "DelExtendMsg err") } diff --git a/pkg/common/trace_log/ctx.go b/pkg/common/trace_log/ctx.go index 49857a9f5..6a26ed63d 100644 --- a/pkg/common/trace_log/ctx.go +++ b/pkg/common/trace_log/ctx.go @@ -28,6 +28,10 @@ func SetOperationID(ctx context.Context, operationID string) { ctx.Value(TraceLogKey).(*ApiInfo).OperationID = operationID } +func GetOperationID(ctx context.Context) string { + return ctx.Value(TraceLogKey).(*ApiInfo).OperationID +} + func ShowLog(ctx context.Context) { t := ctx.Value(TraceLogKey).(*ApiInfo) if ctx.Value(TraceLogKey).(*ApiInfo).GinCtx != nil { diff --git a/pkg/proto/cache/cache.pb.go b/pkg/proto/cache/cache.pb.go index e8da57bb6..bf903873b 100644 --- a/pkg/proto/cache/cache.pb.go +++ b/pkg/proto/cache/cache.pb.go @@ -1,1093 +1,582 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.15.5 // source: cache/cache.proto -package cache +package cache // import "Open_IM/pkg/proto/cache" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import sdk_ws "Open_IM/pkg/proto/sdk_ws" import ( - context "context" + context "golang.org/x/net/context" grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf -type CommonResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ErrCode int32 `protobuf:"varint,1,opt,name=errCode,proto3" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg,proto3" json:"errMsg,omitempty"` -} - -func (x *CommonResp) Reset() { - *x = CommonResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommonResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommonResp) ProtoMessage() {} - -func (x *CommonResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommonResp.ProtoReflect.Descriptor instead. -func (*CommonResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{0} -} - -func (x *CommonResp) GetErrCode() int32 { - if x != nil { - return x.ErrCode - } - return 0 -} - -func (x *CommonResp) GetErrMsg() string { - if x != nil { - return x.ErrMsg - } - return "" -} +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type GetFriendIDListFromCacheReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID,proto3" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetFriendIDListFromCacheReq) Reset() { - *x = GetFriendIDListFromCacheReq{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFriendIDListFromCacheReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFriendIDListFromCacheReq) ProtoMessage() {} - -func (x *GetFriendIDListFromCacheReq) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetFriendIDListFromCacheReq.ProtoReflect.Descriptor instead. +func (m *GetFriendIDListFromCacheReq) Reset() { *m = GetFriendIDListFromCacheReq{} } +func (m *GetFriendIDListFromCacheReq) String() string { return proto.CompactTextString(m) } +func (*GetFriendIDListFromCacheReq) ProtoMessage() {} func (*GetFriendIDListFromCacheReq) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{1} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{0} +} +func (m *GetFriendIDListFromCacheReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetFriendIDListFromCacheReq.Unmarshal(m, b) +} +func (m *GetFriendIDListFromCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetFriendIDListFromCacheReq.Marshal(b, m, deterministic) +} +func (dst *GetFriendIDListFromCacheReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetFriendIDListFromCacheReq.Merge(dst, src) +} +func (m *GetFriendIDListFromCacheReq) XXX_Size() int { + return xxx_messageInfo_GetFriendIDListFromCacheReq.Size(m) +} +func (m *GetFriendIDListFromCacheReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetFriendIDListFromCacheReq.DiscardUnknown(m) } -func (x *GetFriendIDListFromCacheReq) GetUserID() string { - if x != nil { - return x.UserID +var xxx_messageInfo_GetFriendIDListFromCacheReq proto.InternalMessageInfo + +func (m *GetFriendIDListFromCacheReq) GetUserID() string { + if m != nil { + return m.UserID } return "" } -func (x *GetFriendIDListFromCacheReq) GetOperationID() string { - if x != nil { - return x.OperationID +func (m *GetFriendIDListFromCacheReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type GetFriendIDListFromCacheResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDList []string `protobuf:"bytes,1,rep,name=userIDList,proto3" json:"userIDList,omitempty"` - CommonResp *CommonResp `protobuf:"bytes,2,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + UserIDList []string `protobuf:"bytes,1,rep,name=userIDList" json:"userIDList,omitempty"` + CommonResp *sdk_ws.CommonResp `protobuf:"bytes,2,opt,name=commonResp" json:"commonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetFriendIDListFromCacheResp) Reset() { - *x = GetFriendIDListFromCacheResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetFriendIDListFromCacheResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetFriendIDListFromCacheResp) ProtoMessage() {} - -func (x *GetFriendIDListFromCacheResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetFriendIDListFromCacheResp.ProtoReflect.Descriptor instead. +func (m *GetFriendIDListFromCacheResp) Reset() { *m = GetFriendIDListFromCacheResp{} } +func (m *GetFriendIDListFromCacheResp) String() string { return proto.CompactTextString(m) } +func (*GetFriendIDListFromCacheResp) ProtoMessage() {} func (*GetFriendIDListFromCacheResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{2} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{1} +} +func (m *GetFriendIDListFromCacheResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetFriendIDListFromCacheResp.Unmarshal(m, b) +} +func (m *GetFriendIDListFromCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetFriendIDListFromCacheResp.Marshal(b, m, deterministic) +} +func (dst *GetFriendIDListFromCacheResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetFriendIDListFromCacheResp.Merge(dst, src) +} +func (m *GetFriendIDListFromCacheResp) XXX_Size() int { + return xxx_messageInfo_GetFriendIDListFromCacheResp.Size(m) +} +func (m *GetFriendIDListFromCacheResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetFriendIDListFromCacheResp.DiscardUnknown(m) } -func (x *GetFriendIDListFromCacheResp) GetUserIDList() []string { - if x != nil { - return x.UserIDList +var xxx_messageInfo_GetFriendIDListFromCacheResp proto.InternalMessageInfo + +func (m *GetFriendIDListFromCacheResp) GetUserIDList() []string { + if m != nil { + return m.UserIDList } return nil } -func (x *GetFriendIDListFromCacheResp) GetCommonResp() *CommonResp { - if x != nil { - return x.CommonResp +func (m *GetFriendIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { + if m != nil { + return m.CommonResp } return nil } type DelFriendIDListFromCacheReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID,proto3" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelFriendIDListFromCacheReq) Reset() { - *x = DelFriendIDListFromCacheReq{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelFriendIDListFromCacheReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelFriendIDListFromCacheReq) ProtoMessage() {} - -func (x *DelFriendIDListFromCacheReq) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DelFriendIDListFromCacheReq.ProtoReflect.Descriptor instead. +func (m *DelFriendIDListFromCacheReq) Reset() { *m = DelFriendIDListFromCacheReq{} } +func (m *DelFriendIDListFromCacheReq) String() string { return proto.CompactTextString(m) } +func (*DelFriendIDListFromCacheReq) ProtoMessage() {} func (*DelFriendIDListFromCacheReq) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{3} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{2} +} +func (m *DelFriendIDListFromCacheReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelFriendIDListFromCacheReq.Unmarshal(m, b) +} +func (m *DelFriendIDListFromCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelFriendIDListFromCacheReq.Marshal(b, m, deterministic) +} +func (dst *DelFriendIDListFromCacheReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelFriendIDListFromCacheReq.Merge(dst, src) +} +func (m *DelFriendIDListFromCacheReq) XXX_Size() int { + return xxx_messageInfo_DelFriendIDListFromCacheReq.Size(m) +} +func (m *DelFriendIDListFromCacheReq) XXX_DiscardUnknown() { + xxx_messageInfo_DelFriendIDListFromCacheReq.DiscardUnknown(m) } -func (x *DelFriendIDListFromCacheReq) GetUserID() string { - if x != nil { - return x.UserID +var xxx_messageInfo_DelFriendIDListFromCacheReq proto.InternalMessageInfo + +func (m *DelFriendIDListFromCacheReq) GetUserID() string { + if m != nil { + return m.UserID } return "" } -func (x *DelFriendIDListFromCacheReq) GetOperationID() string { - if x != nil { - return x.OperationID +func (m *DelFriendIDListFromCacheReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type DelFriendIDListFromCacheResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelFriendIDListFromCacheResp) Reset() { - *x = DelFriendIDListFromCacheResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelFriendIDListFromCacheResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelFriendIDListFromCacheResp) ProtoMessage() {} - -func (x *DelFriendIDListFromCacheResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DelFriendIDListFromCacheResp.ProtoReflect.Descriptor instead. +func (m *DelFriendIDListFromCacheResp) Reset() { *m = DelFriendIDListFromCacheResp{} } +func (m *DelFriendIDListFromCacheResp) String() string { return proto.CompactTextString(m) } +func (*DelFriendIDListFromCacheResp) ProtoMessage() {} func (*DelFriendIDListFromCacheResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{4} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{3} +} +func (m *DelFriendIDListFromCacheResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelFriendIDListFromCacheResp.Unmarshal(m, b) +} +func (m *DelFriendIDListFromCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelFriendIDListFromCacheResp.Marshal(b, m, deterministic) +} +func (dst *DelFriendIDListFromCacheResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelFriendIDListFromCacheResp.Merge(dst, src) +} +func (m *DelFriendIDListFromCacheResp) XXX_Size() int { + return xxx_messageInfo_DelFriendIDListFromCacheResp.Size(m) +} +func (m *DelFriendIDListFromCacheResp) XXX_DiscardUnknown() { + xxx_messageInfo_DelFriendIDListFromCacheResp.DiscardUnknown(m) } -func (x *DelFriendIDListFromCacheResp) GetCommonResp() *CommonResp { - if x != nil { - return x.CommonResp +var xxx_messageInfo_DelFriendIDListFromCacheResp proto.InternalMessageInfo + +func (m *DelFriendIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { + if m != nil { + return m.CommonResp } return nil } type GetBlackIDListFromCacheReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID,proto3" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetBlackIDListFromCacheReq) Reset() { - *x = GetBlackIDListFromCacheReq{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetBlackIDListFromCacheReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetBlackIDListFromCacheReq) ProtoMessage() {} - -func (x *GetBlackIDListFromCacheReq) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetBlackIDListFromCacheReq.ProtoReflect.Descriptor instead. +func (m *GetBlackIDListFromCacheReq) Reset() { *m = GetBlackIDListFromCacheReq{} } +func (m *GetBlackIDListFromCacheReq) String() string { return proto.CompactTextString(m) } +func (*GetBlackIDListFromCacheReq) ProtoMessage() {} func (*GetBlackIDListFromCacheReq) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{5} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{4} +} +func (m *GetBlackIDListFromCacheReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBlackIDListFromCacheReq.Unmarshal(m, b) +} +func (m *GetBlackIDListFromCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBlackIDListFromCacheReq.Marshal(b, m, deterministic) +} +func (dst *GetBlackIDListFromCacheReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBlackIDListFromCacheReq.Merge(dst, src) +} +func (m *GetBlackIDListFromCacheReq) XXX_Size() int { + return xxx_messageInfo_GetBlackIDListFromCacheReq.Size(m) +} +func (m *GetBlackIDListFromCacheReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetBlackIDListFromCacheReq.DiscardUnknown(m) } -func (x *GetBlackIDListFromCacheReq) GetUserID() string { - if x != nil { - return x.UserID +var xxx_messageInfo_GetBlackIDListFromCacheReq proto.InternalMessageInfo + +func (m *GetBlackIDListFromCacheReq) GetUserID() string { + if m != nil { + return m.UserID } return "" } -func (x *GetBlackIDListFromCacheReq) GetOperationID() string { - if x != nil { - return x.OperationID +func (m *GetBlackIDListFromCacheReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type GetBlackIDListFromCacheResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDList []string `protobuf:"bytes,1,rep,name=userIDList,proto3" json:"userIDList,omitempty"` - CommonResp *CommonResp `protobuf:"bytes,2,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + UserIDList []string `protobuf:"bytes,1,rep,name=userIDList" json:"userIDList,omitempty"` + CommonResp *sdk_ws.CommonResp `protobuf:"bytes,2,opt,name=commonResp" json:"commonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetBlackIDListFromCacheResp) Reset() { - *x = GetBlackIDListFromCacheResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetBlackIDListFromCacheResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetBlackIDListFromCacheResp) ProtoMessage() {} - -func (x *GetBlackIDListFromCacheResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_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 GetBlackIDListFromCacheResp.ProtoReflect.Descriptor instead. +func (m *GetBlackIDListFromCacheResp) Reset() { *m = GetBlackIDListFromCacheResp{} } +func (m *GetBlackIDListFromCacheResp) String() string { return proto.CompactTextString(m) } +func (*GetBlackIDListFromCacheResp) ProtoMessage() {} func (*GetBlackIDListFromCacheResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{6} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{5} +} +func (m *GetBlackIDListFromCacheResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBlackIDListFromCacheResp.Unmarshal(m, b) +} +func (m *GetBlackIDListFromCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBlackIDListFromCacheResp.Marshal(b, m, deterministic) +} +func (dst *GetBlackIDListFromCacheResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBlackIDListFromCacheResp.Merge(dst, src) +} +func (m *GetBlackIDListFromCacheResp) XXX_Size() int { + return xxx_messageInfo_GetBlackIDListFromCacheResp.Size(m) +} +func (m *GetBlackIDListFromCacheResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetBlackIDListFromCacheResp.DiscardUnknown(m) } -func (x *GetBlackIDListFromCacheResp) GetUserIDList() []string { - if x != nil { - return x.UserIDList +var xxx_messageInfo_GetBlackIDListFromCacheResp proto.InternalMessageInfo + +func (m *GetBlackIDListFromCacheResp) GetUserIDList() []string { + if m != nil { + return m.UserIDList } return nil } -func (x *GetBlackIDListFromCacheResp) GetCommonResp() *CommonResp { - if x != nil { - return x.CommonResp +func (m *GetBlackIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { + if m != nil { + return m.CommonResp } return nil } type DelBlackIDListFromCacheReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID string `protobuf:"bytes,1,opt,name=userID,proto3" json:"userID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID,proto3" json:"operationID,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelBlackIDListFromCacheReq) Reset() { - *x = DelBlackIDListFromCacheReq{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelBlackIDListFromCacheReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelBlackIDListFromCacheReq) ProtoMessage() {} - -func (x *DelBlackIDListFromCacheReq) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_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 DelBlackIDListFromCacheReq.ProtoReflect.Descriptor instead. +func (m *DelBlackIDListFromCacheReq) Reset() { *m = DelBlackIDListFromCacheReq{} } +func (m *DelBlackIDListFromCacheReq) String() string { return proto.CompactTextString(m) } +func (*DelBlackIDListFromCacheReq) ProtoMessage() {} func (*DelBlackIDListFromCacheReq) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{7} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{6} +} +func (m *DelBlackIDListFromCacheReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelBlackIDListFromCacheReq.Unmarshal(m, b) +} +func (m *DelBlackIDListFromCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelBlackIDListFromCacheReq.Marshal(b, m, deterministic) +} +func (dst *DelBlackIDListFromCacheReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelBlackIDListFromCacheReq.Merge(dst, src) +} +func (m *DelBlackIDListFromCacheReq) XXX_Size() int { + return xxx_messageInfo_DelBlackIDListFromCacheReq.Size(m) +} +func (m *DelBlackIDListFromCacheReq) XXX_DiscardUnknown() { + xxx_messageInfo_DelBlackIDListFromCacheReq.DiscardUnknown(m) } -func (x *DelBlackIDListFromCacheReq) GetUserID() string { - if x != nil { - return x.UserID +var xxx_messageInfo_DelBlackIDListFromCacheReq proto.InternalMessageInfo + +func (m *DelBlackIDListFromCacheReq) GetUserID() string { + if m != nil { + return m.UserID } return "" } -func (x *DelBlackIDListFromCacheReq) GetOperationID() string { - if x != nil { - return x.OperationID +func (m *DelBlackIDListFromCacheReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type DelBlackIDListFromCacheResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelBlackIDListFromCacheResp) Reset() { - *x = DelBlackIDListFromCacheResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelBlackIDListFromCacheResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelBlackIDListFromCacheResp) ProtoMessage() {} - -func (x *DelBlackIDListFromCacheResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[8] - 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 DelBlackIDListFromCacheResp.ProtoReflect.Descriptor instead. +func (m *DelBlackIDListFromCacheResp) Reset() { *m = DelBlackIDListFromCacheResp{} } +func (m *DelBlackIDListFromCacheResp) String() string { return proto.CompactTextString(m) } +func (*DelBlackIDListFromCacheResp) ProtoMessage() {} func (*DelBlackIDListFromCacheResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{8} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{7} +} +func (m *DelBlackIDListFromCacheResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelBlackIDListFromCacheResp.Unmarshal(m, b) +} +func (m *DelBlackIDListFromCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelBlackIDListFromCacheResp.Marshal(b, m, deterministic) +} +func (dst *DelBlackIDListFromCacheResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelBlackIDListFromCacheResp.Merge(dst, src) +} +func (m *DelBlackIDListFromCacheResp) XXX_Size() int { + return xxx_messageInfo_DelBlackIDListFromCacheResp.Size(m) +} +func (m *DelBlackIDListFromCacheResp) XXX_DiscardUnknown() { + xxx_messageInfo_DelBlackIDListFromCacheResp.DiscardUnknown(m) } -func (x *DelBlackIDListFromCacheResp) GetCommonResp() *CommonResp { - if x != nil { - return x.CommonResp +var xxx_messageInfo_DelBlackIDListFromCacheResp proto.InternalMessageInfo + +func (m *DelBlackIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { + if m != nil { + return m.CommonResp } return nil } type GetGroupMemberIDListFromCacheReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OperationID string `protobuf:"bytes,1,opt,name=operationID,proto3" json:"operationID,omitempty"` - GroupID string `protobuf:"bytes,2,opt,name=groupID,proto3" json:"groupID,omitempty"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + GroupID string `protobuf:"bytes,2,opt,name=groupID" json:"groupID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetGroupMemberIDListFromCacheReq) Reset() { - *x = GetGroupMemberIDListFromCacheReq{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetGroupMemberIDListFromCacheReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetGroupMemberIDListFromCacheReq) ProtoMessage() {} - -func (x *GetGroupMemberIDListFromCacheReq) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[9] - 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 GetGroupMemberIDListFromCacheReq.ProtoReflect.Descriptor instead. +func (m *GetGroupMemberIDListFromCacheReq) Reset() { *m = GetGroupMemberIDListFromCacheReq{} } +func (m *GetGroupMemberIDListFromCacheReq) String() string { return proto.CompactTextString(m) } +func (*GetGroupMemberIDListFromCacheReq) ProtoMessage() {} func (*GetGroupMemberIDListFromCacheReq) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{9} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{8} +} +func (m *GetGroupMemberIDListFromCacheReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetGroupMemberIDListFromCacheReq.Unmarshal(m, b) +} +func (m *GetGroupMemberIDListFromCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetGroupMemberIDListFromCacheReq.Marshal(b, m, deterministic) +} +func (dst *GetGroupMemberIDListFromCacheReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetGroupMemberIDListFromCacheReq.Merge(dst, src) +} +func (m *GetGroupMemberIDListFromCacheReq) XXX_Size() int { + return xxx_messageInfo_GetGroupMemberIDListFromCacheReq.Size(m) +} +func (m *GetGroupMemberIDListFromCacheReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetGroupMemberIDListFromCacheReq.DiscardUnknown(m) } -func (x *GetGroupMemberIDListFromCacheReq) GetOperationID() string { - if x != nil { - return x.OperationID +var xxx_messageInfo_GetGroupMemberIDListFromCacheReq proto.InternalMessageInfo + +func (m *GetGroupMemberIDListFromCacheReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } -func (x *GetGroupMemberIDListFromCacheReq) GetGroupID() string { - if x != nil { - return x.GroupID +func (m *GetGroupMemberIDListFromCacheReq) GetGroupID() string { + if m != nil { + return m.GroupID } return "" } type GetGroupMemberIDListFromCacheResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` - UserIDList []string `protobuf:"bytes,2,rep,name=userIDList,proto3" json:"userIDList,omitempty"` + CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + UserIDList []string `protobuf:"bytes,2,rep,name=userIDList" json:"userIDList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *GetGroupMemberIDListFromCacheResp) Reset() { - *x = GetGroupMemberIDListFromCacheResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetGroupMemberIDListFromCacheResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetGroupMemberIDListFromCacheResp) ProtoMessage() {} - -func (x *GetGroupMemberIDListFromCacheResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[10] - 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 GetGroupMemberIDListFromCacheResp.ProtoReflect.Descriptor instead. +func (m *GetGroupMemberIDListFromCacheResp) Reset() { *m = GetGroupMemberIDListFromCacheResp{} } +func (m *GetGroupMemberIDListFromCacheResp) String() string { return proto.CompactTextString(m) } +func (*GetGroupMemberIDListFromCacheResp) ProtoMessage() {} func (*GetGroupMemberIDListFromCacheResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{10} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{9} +} +func (m *GetGroupMemberIDListFromCacheResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetGroupMemberIDListFromCacheResp.Unmarshal(m, b) +} +func (m *GetGroupMemberIDListFromCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetGroupMemberIDListFromCacheResp.Marshal(b, m, deterministic) +} +func (dst *GetGroupMemberIDListFromCacheResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetGroupMemberIDListFromCacheResp.Merge(dst, src) +} +func (m *GetGroupMemberIDListFromCacheResp) XXX_Size() int { + return xxx_messageInfo_GetGroupMemberIDListFromCacheResp.Size(m) +} +func (m *GetGroupMemberIDListFromCacheResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetGroupMemberIDListFromCacheResp.DiscardUnknown(m) } -func (x *GetGroupMemberIDListFromCacheResp) GetCommonResp() *CommonResp { - if x != nil { - return x.CommonResp +var xxx_messageInfo_GetGroupMemberIDListFromCacheResp proto.InternalMessageInfo + +func (m *GetGroupMemberIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { + if m != nil { + return m.CommonResp } return nil } -func (x *GetGroupMemberIDListFromCacheResp) GetUserIDList() []string { - if x != nil { - return x.UserIDList +func (m *GetGroupMemberIDListFromCacheResp) GetUserIDList() []string { + if m != nil { + return m.UserIDList } return nil } type DelGroupMemberIDListFromCacheReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID string `protobuf:"bytes,1,opt,name=groupID,proto3" json:"groupID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID,proto3" json:"operationID,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelGroupMemberIDListFromCacheReq) Reset() { - *x = DelGroupMemberIDListFromCacheReq{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelGroupMemberIDListFromCacheReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelGroupMemberIDListFromCacheReq) ProtoMessage() {} - -func (x *DelGroupMemberIDListFromCacheReq) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_proto_msgTypes[11] - 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 DelGroupMemberIDListFromCacheReq.ProtoReflect.Descriptor instead. +func (m *DelGroupMemberIDListFromCacheReq) Reset() { *m = DelGroupMemberIDListFromCacheReq{} } +func (m *DelGroupMemberIDListFromCacheReq) String() string { return proto.CompactTextString(m) } +func (*DelGroupMemberIDListFromCacheReq) ProtoMessage() {} func (*DelGroupMemberIDListFromCacheReq) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{11} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{10} +} +func (m *DelGroupMemberIDListFromCacheReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelGroupMemberIDListFromCacheReq.Unmarshal(m, b) +} +func (m *DelGroupMemberIDListFromCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelGroupMemberIDListFromCacheReq.Marshal(b, m, deterministic) +} +func (dst *DelGroupMemberIDListFromCacheReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelGroupMemberIDListFromCacheReq.Merge(dst, src) +} +func (m *DelGroupMemberIDListFromCacheReq) XXX_Size() int { + return xxx_messageInfo_DelGroupMemberIDListFromCacheReq.Size(m) +} +func (m *DelGroupMemberIDListFromCacheReq) XXX_DiscardUnknown() { + xxx_messageInfo_DelGroupMemberIDListFromCacheReq.DiscardUnknown(m) } -func (x *DelGroupMemberIDListFromCacheReq) GetGroupID() string { - if x != nil { - return x.GroupID +var xxx_messageInfo_DelGroupMemberIDListFromCacheReq proto.InternalMessageInfo + +func (m *DelGroupMemberIDListFromCacheReq) GetGroupID() string { + if m != nil { + return m.GroupID } return "" } -func (x *DelGroupMemberIDListFromCacheReq) GetOperationID() string { - if x != nil { - return x.OperationID +func (m *DelGroupMemberIDListFromCacheReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type DelGroupMemberIDListFromCacheResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp,proto3" json:"commonResp,omitempty"` + CommonResp *sdk_ws.CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *DelGroupMemberIDListFromCacheResp) Reset() { - *x = DelGroupMemberIDListFromCacheResp{} - if protoimpl.UnsafeEnabled { - mi := &file_cache_cache_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DelGroupMemberIDListFromCacheResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DelGroupMemberIDListFromCacheResp) ProtoMessage() {} - -func (x *DelGroupMemberIDListFromCacheResp) ProtoReflect() protoreflect.Message { - mi := &file_cache_cache_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 DelGroupMemberIDListFromCacheResp.ProtoReflect.Descriptor instead. +func (m *DelGroupMemberIDListFromCacheResp) Reset() { *m = DelGroupMemberIDListFromCacheResp{} } +func (m *DelGroupMemberIDListFromCacheResp) String() string { return proto.CompactTextString(m) } +func (*DelGroupMemberIDListFromCacheResp) ProtoMessage() {} func (*DelGroupMemberIDListFromCacheResp) Descriptor() ([]byte, []int) { - return file_cache_cache_proto_rawDescGZIP(), []int{12} + return fileDescriptor_cache_e3bd73ca9c307fc2, []int{11} +} +func (m *DelGroupMemberIDListFromCacheResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DelGroupMemberIDListFromCacheResp.Unmarshal(m, b) +} +func (m *DelGroupMemberIDListFromCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DelGroupMemberIDListFromCacheResp.Marshal(b, m, deterministic) +} +func (dst *DelGroupMemberIDListFromCacheResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelGroupMemberIDListFromCacheResp.Merge(dst, src) +} +func (m *DelGroupMemberIDListFromCacheResp) XXX_Size() int { + return xxx_messageInfo_DelGroupMemberIDListFromCacheResp.Size(m) +} +func (m *DelGroupMemberIDListFromCacheResp) XXX_DiscardUnknown() { + xxx_messageInfo_DelGroupMemberIDListFromCacheResp.DiscardUnknown(m) } -func (x *DelGroupMemberIDListFromCacheResp) GetCommonResp() *CommonResp { - if x != nil { - return x.CommonResp +var xxx_messageInfo_DelGroupMemberIDListFromCacheResp proto.InternalMessageInfo + +func (m *DelGroupMemberIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { + if m != nil { + return m.CommonResp } return nil } -var File_cache_cache_proto protoreflect.FileDescriptor - -var file_cache_cache_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x22, 0x3e, 0x0a, 0x0a, 0x43, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x43, - 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x22, 0x57, 0x0a, 0x1b, 0x47, 0x65, - 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, - 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, - 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x44, 0x22, 0x71, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, - 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, - 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x57, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, - 0x68, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, - 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, - 0x51, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, - 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x31, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x22, 0x56, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, - 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, - 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x70, 0x0a, 0x1b, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, - 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x73, 0x65, - 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x75, - 0x73, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, - 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x56, 0x0a, 0x1a, - 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, - 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, - 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x50, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, - 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x5e, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, - 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x22, 0x76, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, - 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0a, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, - 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x5e, - 0x0a, 0x20, 0x44, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, - 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x56, - 0x0a, 0x21, 0x44, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x32, 0xfd, 0x04, 0x0a, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, - 0x12, 0x63, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x4c, - 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x22, 0x2e, 0x63, - 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x44, - 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, - 0x1a, 0x23, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x63, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x46, 0x72, 0x69, 0x65, - 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, - 0x65, 0x12, 0x22, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x46, 0x72, 0x69, - 0x65, 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, - 0x68, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, - 0x6c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, - 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x60, 0x0a, 0x17, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, - 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x21, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, - 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, - 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, - 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x60, 0x0a, 0x17, - 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, - 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x21, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, - 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, - 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x63, 0x61, 0x63, - 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x44, 0x4c, 0x69, 0x73, - 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x72, - 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, - 0x27, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, - 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x28, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, - 0x2e, 0x47, 0x65, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, - 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x72, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, - 0x63, 0x68, 0x65, 0x12, 0x27, 0x2e, 0x63, 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, - 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x28, 0x2e, 0x63, - 0x61, 0x63, 0x68, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x72, 0x6f, 0x6d, 0x43, 0x61, 0x63, - 0x68, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x1f, 0x5a, 0x1d, 0x4f, 0x70, 0x65, 0x6e, 0x5f, 0x49, - 0x4d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x61, 0x63, 0x68, - 0x65, 0x3b, 0x63, 0x61, 0x63, 0x68, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cache_cache_proto_rawDescOnce sync.Once - file_cache_cache_proto_rawDescData = file_cache_cache_proto_rawDesc -) - -func file_cache_cache_proto_rawDescGZIP() []byte { - file_cache_cache_proto_rawDescOnce.Do(func() { - file_cache_cache_proto_rawDescData = protoimpl.X.CompressGZIP(file_cache_cache_proto_rawDescData) - }) - return file_cache_cache_proto_rawDescData -} - -var file_cache_cache_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_cache_cache_proto_goTypes = []interface{}{ - (*CommonResp)(nil), // 0: cache.CommonResp - (*GetFriendIDListFromCacheReq)(nil), // 1: cache.GetFriendIDListFromCacheReq - (*GetFriendIDListFromCacheResp)(nil), // 2: cache.GetFriendIDListFromCacheResp - (*DelFriendIDListFromCacheReq)(nil), // 3: cache.DelFriendIDListFromCacheReq - (*DelFriendIDListFromCacheResp)(nil), // 4: cache.DelFriendIDListFromCacheResp - (*GetBlackIDListFromCacheReq)(nil), // 5: cache.GetBlackIDListFromCacheReq - (*GetBlackIDListFromCacheResp)(nil), // 6: cache.GetBlackIDListFromCacheResp - (*DelBlackIDListFromCacheReq)(nil), // 7: cache.DelBlackIDListFromCacheReq - (*DelBlackIDListFromCacheResp)(nil), // 8: cache.DelBlackIDListFromCacheResp - (*GetGroupMemberIDListFromCacheReq)(nil), // 9: cache.GetGroupMemberIDListFromCacheReq - (*GetGroupMemberIDListFromCacheResp)(nil), // 10: cache.GetGroupMemberIDListFromCacheResp - (*DelGroupMemberIDListFromCacheReq)(nil), // 11: cache.DelGroupMemberIDListFromCacheReq - (*DelGroupMemberIDListFromCacheResp)(nil), // 12: cache.DelGroupMemberIDListFromCacheResp -} -var file_cache_cache_proto_depIdxs = []int32{ - 0, // 0: cache.GetFriendIDListFromCacheResp.commonResp:type_name -> cache.CommonResp - 0, // 1: cache.DelFriendIDListFromCacheResp.commonResp:type_name -> cache.CommonResp - 0, // 2: cache.GetBlackIDListFromCacheResp.commonResp:type_name -> cache.CommonResp - 0, // 3: cache.DelBlackIDListFromCacheResp.commonResp:type_name -> cache.CommonResp - 0, // 4: cache.GetGroupMemberIDListFromCacheResp.commonResp:type_name -> cache.CommonResp - 0, // 5: cache.DelGroupMemberIDListFromCacheResp.commonResp:type_name -> cache.CommonResp - 1, // 6: cache.cache.GetFriendIDListFromCache:input_type -> cache.GetFriendIDListFromCacheReq - 3, // 7: cache.cache.DelFriendIDListFromCache:input_type -> cache.DelFriendIDListFromCacheReq - 5, // 8: cache.cache.GetBlackIDListFromCache:input_type -> cache.GetBlackIDListFromCacheReq - 7, // 9: cache.cache.DelBlackIDListFromCache:input_type -> cache.DelBlackIDListFromCacheReq - 9, // 10: cache.cache.GetGroupMemberIDListFromCache:input_type -> cache.GetGroupMemberIDListFromCacheReq - 11, // 11: cache.cache.DelGroupMemberIDListFromCache:input_type -> cache.DelGroupMemberIDListFromCacheReq - 2, // 12: cache.cache.GetFriendIDListFromCache:output_type -> cache.GetFriendIDListFromCacheResp - 4, // 13: cache.cache.DelFriendIDListFromCache:output_type -> cache.DelFriendIDListFromCacheResp - 6, // 14: cache.cache.GetBlackIDListFromCache:output_type -> cache.GetBlackIDListFromCacheResp - 8, // 15: cache.cache.DelBlackIDListFromCache:output_type -> cache.DelBlackIDListFromCacheResp - 10, // 16: cache.cache.GetGroupMemberIDListFromCache:output_type -> cache.GetGroupMemberIDListFromCacheResp - 12, // 17: cache.cache.DelGroupMemberIDListFromCache:output_type -> cache.DelGroupMemberIDListFromCacheResp - 12, // [12:18] is the sub-list for method output_type - 6, // [6:12] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_cache_cache_proto_init() } -func file_cache_cache_proto_init() { - if File_cache_cache_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cache_cache_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommonResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFriendIDListFromCacheReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFriendIDListFromCacheResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelFriendIDListFromCacheReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelFriendIDListFromCacheResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetBlackIDListFromCacheReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetBlackIDListFromCacheResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelBlackIDListFromCacheReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelBlackIDListFromCacheResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetGroupMemberIDListFromCacheReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetGroupMemberIDListFromCacheResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelGroupMemberIDListFromCacheReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cache_cache_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelGroupMemberIDListFromCacheResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cache_cache_proto_rawDesc, - NumEnums: 0, - NumMessages: 13, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_cache_cache_proto_goTypes, - DependencyIndexes: file_cache_cache_proto_depIdxs, - MessageInfos: file_cache_cache_proto_msgTypes, - }.Build() - File_cache_cache_proto = out.File - file_cache_cache_proto_rawDesc = nil - file_cache_cache_proto_goTypes = nil - file_cache_cache_proto_depIdxs = nil +func init() { + proto.RegisterType((*GetFriendIDListFromCacheReq)(nil), "cache.GetFriendIDListFromCacheReq") + proto.RegisterType((*GetFriendIDListFromCacheResp)(nil), "cache.GetFriendIDListFromCacheResp") + proto.RegisterType((*DelFriendIDListFromCacheReq)(nil), "cache.DelFriendIDListFromCacheReq") + proto.RegisterType((*DelFriendIDListFromCacheResp)(nil), "cache.DelFriendIDListFromCacheResp") + proto.RegisterType((*GetBlackIDListFromCacheReq)(nil), "cache.GetBlackIDListFromCacheReq") + proto.RegisterType((*GetBlackIDListFromCacheResp)(nil), "cache.GetBlackIDListFromCacheResp") + proto.RegisterType((*DelBlackIDListFromCacheReq)(nil), "cache.DelBlackIDListFromCacheReq") + proto.RegisterType((*DelBlackIDListFromCacheResp)(nil), "cache.DelBlackIDListFromCacheResp") + proto.RegisterType((*GetGroupMemberIDListFromCacheReq)(nil), "cache.GetGroupMemberIDListFromCacheReq") + proto.RegisterType((*GetGroupMemberIDListFromCacheResp)(nil), "cache.GetGroupMemberIDListFromCacheResp") + proto.RegisterType((*DelGroupMemberIDListFromCacheReq)(nil), "cache.DelGroupMemberIDListFromCacheReq") + proto.RegisterType((*DelGroupMemberIDListFromCacheResp)(nil), "cache.DelGroupMemberIDListFromCacheResp") } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConnInterface +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Cache service -// CacheClient is the client API for Cache service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type CacheClient interface { // friendInfo GetFriendIDListFromCache(ctx context.Context, in *GetFriendIDListFromCacheReq, opts ...grpc.CallOption) (*GetFriendIDListFromCacheResp, error) @@ -1104,16 +593,16 @@ type CacheClient interface { } type cacheClient struct { - cc grpc.ClientConnInterface + cc *grpc.ClientConn } -func NewCacheClient(cc grpc.ClientConnInterface) CacheClient { +func NewCacheClient(cc *grpc.ClientConn) CacheClient { return &cacheClient{cc} } func (c *cacheClient) GetFriendIDListFromCache(ctx context.Context, in *GetFriendIDListFromCacheReq, opts ...grpc.CallOption) (*GetFriendIDListFromCacheResp, error) { out := new(GetFriendIDListFromCacheResp) - err := c.cc.Invoke(ctx, "/cache.cache/GetFriendIDListFromCache", in, out, opts...) + err := grpc.Invoke(ctx, "/cache.cache/GetFriendIDListFromCache", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1122,7 +611,7 @@ func (c *cacheClient) GetFriendIDListFromCache(ctx context.Context, in *GetFrien func (c *cacheClient) DelFriendIDListFromCache(ctx context.Context, in *DelFriendIDListFromCacheReq, opts ...grpc.CallOption) (*DelFriendIDListFromCacheResp, error) { out := new(DelFriendIDListFromCacheResp) - err := c.cc.Invoke(ctx, "/cache.cache/DelFriendIDListFromCache", in, out, opts...) + err := grpc.Invoke(ctx, "/cache.cache/DelFriendIDListFromCache", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1131,7 +620,7 @@ func (c *cacheClient) DelFriendIDListFromCache(ctx context.Context, in *DelFrien func (c *cacheClient) GetBlackIDListFromCache(ctx context.Context, in *GetBlackIDListFromCacheReq, opts ...grpc.CallOption) (*GetBlackIDListFromCacheResp, error) { out := new(GetBlackIDListFromCacheResp) - err := c.cc.Invoke(ctx, "/cache.cache/GetBlackIDListFromCache", in, out, opts...) + err := grpc.Invoke(ctx, "/cache.cache/GetBlackIDListFromCache", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1140,7 +629,7 @@ func (c *cacheClient) GetBlackIDListFromCache(ctx context.Context, in *GetBlackI func (c *cacheClient) DelBlackIDListFromCache(ctx context.Context, in *DelBlackIDListFromCacheReq, opts ...grpc.CallOption) (*DelBlackIDListFromCacheResp, error) { out := new(DelBlackIDListFromCacheResp) - err := c.cc.Invoke(ctx, "/cache.cache/DelBlackIDListFromCache", in, out, opts...) + err := grpc.Invoke(ctx, "/cache.cache/DelBlackIDListFromCache", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1149,7 +638,7 @@ func (c *cacheClient) DelBlackIDListFromCache(ctx context.Context, in *DelBlackI func (c *cacheClient) GetGroupMemberIDListFromCache(ctx context.Context, in *GetGroupMemberIDListFromCacheReq, opts ...grpc.CallOption) (*GetGroupMemberIDListFromCacheResp, error) { out := new(GetGroupMemberIDListFromCacheResp) - err := c.cc.Invoke(ctx, "/cache.cache/GetGroupMemberIDListFromCache", in, out, opts...) + err := grpc.Invoke(ctx, "/cache.cache/GetGroupMemberIDListFromCache", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1158,14 +647,15 @@ func (c *cacheClient) GetGroupMemberIDListFromCache(ctx context.Context, in *Get func (c *cacheClient) DelGroupMemberIDListFromCache(ctx context.Context, in *DelGroupMemberIDListFromCacheReq, opts ...grpc.CallOption) (*DelGroupMemberIDListFromCacheResp, error) { out := new(DelGroupMemberIDListFromCacheResp) - err := c.cc.Invoke(ctx, "/cache.cache/DelGroupMemberIDListFromCache", in, out, opts...) + err := grpc.Invoke(ctx, "/cache.cache/DelGroupMemberIDListFromCache", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// CacheServer is the server API for Cache service. +// Server API for Cache service + type CacheServer interface { // friendInfo GetFriendIDListFromCache(context.Context, *GetFriendIDListFromCacheReq) (*GetFriendIDListFromCacheResp, error) @@ -1181,29 +671,6 @@ type CacheServer interface { DelGroupMemberIDListFromCache(context.Context, *DelGroupMemberIDListFromCacheReq) (*DelGroupMemberIDListFromCacheResp, error) } -// UnimplementedCacheServer can be embedded to have forward compatible implementations. -type UnimplementedCacheServer struct { -} - -func (*UnimplementedCacheServer) GetFriendIDListFromCache(context.Context, *GetFriendIDListFromCacheReq) (*GetFriendIDListFromCacheResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFriendIDListFromCache not implemented") -} -func (*UnimplementedCacheServer) DelFriendIDListFromCache(context.Context, *DelFriendIDListFromCacheReq) (*DelFriendIDListFromCacheResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelFriendIDListFromCache not implemented") -} -func (*UnimplementedCacheServer) GetBlackIDListFromCache(context.Context, *GetBlackIDListFromCacheReq) (*GetBlackIDListFromCacheResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBlackIDListFromCache not implemented") -} -func (*UnimplementedCacheServer) DelBlackIDListFromCache(context.Context, *DelBlackIDListFromCacheReq) (*DelBlackIDListFromCacheResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelBlackIDListFromCache not implemented") -} -func (*UnimplementedCacheServer) GetGroupMemberIDListFromCache(context.Context, *GetGroupMemberIDListFromCacheReq) (*GetGroupMemberIDListFromCacheResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetGroupMemberIDListFromCache not implemented") -} -func (*UnimplementedCacheServer) DelGroupMemberIDListFromCache(context.Context, *DelGroupMemberIDListFromCacheReq) (*DelGroupMemberIDListFromCacheResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelGroupMemberIDListFromCache not implemented") -} - func RegisterCacheServer(s *grpc.Server, srv CacheServer) { s.RegisterService(&_Cache_serviceDesc, srv) } @@ -1348,3 +815,39 @@ var _Cache_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "cache/cache.proto", } + +func init() { proto.RegisterFile("cache/cache.proto", fileDescriptor_cache_e3bd73ca9c307fc2) } + +var fileDescriptor_cache_e3bd73ca9c307fc2 = []byte{ + // 466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x41, 0x8f, 0x93, 0x40, + 0x14, 0x0e, 0xab, 0xae, 0xd9, 0xb7, 0x27, 0xe7, 0xa0, 0x04, 0xb7, 0x4a, 0xf1, 0x20, 0x97, 0x85, + 0x64, 0x3d, 0x1a, 0x2f, 0x5b, 0x52, 0x42, 0x62, 0x63, 0x82, 0x49, 0x4d, 0x8c, 0x8a, 0x94, 0x4e, + 0x2a, 0x29, 0x30, 0xe3, 0x0c, 0xb5, 0x17, 0xbd, 0xf8, 0xbf, 0x4d, 0xcc, 0x0c, 0x96, 0x52, 0x74, + 0xa0, 0xa6, 0xed, 0x85, 0x64, 0x66, 0xde, 0xbc, 0xef, 0xfb, 0x78, 0xef, 0x7d, 0x03, 0x0f, 0x92, + 0x38, 0xf9, 0x82, 0x5d, 0xf9, 0x75, 0x28, 0x23, 0x25, 0x41, 0xf7, 0xe4, 0xc2, 0xb0, 0xdf, 0x50, + 0x5c, 0x5c, 0x07, 0x93, 0xeb, 0xb7, 0x98, 0x7d, 0xc3, 0xcc, 0xa5, 0xcb, 0x85, 0x2b, 0x03, 0x5c, + 0x3e, 0x5f, 0x46, 0x6b, 0xee, 0xae, 0x79, 0x75, 0xc1, 0x7a, 0x07, 0x8f, 0x7d, 0x5c, 0x8e, 0x59, + 0x8a, 0x8b, 0x79, 0xe0, 0xbd, 0x4e, 0x79, 0x39, 0x66, 0x24, 0x1f, 0x89, 0x2c, 0x21, 0xfe, 0x8a, + 0x1e, 0xc2, 0xf9, 0x8a, 0x63, 0x16, 0x78, 0xba, 0x66, 0x6a, 0xf6, 0x45, 0xf8, 0x67, 0x85, 0x4c, + 0xb8, 0x24, 0x14, 0xb3, 0xb8, 0x4c, 0x49, 0x11, 0x78, 0xfa, 0x99, 0x3c, 0x6c, 0x6e, 0x59, 0x3f, + 0xe0, 0x4a, 0x9d, 0x98, 0x53, 0xf4, 0x04, 0xa0, 0xca, 0x25, 0x8e, 0x74, 0xcd, 0xbc, 0x63, 0x5f, + 0x84, 0x8d, 0x1d, 0xf4, 0x0a, 0x20, 0x21, 0x79, 0x4e, 0x0a, 0x11, 0x2d, 0x01, 0x2e, 0x6f, 0x06, + 0x0e, 0x97, 0x7a, 0xa2, 0x98, 0xa6, 0x11, 0x8d, 0x59, 0x9c, 0x73, 0x67, 0x54, 0x07, 0x85, 0x8d, + 0x0b, 0x42, 0x97, 0x87, 0xb3, 0x13, 0xe8, 0xfa, 0x08, 0x57, 0xea, 0xc4, 0x9c, 0xb6, 0x78, 0x6b, + 0xff, 0xcb, 0x7b, 0x0a, 0x86, 0x8f, 0xcb, 0xdb, 0x2c, 0x4e, 0x96, 0x47, 0xa5, 0xfd, 0x5d, 0xd6, + 0xf9, 0xdf, 0x79, 0x4f, 0x5f, 0x8d, 0x29, 0x18, 0x1e, 0xce, 0x8e, 0xaf, 0xea, 0x83, 0xac, 0xb2, + 0x52, 0xd5, 0x81, 0xb5, 0xf8, 0x04, 0xa6, 0x8f, 0x4b, 0x9f, 0x91, 0x15, 0x9d, 0xe0, 0x7c, 0xb6, + 0xf9, 0x19, 0x3b, 0xdc, 0x5b, 0x1c, 0xb5, 0xbf, 0x38, 0x22, 0x1d, 0xee, 0x2f, 0x44, 0x8a, 0x5a, + 0xc1, 0x66, 0x69, 0xfd, 0xd4, 0x60, 0xd8, 0x03, 0x70, 0xb0, 0x88, 0x56, 0x65, 0xcf, 0xda, 0x95, + 0x15, 0x22, 0x3d, 0x9c, 0x75, 0x8b, 0x6c, 0x48, 0xd0, 0x76, 0x24, 0xec, 0x51, 0xa2, 0x19, 0x0c, + 0x7b, 0xf2, 0x1f, 0xac, 0xf1, 0xe6, 0xd7, 0x5d, 0xa8, 0x8c, 0x0f, 0x25, 0xa0, 0xab, 0x5c, 0x07, + 0x59, 0x4e, 0xe5, 0x94, 0x1d, 0x7e, 0x67, 0x3c, 0xeb, 0x8d, 0xe1, 0x54, 0x80, 0xa8, 0x2c, 0xa0, + 0x06, 0xe9, 0x30, 0x9f, 0x1a, 0xa4, 0xd3, 0x47, 0x3e, 0xc3, 0x23, 0xc5, 0xc0, 0xa2, 0xe1, 0x96, + 0xa4, 0x62, 0xa4, 0x0c, 0xab, 0x2f, 0xa4, 0x42, 0x50, 0x0c, 0x4f, 0x8d, 0xa0, 0x1e, 0x5a, 0xc3, + 0xea, 0x0b, 0xe1, 0x14, 0x31, 0x18, 0x74, 0xf6, 0x37, 0x7a, 0xbe, 0xa5, 0xd9, 0xd9, 0x81, 0x86, + 0xbd, 0x5f, 0x60, 0x85, 0xd9, 0xd9, 0x6f, 0x35, 0x66, 0x5f, 0xd7, 0xd7, 0x98, 0xbd, 0xed, 0x7b, + 0xfb, 0xf4, 0xfd, 0x40, 0x3c, 0xb8, 0x51, 0x30, 0x69, 0xbc, 0xb4, 0xf2, 0xf2, 0x4b, 0xf9, 0x9d, + 0x9d, 0xcb, 0xad, 0x17, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xff, 0xcd, 0x0e, 0x4c, 0xb2, 0x07, + 0x00, 0x00, +} diff --git a/pkg/proto/cache/cache.proto b/pkg/proto/cache/cache.proto index 970a77a58..09e960ae2 100644 --- a/pkg/proto/cache/cache.proto +++ b/pkg/proto/cache/cache.proto @@ -1,11 +1,8 @@ syntax = "proto3"; +import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; option go_package = "Open_IM/pkg/proto/cache;cache"; package cache; -message CommonResp{ - int32 errCode = 1; - string errMsg = 2; -} message GetFriendIDListFromCacheReq { string userID = 1; @@ -14,7 +11,7 @@ message GetFriendIDListFromCacheReq { message GetFriendIDListFromCacheResp { repeated string userIDList = 1; - CommonResp commonResp = 2; + server_api_params.CommonResp commonResp = 2; } message DelFriendIDListFromCacheReq { @@ -23,7 +20,7 @@ message DelFriendIDListFromCacheReq { } message DelFriendIDListFromCacheResp { - CommonResp commonResp = 1; + server_api_params.CommonResp commonResp = 1; } message GetBlackIDListFromCacheReq { @@ -33,7 +30,7 @@ message GetBlackIDListFromCacheReq { message GetBlackIDListFromCacheResp { repeated string userIDList = 1; - CommonResp commonResp = 2; + server_api_params.CommonResp commonResp = 2; } message DelBlackIDListFromCacheReq { @@ -42,7 +39,7 @@ message DelBlackIDListFromCacheReq { } message DelBlackIDListFromCacheResp { - CommonResp commonResp = 1; + server_api_params.CommonResp commonResp = 1; } message GetGroupMemberIDListFromCacheReq { @@ -51,7 +48,7 @@ message GetGroupMemberIDListFromCacheReq { } message GetGroupMemberIDListFromCacheResp { - CommonResp commonResp = 1; + server_api_params.CommonResp commonResp = 1; repeated string userIDList = 2; } @@ -61,7 +58,7 @@ message DelGroupMemberIDListFromCacheReq { } message DelGroupMemberIDListFromCacheResp { - CommonResp commonResp = 1; + server_api_params.CommonResp commonResp = 1; } service cache{ diff --git a/pkg/utils/getcd.go b/pkg/utils/getcd.go index 9c6ddce7b..fda41429a 100644 --- a/pkg/utils/getcd.go +++ b/pkg/utils/getcd.go @@ -11,12 +11,12 @@ import ( "strings" ) -func GetConn(ctx context.Context, operationID, serviceName string) (conn *grpc.ClientConn, err error) { +func GetConn(ctx context.Context, serviceName string) (conn *grpc.ClientConn, err error) { defer func() { trace_log.SetContextInfo(ctx, "GetConn", err, "serviceName", serviceName) }() conn = getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), - serviceName, operationID, config.Config.Etcd.UserName, config.Config.Etcd.Password) + serviceName, trace_log.GetOperationID(ctx), config.Config.Etcd.UserName, config.Config.Etcd.Password) if conn == nil { return nil, constant.ErrRpcConn }