diff --git a/internal/rpc/cache/cache.go b/internal/rpc/cache/cache.go deleted file mode 100644 index 1483ca4a8..000000000 --- a/internal/rpc/cache/cache.go +++ /dev/null @@ -1,145 +0,0 @@ -package cache - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - rocksCache "Open_IM/pkg/common/db/rocks_cache" - "Open_IM/pkg/common/log" - promePkg "Open_IM/pkg/common/prometheus" - pbCache "Open_IM/pkg/proto/cache" - "Open_IM/pkg/utils" - "context" - "github.com/OpenIMSDK/getcdv3" - "net" - "strconv" - "strings" - - grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus" - "google.golang.org/grpc" -) - -type cacheServer struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string -} - -func NewCacheServer(port int) *cacheServer { - log.NewPrivateLog(constant.LogFileName) - return &cacheServer{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImCacheName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - } -} - -func (s *cacheServer) Run() { - log.NewInfo("0", "cacheServer rpc start ") - listenIP := "" - if config.Config.ListenIP == "" { - listenIP = "0.0.0.0" - } else { - listenIP = config.Config.ListenIP - } - address := listenIP + ":" + strconv.Itoa(s.rpcPort) - //listener network - listener, err := net.Listen("tcp", address) - if err != nil { - panic("listening err:" + err.Error() + s.rpcRegisterName) - } - log.NewInfo("0", "listen network success, ", address, listener) - defer listener.Close() - //grpc server - var grpcOpts []grpc.ServerOption - if config.Config.Prometheus.Enable { - promePkg.NewGrpcRequestCounter() - promePkg.NewGrpcRequestFailedCounter() - promePkg.NewGrpcRequestSuccessCounter() - grpcOpts = append(grpcOpts, []grpc.ServerOption{ - // grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme), - grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), - }...) - } - srv := grpc.NewServer(grpcOpts...) - defer srv.GracefulStop() - pbCache.RegisterCacheServer(srv, s) - - rpcRegisterIP := config.Config.RpcRegisterIP - if config.Config.RpcRegisterIP == "" { - rpcRegisterIP, err = utils.GetLocalIP() - if err != nil { - log.Error("", "GetLocalIP failed ", err.Error()) - } - } - log.NewInfo("", "rpcRegisterIP", rpcRegisterIP) - 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")) - } - go rocksCache.DelKeys() - err = srv.Serve(listener) - if err != nil { - log.NewError("0", "Serve failed ", err.Error()) - return - } - log.NewInfo("0", "message cms rpc success") -} - -func (s *cacheServer) GetFriendIDListFromCache(ctx context.Context, req *pbCache.GetFriendIDListFromCacheReq) (resp *pbCache.GetFriendIDListFromCacheResp, err error) { - resp = &pbCache.GetFriendIDListFromCacheResp{} - friendIDList, err := rocksCache.GetFriendIDListFromCache(ctx, req.UserID) - if err != nil { - return - } - resp.UserIDList = friendIDList - return -} - -// this is for dtm call -func (s *cacheServer) DelFriendIDListFromCache(ctx context.Context, req *pbCache.DelFriendIDListFromCacheReq) (resp *pbCache.DelFriendIDListFromCacheResp, err error) { - resp = &pbCache.DelFriendIDListFromCacheResp{} - if err := rocksCache.DelFriendIDListFromCache(ctx, req.UserID); err != nil { - return - } - return -} - -func (s *cacheServer) GetBlackIDListFromCache(ctx context.Context, req *pbCache.GetBlackIDListFromCacheReq) (resp *pbCache.GetBlackIDListFromCacheResp, err error) { - resp = &pbCache.GetBlackIDListFromCacheResp{} - blackUserIDList, err := rocksCache.GetBlackListFromCache(ctx, req.UserID) - if err != nil { - return - } - resp.UserIDList = blackUserIDList - return -} - -func (s *cacheServer) DelBlackIDListFromCache(ctx context.Context, req *pbCache.DelBlackIDListFromCacheReq) (resp *pbCache.DelBlackIDListFromCacheResp, err error) { - resp = &pbCache.DelBlackIDListFromCacheResp{} - if err := rocksCache.DelBlackIDListFromCache(ctx, req.UserID); err != nil { - return - } - return resp, nil -} - -func (s *cacheServer) GetGroupMemberIDListFromCache(ctx context.Context, req *pbCache.GetGroupMemberIDListFromCacheReq) (resp *pbCache.GetGroupMemberIDListFromCacheResp, err error) { - resp = &pbCache.GetGroupMemberIDListFromCacheResp{} - userIDList, err := rocksCache.GetGroupMemberIDListFromCache(ctx, req.GroupID) - if err != nil { - return - } - resp.UserIDList = userIDList - return -} - -func (s *cacheServer) DelGroupMemberIDListFromCache(ctx context.Context, req *pbCache.DelGroupMemberIDListFromCacheReq) (resp *pbCache.DelGroupMemberIDListFromCacheResp, err error) { - resp = &pbCache.DelGroupMemberIDListFromCacheResp{} - if err := rocksCache.DelGroupMemberIDListFromCache(ctx, req.GroupID); err != nil { - return resp, nil - } - return resp, nil -} diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 19891682e..b758db1f3 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -58,6 +58,7 @@ func NewGroupServer(port int) *groupServer { var mysql relation.Mysql var mongo unrelation.Mongo var groupModel relation.Group + var redis cache.RedisClient err := mysql.InitConn().AutoMigrateModel(&groupModel) if err != nil { panic("db init err:" + err.Error()) @@ -68,8 +69,9 @@ func NewGroupServer(port int) *groupServer { panic("db init err:" + "conn is nil") } mongo.InitMongo() + redis.InitRedis() mongo.CreateSuperGroupIndex() - g.GroupInterface = controller.NewGroupController(groupModel.DB, cache.InitRedis(), mongo.DB) + g.GroupInterface = controller.NewGroupController(groupModel.DB, redis.GetClient(), mongo.GetClient()) return &g } @@ -166,6 +168,9 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR if err := callbackBeforeCreateGroup(ctx, req); err != nil { return nil, err } + var groupInfo relation.Group + utils.CopyStructFields(&groupInfo, req.GroupInfo) + groupInfo, err := (&cp.PBGroup{req.GroupInfo}).Convert() groupInfo.GroupID = genGroupID(ctx, req.GroupInfo.GroupID) if req.GroupInfo.GroupType != constant.SuperGroup { diff --git a/internal/utils/convert.go b/internal/utils/convert.go index 51ada5bbe..b80a9c34a 100644 --- a/internal/utils/convert.go +++ b/internal/utils/convert.go @@ -1,7 +1,7 @@ package utils import ( - imdb "Open_IM/pkg/common/db/relation" + "Open_IM/pkg/common/db/relation" sdk "Open_IM/pkg/proto/sdk_ws" utils2 "Open_IM/pkg/utils" utils "github.com/OpenIMSDK/open_utils" @@ -20,7 +20,7 @@ func getNumberOfGroupMember(groupID string) (int32, error) { } type DBFriend struct { - *imdb.Friend + *relation.Friend } type PBFriend struct { @@ -41,8 +41,8 @@ func (db *DBFriend) convert() (*sdk.FriendInfo, error) { return pbFriend, nil } -func (pb *PBFriend) Convert() (*imdb.Friend, error) { - dbFriend := &imdb.Friend{} +func (pb *PBFriend) Convert() (*relation.Friend, error) { + dbFriend := &relation.Friend{} utils2.CopyStructFields(dbFriend, pb) dbFriend.FriendUserID = pb.FriendUser.UserID dbFriend.CreateTime = utils2.UnixSecondToTime(int64(pb.CreateTime)) @@ -50,15 +50,15 @@ func (pb *PBFriend) Convert() (*imdb.Friend, error) { } type DBFriendRequest struct { - *imdb.FriendRequest + *relation.FriendRequest } type PBFriendRequest struct { *sdk.FriendRequest } -func (pb *PBFriendRequest) Convert() (*imdb.FriendRequest, error) { - dbFriendRequest := &imdb.FriendRequest{} +func (pb *PBFriendRequest) Convert() (*relation.FriendRequest, error) { + dbFriendRequest := &relation.FriendRequest{} utils.CopyStructFields(dbFriendRequest, pb) dbFriendRequest.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime)) dbFriendRequest.HandleTime = utils.UnixSecondToTime(int64(pb.HandleTime)) @@ -87,15 +87,15 @@ func (db *DBFriendRequest) Convert() (*sdk.FriendRequest, error) { } type DBBlack struct { - *imdb.Black + *relation.Black } type PBBlack struct { *sdk.BlackInfo } -func (pb *PBBlack) Convert() (*imdb.Black, error) { - dbBlack := &imdb.Black{} +func (pb *PBBlack) Convert() (*relation.Black, error) { + dbBlack := &relation.Black{} dbBlack.BlockUserID = pb.BlackUserInfo.UserID dbBlack.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime)) return dbBlack, nil @@ -113,17 +113,17 @@ func (db *DBBlack) Convert() (*sdk.BlackInfo, error) { } type DBGroup struct { - *imdb.Group + *relation.Group } type PBGroup struct { *sdk.GroupInfo } -func (pb *PBGroup) Convert() (*imdb.Group, error) { - dst := &imdb.Group{} - utils.CopyStructFields(dst, pb) - return dst, nil +func (pb *PBGroup) Convert() *relation.Group { + dst := &relation.Group{} + _ = utils.CopyStructFields(dst, pb) + return dst } func (db *DBGroup) Convert() (*sdk.GroupInfo, error) { dst := &sdk.GroupInfo{} @@ -148,15 +148,15 @@ func (db *DBGroup) Convert() (*sdk.GroupInfo, error) { } type DBGroupMember struct { - *imdb.GroupMember + *relation.GroupMember } type PBGroupMember struct { *sdk.GroupMemberFullInfo } -func (pb *PBGroupMember) Convert() (*imdb.GroupMember, error) { - dst := &imdb.GroupMember{} +func (pb *PBGroupMember) Convert() (*relation.GroupMember, error) { + dst := &relation.GroupMember{} utils.CopyStructFields(dst, pb) dst.JoinTime = utils.UnixSecondToTime(int64(pb.JoinTime)) dst.MuteEndTime = utils.UnixSecondToTime(int64(pb.MuteEndTime)) @@ -184,15 +184,15 @@ func (db *DBGroupMember) Convert() (*sdk.GroupMemberFullInfo, error) { } type DBGroupRequest struct { - *imdb.GroupRequest + *relation.GroupRequest } type PBGroupRequest struct { *sdk.GroupRequest } -func (pb *PBGroupRequest) Convert() (*imdb.GroupRequest, error) { - dst := &imdb.GroupRequest{} +func (pb *PBGroupRequest) Convert() (*relation.GroupRequest, error) { + dst := &relation.GroupRequest{} utils.CopyStructFields(dst, pb) dst.ReqTime = utils.UnixSecondToTime(int64(pb.ReqTime)) dst.HandledTime = utils.UnixSecondToTime(int64(pb.HandleTime)) @@ -207,23 +207,15 @@ func (db *DBGroupRequest) Convert() (*sdk.GroupRequest, error) { } type DBUser struct { - *imdb.User -} - -func NewDBUser(user *imdb.User) *DBUser { - return &DBUser{User: user} + *relation.User } type PBUser struct { *sdk.UserInfo } -func NewPBUser(userInfo *sdk.UserInfo) *PBUser { - return &PBUser{UserInfo: userInfo} -} - -func (pb *PBUser) Convert() (*imdb.User, error) { - dst := &imdb.User{} +func (pb *PBUser) Convert() (*relation.User, error) { + dst := &relation.User{} utils.CopyStructFields(dst, pb) dst.Birth = utils.UnixSecondToTime(pb.Birthday) dst.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime)) diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index b8daa8c9f..f87627e04 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -15,23 +15,25 @@ const GroupExpireTime = time.Second * 60 * 60 * 12 const groupInfoCacheKey = "GROUP_INFO_CACHE:" type GroupCache struct { - db *relation.Group - expireTime time.Duration - redisClient *RedisClient - rcClient *rockscache.Client + group *relation.Group + groupMember *relation.GroupMember + groupRequest *relation.GroupRequest + expireTime time.Duration + redisClient *RedisClient + rcClient *rockscache.Client } -func NewGroupCache(rdb redis.UniversalClient, db *relation.Group, opts rockscache.Options) *GroupCache { - return &GroupCache{rcClient: rockscache.NewClient(rdb, opts), expireTime: GroupExpireTime, db: db, redisClient: NewRedisClient(rdb)} +func NewGroupCache(rdb redis.UniversalClient, groupDB *relation.Group, groupMemberDB *relation.GroupMember, groupRequestDB *relation.GroupRequest, opts rockscache.Options) *GroupCache { + return &GroupCache{rcClient: rockscache.NewClient(rdb, opts), expireTime: GroupExpireTime, group: groupDB, groupMember: groupMemberDB, groupRequest: groupRequestDB, redisClient: NewRedisClient(rdb)} } func (g *GroupCache) getRedisClient() *RedisClient { return g.redisClient } -func (g *GroupCache) GetGroupsInfoFromCache(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) { +func (g *GroupCache) GetGroupsInfo(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) { for _, groupID := range groupIDs { - group, err := g.GetGroupInfoFromCache(ctx, groupID) + group, err := g.GetGroupInfo(ctx, groupID) if err != nil { return nil, err } @@ -40,9 +42,9 @@ func (g *GroupCache) GetGroupsInfoFromCache(ctx context.Context, groupIDs []stri return groups, nil } -func (g *GroupCache) GetGroupInfoFromCache(ctx context.Context, groupID string) (group *relation.Group, err error) { +func (g *GroupCache) GetGroupInfo(ctx context.Context, groupID string) (group *relation.Group, err error) { getGroup := func() (string, error) { - groupInfo, err := g.db.Take(ctx, groupID) + groupInfo, err := g.group.Take(ctx, groupID) if err != nil { return "", utils.Wrap(err, "") } @@ -64,16 +66,16 @@ func (g *GroupCache) GetGroupInfoFromCache(ctx context.Context, groupID string) return group, utils.Wrap(err, "") } -func (g *GroupCache) DelGroupInfoFromCache(ctx context.Context, groupID string) (err error) { +func (g *GroupCache) DelGroupInfo(ctx context.Context, groupID string) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID) }() return g.rcClient.TagAsDeleted(g.getGroupInfoCacheKey(groupID)) } -func (g *GroupCache) DelGroupsInfoFromCache(ctx context.Context, groupIDs []string) error { +func (g *GroupCache) DelGroupsInfo(ctx context.Context, groupIDs []string) error { for _, groupID := range groupIDs { - if err := g.DelGroupInfoFromCache(ctx, groupID); err != nil { + if err := g.DelGroupInfo(ctx, groupID); err != nil { return err } } @@ -83,3 +85,18 @@ func (g *GroupCache) DelGroupsInfoFromCache(ctx context.Context, groupIDs []stri func (g *GroupCache) getGroupInfoCacheKey(groupID string) string { return groupInfoCacheKey + groupID } + +func (g *GroupCache) DelJoinedSuperGroupIDs(ctx context.Context, userIDs []string) (err error) { + for _, userID := range userIDs { + if err := g.rcClient.TagAsDeleted(joinedSuperGroupListCache + userID); err != nil { + return err + } + } +} + +func (g *GroupCache) DelJoinedSuperGroupID(ctx context.Context, userID string) (err error) { + defer func() { + trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userID", userID) + }() + return g.rcClient.TagAsDeleted(joinedSuperGroupListCache + userID) +} diff --git a/pkg/common/db/cache/redis.go b/pkg/common/db/cache/redis.go index ddb568e23..3f7488b15 100644 --- a/pkg/common/db/cache/redis.go +++ b/pkg/common/db/cache/redis.go @@ -14,7 +14,7 @@ import ( "strconv" "time" - go_redis "github.com/go-redis/redis/v8" + "github.com/go-redis/redis/v8" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" ) @@ -42,12 +42,16 @@ const ( exTypeKeyLocker = "EX_LOCK:" ) -func InitRedis() go_redis.UniversalClient { - var rdb go_redis.UniversalClient +type RedisClient struct { + rdb redis.UniversalClient +} + +func (r *RedisClient) InitRedis() { + var rdb redis.UniversalClient var err error ctx := context.Background() if config.Config.Redis.EnableCluster { - rdb = go_redis.NewClusterClient(&go_redis.ClusterOptions{ + rdb = redis.NewClusterClient(&redis.ClusterOptions{ Addrs: config.Config.Redis.DBAddress, Username: config.Config.Redis.DBUserName, Password: config.Config.Redis.DBPassWord, // no password set @@ -59,7 +63,7 @@ func InitRedis() go_redis.UniversalClient { panic(err.Error() + " redis cluster " + config.Config.Redis.DBUserName + config.Config.Redis.DBPassWord) } } else { - rdb = go_redis.NewClient(&go_redis.Options{ + rdb = redis.NewClient(&redis.Options{ Addr: config.Config.Redis.DBAddress[0], Username: config.Config.Redis.DBUserName, Password: config.Config.Redis.DBPassWord, // no password set @@ -71,14 +75,14 @@ func InitRedis() go_redis.UniversalClient { panic(err.Error() + " redis " + config.Config.Redis.DBAddress[0] + config.Config.Redis.DBUserName + config.Config.Redis.DBPassWord) } } - return rdb + r.rdb = rdb } -type RedisClient struct { - rdb go_redis.UniversalClient +func (r *RedisClient) GetClient() redis.UniversalClient { + return r.rdb } -func NewRedisClient(rdb go_redis.UniversalClient) *RedisClient { +func NewRedisClient(rdb redis.UniversalClient) *RedisClient { return &RedisClient{rdb: rdb} } @@ -213,7 +217,7 @@ func (r *RedisClient) GetUserGlobalMsgRecvOpt(userID string) (int, error) { key := conversationReceiveMessageOpt + userID result, err := r.rdb.HGet(context.Background(), key, GlobalMsgRecvOpt).Result() if err != nil { - if err == go_redis.Nil { + if err == redis.Nil { return 0, nil } else { return 0, err @@ -289,7 +293,7 @@ func (r *RedisClient) CleanUpOneUserAllMsgFromRedis(userID string, operationID s key := messageCache + userID + "_" + "*" vals, err := r.rdb.Keys(ctx, key).Result() log2.Debug(operationID, "vals: ", vals) - if err == go_redis.Nil { + if err == redis.Nil { return nil } if err != nil { @@ -407,7 +411,7 @@ func (r *RedisClient) DelMsgFromCache(uid string, seqList []uint32, operationID key := messageCache + uid + "_" + strconv.Itoa(int(seq)) result, err := r.rdb.Get(context.Background(), key).Result() if err != nil { - if err == go_redis.Nil { + if err == redis.Nil { log2.NewDebug(operationID, utils.GetSelfFuncName(), err.Error(), "redis nil") } else { log2.NewError(operationID, utils.GetSelfFuncName(), err.Error(), key) diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index 677a6ce88..329c9cbc5 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -19,6 +19,7 @@ type GroupInterface interface { TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) //mongo + CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) } @@ -26,7 +27,7 @@ type GroupController struct { database DataBase } -func NewGroupController(db *gorm.DB, rdb redis.UniversalClient, mgoDB *mongo.Database) GroupInterface { +func NewGroupController(db *gorm.DB, rdb redis.UniversalClient, mgoDB *mongo.Client) GroupInterface { groupController := &GroupController{database: newGroupDatabase(db, rdb, mgoDB)} return groupController } @@ -51,25 +52,40 @@ func (g *GroupController) GetSuperGroupByID(ctx context.Context, groupID string) return g.database.GetSuperGroupByID(ctx, groupID) } +func (g *GroupController) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error { + return g.database.CreateSuperGroup(ctx, groupID, initMemberIDList, memberNumCount) +} + type DataBase interface { FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) CreateGroup(ctx context.Context, groups []*relation.Group) error DeleteGroupByIDs(ctx context.Context, groupIDs []string) error TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) + CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error } type GroupDataBase struct { - sqlDB *relation.Group + groupDB *relation.Group + groupMemberDB *relation.GroupMember + groupRequestDB *relation.GroupRequest + db *gorm.DB + cache *cache.GroupCache mongoDB *unrelation.SuperGroupMgoDB } -func newGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, mgoDB *mongo.Database) DataBase { - sqlDB := relation.NewGroupDB(db) +func newGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, mgoDB *mongo.Client) DataBase { + groupDB := relation.NewGroupDB(db) + groupMemberDB := relation.NewGroupMemberDB(db) + groupRequestDB := relation.NewGroupRequest(db) + newDB := db database := &GroupDataBase{ - sqlDB: sqlDB, - cache: cache.NewGroupCache(rdb, sqlDB, rockscache.Options{ + groupDB: groupDB, + groupMemberDB: groupMemberDB, + groupRequestDB: groupRequestDB, + db: newDB, + cache: cache.NewGroupCache(rdb, groupDB, groupMemberDB, groupRequestDB, rockscache.Options{ RandomExpireAdjustment: 0.2, DisableCacheRead: false, DisableCacheDelete: false, @@ -81,19 +97,19 @@ func newGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, mgoDB *mongo.Datab } func (g *GroupDataBase) FindGroupsByID(ctx context.Context, groupIDs []string) (groups []*relation.Group, err error) { - return g.cache.GetGroupsInfoFromCache(ctx, groupIDs) + return g.cache.GetGroupsInfo(ctx, groupIDs) } func (g *GroupDataBase) CreateGroup(ctx context.Context, groups []*relation.Group) error { - return g.sqlDB.Create(ctx, groups) + return g.groupDB.Create(ctx, groups) } func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) error { - return g.sqlDB.DB.Transaction(func(tx *gorm.DB) error { - if err := g.sqlDB.Delete(ctx, groupIDs, tx); err != nil { + return g.groupDB.DB.Transaction(func(tx *gorm.DB) error { + if err := g.groupDB.Delete(ctx, groupIDs, tx); err != nil { return err } - if err := g.cache.DelGroupsInfoFromCache(ctx, groupIDs); err != nil { + if err := g.cache.DelGroupsInfo(ctx, groupIDs); err != nil { return err } return nil @@ -101,25 +117,56 @@ func (g *GroupDataBase) DeleteGroupByIDs(ctx context.Context, groupIDs []string) } func (g *GroupDataBase) TakeGroupByID(ctx context.Context, groupID string) (group *relation.Group, err error) { - return g.cache.GetGroupInfoFromCache(ctx, groupID) + return g.cache.GetGroupInfo(ctx, groupID) } func (g *GroupDataBase) Update(ctx context.Context, groups []*relation.Group) error { - return g.sqlDB.DB.Transaction(func(tx *gorm.DB) error { - if err := g.sqlDB.Update(ctx, groups, tx); err != nil { + return g.db.Transaction(func(tx *gorm.DB) error { + if err := g.groupDB.Update(ctx, groups, tx); err != nil { return err } var groupIDs []string for _, group := range groups { groupIDs = append(groupIDs, group.GroupID) } - if err := g.cache.DelGroupsInfoFromCache(ctx, groupIDs); err != nil { + if err := g.cache.DelGroupsInfo(ctx, groupIDs); err != nil { return err } return nil }) } +func (g *GroupDataBase) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error { + sess, err := g.mongoDB.MgoClient.StartSession() + if err != nil { + return err + } + defer sess.EndSession(ctx) + sCtx := mongo.NewSessionContext(ctx, sess) + if err = g.mongoDB.CreateSuperGroup(sCtx, groupID, initMemberIDList, memberNumCount); err != nil { + _ = sess.AbortTransaction(ctx) + return err + } + + if err = g.cache.DelJoinedSuperGroupIDs(ctx, initMemberIDList); err != nil { + _ = sess.AbortTransaction(ctx) + return err + } + return sess.CommitTransaction(ctx) +} + func (g *GroupDataBase) GetSuperGroupByID(ctx context.Context, groupID string) (superGroup *unrelation.SuperGroup, err error) { return g.mongoDB.GetSuperGroup(ctx, groupID) } + +func (g *GroupDataBase) CreateGroupAndMember(ctx context.Context, groups []*relation.Group, groupMember []*relation.GroupMember) error { + return g.db.Transaction(func(tx *gorm.DB) error { + if err := g.groupDB.Create(ctx, groups, tx); err != nil { + return err + } + if err := g.groupMemberDB.Create(ctx, groupMember, tx); err != nil { + return err + } + return nil + }) +} diff --git a/pkg/common/db/relation/chat_log_model.go b/pkg/common/db/relation/chat_log_model.go index d2d3a36ff..9cb54ac00 100644 --- a/pkg/common/db/relation/chat_log_model.go +++ b/pkg/common/db/relation/chat_log_model.go @@ -14,8 +14,6 @@ import ( "time" ) -var ChatLogDB *gorm.DB - type ChatLog struct { ServerMsgID string `gorm:"column:server_msg_id;primary_key;type:char(64)" json:"serverMsgID"` ClientMsgID string `gorm:"column:client_msg_id;type:char(64)" json:"clientMsgID"` @@ -32,6 +30,7 @@ type ChatLog struct { SendTime time.Time `gorm:"column:send_time;index:sendTime;index:content_type,priority:1;index:session_type,priority:1;index:recv_id,priority:1;index:send_id,priority:1" json:"sendTime"` CreateTime time.Time `gorm:"column:create_time" json:"createTime"` Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` + DB *gorm.DB } func (ChatLog) TableName() string { diff --git a/pkg/common/db/relation/group_member_model_k.go b/pkg/common/db/relation/group_member_model_k.go index 405c8eff0..08fcbed7f 100644 --- a/pkg/common/db/relation/group_member_model_k.go +++ b/pkg/common/db/relation/group_member_model_k.go @@ -24,36 +24,40 @@ type GroupMember struct { OperatorUserID string `gorm:"column:operator_user_id;size:64"` MuteEndTime time.Time `gorm:"column:mute_end_time"` Ex string `gorm:"column:ex;size:1024"` - DB *gorm.DB + DB *gorm.DB `gorm:"-" json:"-"` } -func (g *GroupMember) Create(ctx context.Context, groupMemberList []*GroupMember) (err error) { +func NewGroupMemberDB(db *gorm.DB) *GroupMember { + return &GroupMember{DB: db} +} + +func (g *GroupMember) Create(ctx context.Context, groupMemberList []*GroupMember, tx ...*gorm.DB) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMemberList", groupMemberList) }() - return utils.Wrap(GroupMemberDB.Create(&groupMemberList).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Create(&groupMemberList).Error, "") } -func (g *GroupMember) Delete(ctx context.Context, groupMembers []*GroupMember) (err error) { +func (g *GroupMember) Delete(ctx context.Context, groupMembers []*GroupMember, tx ...*gorm.DB) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers) }() - return utils.Wrap(GroupMemberDB.Delete(groupMembers).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Delete(groupMembers).Error, "") } -func (g *GroupMember) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}) (err error) { +func (g *GroupMember) UpdateByMap(ctx context.Context, groupID string, userID string, args map[string]interface{}, tx ...*gorm.DB) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "args", args) }() - return utils.Wrap(GroupMemberDB.Model(&GroupMember{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(args).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Model(&GroupMember{}).Where("group_id = ? and user_id = ?", groupID, userID).Updates(args).Error, "") } -func (g *GroupMember) Update(ctx context.Context, groupMembers []*GroupMember) (err error) { +func (g *GroupMember) Update(ctx context.Context, groupMembers []*GroupMember, tx ...*gorm.DB) (err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers) }() - return utils.Wrap(GroupMemberDB.Updates(&groupMembers).Error, "") + return utils.Wrap(getDBConn(g.DB, tx).Updates(&groupMembers).Error, "") } -func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember) (groupList []*GroupMember, err error) { +func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember, tx ...*gorm.DB) (groupList []*GroupMember, err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupMembers", groupMembers, "groupList", groupList) }() @@ -61,25 +65,23 @@ func (g *GroupMember) Find(ctx context.Context, groupMembers []*GroupMember) (gr for _, groupMember := range groupMembers { where = append(where, []interface{}{groupMember.GroupID, groupMember.UserID}) } - err = utils.Wrap(GroupMemberDB.Where("(group_id, user_id) in ?", where).Find(&groupList).Error, "") - return groupList, err + return groupList, utils.Wrap(getDBConn(g.DB, tx).Where("(group_id, user_id) in ?", where).Find(&groupList).Error, "") } -func (g *GroupMember) Take(ctx context.Context, groupID string, userID string) (groupMember *GroupMember, err error) { +func (g *GroupMember) Take(ctx context.Context, groupID string, userID string, tx ...*gorm.DB) (groupMember *GroupMember, err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "userID", userID, "groupMember", *groupMember) }() groupMember = &GroupMember{} - return groupMember, utils.Wrap(GroupMemberDB.Where("group_id = ? and user_id = ?", groupID, userID).Take(groupMember).Error, "") + return groupMember, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and user_id = ?", groupID, userID).Take(groupMember).Error, "") } -func (g *GroupMember) TakeOwnerInfo(ctx context.Context, groupID string) (groupMember *GroupMember, err error) { +func (g *GroupMember) TakeOwnerInfo(ctx context.Context, groupID string, tx ...*gorm.DB) (groupMember *GroupMember, err error) { defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "groupMember", *groupMember) }() groupMember = &GroupMember{} - err = GroupMemberDB.Where("group_id = ? and role_level = ?", groupID, constant.GroupOwner).Take(groupMember).Error - return groupMember, utils.Wrap(err, "") + return groupMember, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ? and role_level = ?", groupID, constant.GroupOwner).Take(groupMember).Error, "") } func InsertIntoGroupMember(toInsertInfo GroupMember) error { diff --git a/pkg/common/db/relation/group_model_k.go b/pkg/common/db/relation/group_model_k.go index 999874842..ba50a9124 100644 --- a/pkg/common/db/relation/group_model_k.go +++ b/pkg/common/db/relation/group_model_k.go @@ -37,8 +37,7 @@ func (g *Group) Create(ctx context.Context, groups []*Group, tx ...*gorm.DB) (er defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groups", groups) }() - err = utils.Wrap(getDBConn(g.DB, tx).Create(&groups).Error, "") - return err + return utils.Wrap(getDBConn(g.DB, tx).Create(&groups).Error, "") } func (g *Group) Delete(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (err error) { @@ -66,8 +65,7 @@ func (g *Group) Find(ctx context.Context, groupIDs []string, tx ...*gorm.DB) (gr defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupIDs", groupIDs, "groups", groups) }() - err = utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Find(&groups).Error, "") - return groups, err + return groups, utils.Wrap(getDBConn(g.DB, tx).Where("group_id in (?)", groupIDs).Find(&groups).Error, "") } func (g *Group) Take(ctx context.Context, groupID string, tx ...*gorm.DB) (group *Group, err error) { @@ -75,8 +73,7 @@ func (g *Group) Take(ctx context.Context, groupID string, tx ...*gorm.DB) (group defer func() { trace_log.SetCtxDebug(ctx, utils.GetFuncName(1), err, "groupID", groupID, "group", *group) }() - err = utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Take(group).Error, "") - return group, err + return group, utils.Wrap(getDBConn(g.DB, tx).Where("group_id = ?", groupID).Take(group).Error, "") } //func (g *Group) DeleteTx(ctx context.Context, groupIDs []string) error { diff --git a/pkg/common/db/relation/group_request_model_k.go b/pkg/common/db/relation/group_request_model_k.go index 2394e2bd6..7acd8b54a 100644 --- a/pkg/common/db/relation/group_request_model_k.go +++ b/pkg/common/db/relation/group_request_model_k.go @@ -22,6 +22,13 @@ type GroupRequest struct { JoinSource int32 `gorm:"column:join_source"` InviterUserID string `gorm:"column:inviter_user_id;size:64"` Ex string `gorm:"column:ex;size:1024"` + DB *gorm.DB +} + +func NewGroupRequest(db *gorm.DB) *GroupRequest { + return &GroupRequest{ + DB: db, + } } func (GroupRequest) TableName() string { diff --git a/pkg/common/db/relation/statistics_model.go b/pkg/common/db/relation/statistics_model.go index 8964731d0..09c5236ee 100644 --- a/pkg/common/db/relation/statistics_model.go +++ b/pkg/common/db/relation/statistics_model.go @@ -2,61 +2,73 @@ package relation import ( "Open_IM/pkg/common/constant" + "gorm.io/gorm" "time" ) -func GetActiveUserNum(from, to time.Time) (int32, error) { - var num int64 - err := ChatLogDB.Table("chat_logs").Select("count(distinct(send_id))").Where("send_time >= ? and send_time <= ?", from, to).Count(&num).Error - return int32(num), err +type Statistics struct { + DB *gorm.DB } -func GetIncreaseUserNum(from, to time.Time) (int32, error) { - var num int64 - err := UserDB.Where("create_time >= ? and create_time <= ?", from, to).Count(&num).Error - return int32(num), err +func NewStatistics(db *gorm.DB) *Statistics { + return &Statistics{DB: db} } -func GetTotalUserNum() (int32, error) { - var num int64 - err := UserDB.Count(&num).Error - return int32(num), err +func (s *Statistics) getUserModel() *gorm.DB { + return s.DB.Model(&User{}) } -func GetTotalUserNumByDate(to time.Time) (int32, error) { - var num int64 - err := UserDB.Where("create_time <= ?", to).Count(&num).Error - return int32(num), err +func (s *Statistics) getChatLogModel() *gorm.DB { + return s.DB.Model(&ChatLog{}) } -func GetPrivateMessageNum(from, to time.Time) (int32, error) { - var num int64 - err := ChatLogDB.Where("send_time >= ? and send_time <= ? and session_type = ?", from, to, 1).Count(&num).Error - return int32(num), err +func (s *Statistics) getGroupModel() *gorm.DB { + return s.DB.Model(&Group{}) } -func GetGroupMessageNum(from, to time.Time) (int32, error) { - var num int64 - err := ChatLogDB.Where("send_time >= ? and send_time <= ? and session_type = ?", from, to, 2).Count(&num).Error - return int32(num), err +func (s *Statistics) GetActiveUserNum(from, to time.Time) (num int64, err error) { + err = s.getChatLogModel().Select("count(distinct(send_id))").Where("send_time >= ? and send_time <= ?", from, to).Count(&num).Error + return num, err } -func GetIncreaseGroupNum(from, to time.Time) (int32, error) { - var num int64 - err := GroupDB.Where("create_time >= ? and create_time <= ?", from, to).Count(&num).Error - return int32(num), err +func (s *Statistics) GetIncreaseUserNum(from, to time.Time) (num int64, err error) { + err = s.getUserModel().Where("create_time >= ? and create_time <= ?", from, to).Count(&num).Error + return num, err } -func GetTotalGroupNum() (int32, error) { - var num int64 - err := GroupDB.Count(&num).Error - return int32(num), err +func (s *Statistics) GetTotalUserNum() (num int64, err error) { + err = s.getUserModel().Count(&num).Error + return num, err } -func GetGroupNum(to time.Time) (int32, error) { - var num int64 - err := GroupDB.Where("create_time <= ?", to).Count(&num).Error - return int32(num), err +func (s *Statistics) GetTotalUserNumByDate(to time.Time) (num int64, err error) { + err = s.getUserModel().Where("create_time <= ?", to).Count(&num).Error + return num, err +} + +func (s *Statistics) GetPrivateMessageNum(from, to time.Time) (num int64, err error) { + err = s.getChatLogModel().Where("send_time >= ? and send_time <= ? and session_type = ?", from, to, constant.SingleChatType).Count(&num).Error + return num, err +} + +func (s *Statistics) GetGroupMessageNum(from, to time.Time) (num int64, err error) { + err = s.getChatLogModel().Where("send_time >= ? and send_time <= ? and session_type in (?)", from, to, []int{constant.GroupChatType, constant.SuperGroupChatType}).Count(&num).Error + return num, err +} + +func (s *Statistics) GetIncreaseGroupNum(from, to time.Time) (num int64, err error) { + err = s.getGroupModel().Where("create_time >= ? and create_time <= ?", from, to).Count(&num).Error + return num, err +} + +func (s *Statistics) GetTotalGroupNum() (num int64, err error) { + err = s.getGroupModel().Count(&num).Error + return num, err +} + +func (s *Statistics) GetGroupNum(to time.Time) (num int64, err error) { + err = s.getGroupModel().Where("create_time <= ?", to).Count(&num).Error + return num, err } type activeGroup struct { @@ -65,14 +77,14 @@ type activeGroup struct { MessageNum int `gorm:"column:message_num"` } -func GetActiveGroups(from, to time.Time, limit int) ([]*activeGroup, error) { +func (s *Statistics) GetActiveGroups(from, to time.Time, limit int) ([]*activeGroup, error) { var activeGroups []*activeGroup - err := ChatLogDB.Select("recv_id, count(*) as message_num").Where("send_time >= ? and send_time <= ? and session_type in (?)", from, to, []int{constant.GroupChatType, constant.SuperGroupChatType}).Group("recv_id").Limit(limit).Order("message_num DESC").Find(&activeGroups).Error + err := s.getChatLogModel().Select("recv_id, count(*) as message_num").Where("send_time >= ? and send_time <= ? and session_type in (?)", from, to, []int{constant.GroupChatType, constant.SuperGroupChatType}).Group("recv_id").Limit(limit).Order("message_num DESC").Find(&activeGroups).Error for _, activeGroup := range activeGroups { group := Group{ GroupID: activeGroup.Id, } - GroupDB.Where("group_id= ? ", group.GroupID).Find(&group) + s.getGroupModel().Where("group_id= ? ", group.GroupID).Find(&group) activeGroup.Name = group.GroupName } return activeGroups, err @@ -84,16 +96,15 @@ type activeUser struct { MessageNum int `gorm:"column:message_num"` } -func GetActiveUsers(from, to time.Time, limit int) ([]*activeUser, error) { - var activeUsers []*activeUser - err := ChatLogDB.Select("send_id, count(*) as message_num").Where("send_time >= ? and send_time <= ? and session_type = ?", from, to, constant.SingleChatType).Group("send_id").Limit(limit).Order("message_num DESC").Find(&activeUsers).Error +func (s *Statistics) GetActiveUsers(from, to time.Time, limit int) (activeUsers []*activeUser, err error) { + err = s.getChatLogModel().Select("send_id, count(*) as message_num").Where("send_time >= ? and send_time <= ? and session_type in (?)", from, to, []int{constant.SingleChatType, constant.GroupChatType, constant.SuperGroupChatType}).Group("send_id").Limit(limit).Order("message_num DESC").Find(&activeUsers).Error for _, activeUser := range activeUsers { user := User{ UserID: activeUser.ID, } - err = UserDB.Select("user_id, name").Find(&user).Error + err = s.getUserModel().Select("user_id, name").Find(&user).Error if err != nil { - continue + return nil, err } activeUser.Name = user.Nickname activeUser.ID = user.UserID diff --git a/pkg/common/db/relation/user_model.go b/pkg/common/db/relation/user_model.go index 32353dd94..2983f4488 100644 --- a/pkg/common/db/relation/user_model.go +++ b/pkg/common/db/relation/user_model.go @@ -9,11 +9,6 @@ import ( "time" ) -var ( - BlackListDB *gorm.DB - UserDB *gorm.DB -) - func InitManager() { for k, v := range config.Config.Manager.AppManagerUid { _, err := GetUserByUserID(v) diff --git a/pkg/common/db/unrelation/init_mongo.go b/pkg/common/db/unrelation/init_mongo.go index efd75c623..90e359c29 100644 --- a/pkg/common/db/unrelation/init_mongo.go +++ b/pkg/common/db/unrelation/init_mongo.go @@ -8,13 +8,12 @@ import ( "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/x/bsonx" - "log" "strings" "time" ) type Mongo struct { - DB *mongo.Database + DB *mongo.Client } func (m *Mongo) InitMongo() { @@ -45,7 +44,7 @@ func (m *Mongo) InitMongo() { config.Config.Mongo.DBMaxPoolSize) } } - log.Println(utils.GetFuncName(1), "start to init mongoDB:", uri) + fmt.Println(utils.GetFuncName(1), "start to init mongoDB:", uri) mongoClient, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri)) if err != nil { time.Sleep(time.Duration(30) * time.Second) @@ -54,7 +53,11 @@ func (m *Mongo) InitMongo() { panic(err.Error() + " mongo.Connect failed " + uri) } } - m.DB = mongoClient.Database(config.Config.Mongo.DBDatabase) + m.DB = mongoClient +} + +func (m *Mongo) GetClient() *mongo.Client { + return m.DB } func (m *Mongo) CreateTagIndex() { @@ -97,7 +100,7 @@ func (m *Mongo) CreateWorkMomentIndex() { } func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...string) error { - db := m.DB.Collection(collection) + db := m.DB.Database(config.Config.Mongo.DBDatabase).Collection(collection) opts := options.CreateIndexes().SetMaxTime(10 * time.Second) indexView := db.Indexes() keysDoc := bsonx.Doc{} diff --git a/pkg/common/db/unrelation/super_group.go b/pkg/common/db/unrelation/super_group.go index 48dd40505..5358f7b4c 100644 --- a/pkg/common/db/unrelation/super_group.go +++ b/pkg/common/db/unrelation/super_group.go @@ -1,6 +1,7 @@ package unrelation import ( + "Open_IM/pkg/common/config" "Open_IM/pkg/utils" "context" "go.mongodb.org/mongo-driver/bson" @@ -15,7 +16,8 @@ const ( ) type SuperGroupMgoDB struct { - mgoDB *mongo.Database + MgoClient *mongo.Client + MgoDB *mongo.Database superGroupCollection *mongo.Collection userToSuperGroupCollection *mongo.Collection } @@ -30,41 +32,32 @@ type UserToSuperGroup struct { GroupIDList []string `bson:"group_id_list" json:"groupIDList"` } -func NewSuperGroupMgoDB(mgoDB *mongo.Database) *SuperGroupMgoDB { - return &SuperGroupMgoDB{mgoDB: mgoDB, superGroupCollection: mgoDB.Collection(cSuperGroup), userToSuperGroupCollection: mgoDB.Collection(cUserToSuperGroup)} +func NewSuperGroupMgoDB(mgoClient *mongo.Client) *SuperGroupMgoDB { + mgoDB := mgoClient.Database(config.Config.Mongo.DBDatabase) + return &SuperGroupMgoDB{MgoDB: mgoDB, MgoClient: mgoClient, superGroupCollection: mgoDB.Collection(cSuperGroup), userToSuperGroupCollection: mgoDB.Collection(cUserToSuperGroup)} } -func (db *SuperGroupMgoDB) CreateSuperGroup(ctx context.Context, groupID string, initMemberIDList []string, memberNumCount int) error { - //ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) - //c := db.mgoDB.Database(config.Config.Mongo.DBDatabase).Collection(cSuperGroup) - opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) - return db.mgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { - err := sCtx.StartTransaction() +func (db *SuperGroupMgoDB) CreateSuperGroup(sCtx mongo.SessionContext, groupID string, initMemberIDList []string, memberNumCount int) error { + superGroup := SuperGroup{ + GroupID: groupID, + MemberIDList: initMemberIDList, + } + _, err := db.superGroupCollection.InsertOne(sCtx, superGroup) + if err != nil { + return err + } + upsert := true + opts := &options.UpdateOptions{ + Upsert: &upsert, + } + for _, userID := range initMemberIDList { + _, err = db.userToSuperGroupCollection.UpdateOne(sCtx, bson.M{"user_id": userID}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts) if err != nil { return err } - superGroup := SuperGroup{ - GroupID: groupID, - MemberIDList: initMemberIDList, - } - _, err = db.superGroupCollection.InsertOne(sCtx, superGroup) - if err != nil { - _ = sCtx.AbortTransaction(ctx) - return err - } - upsert := true - opts := &options.UpdateOptions{ - Upsert: &upsert, - } - for _, userID := range initMemberIDList { - _, err = db.userToSuperGroupCollection.UpdateOne(sCtx, bson.M{"user_id": userID}, bson.M{"$addToSet": bson.M{"group_id_list": groupID}}, opts) - if err != nil { - _ = sCtx.AbortTransaction(ctx) - return err - } - } - return sCtx.CommitTransaction(ctx) - }) + } + return nil + } func (db *SuperGroupMgoDB) GetSuperGroup(ctx context.Context, groupID string) (*SuperGroup, error) { @@ -75,7 +68,7 @@ func (db *SuperGroupMgoDB) GetSuperGroup(ctx context.Context, groupID string) (* func (db *SuperGroupMgoDB) AddUserToSuperGroup(ctx context.Context, groupID string, userIDList []string) error { opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) - return db.mgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { + return db.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { _, err := db.superGroupCollection.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$addToSet": bson.M{"member_id_list": bson.M{"$each": userIDList}}}) if err != nil { _ = sCtx.AbortTransaction(ctx) @@ -98,7 +91,7 @@ func (db *SuperGroupMgoDB) AddUserToSuperGroup(ctx context.Context, groupID stri func (db *SuperGroupMgoDB) RemoverUserFromSuperGroup(ctx context.Context, groupID string, userIDList []string) error { opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) - return db.mgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { + return db.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { _, err := db.superGroupCollection.UpdateOne(sCtx, bson.M{"group_id": groupID}, bson.M{"$pull": bson.M{"member_id_list": bson.M{"$in": userIDList}}}) if err != nil { _ = sCtx.AbortTransaction(ctx) @@ -121,7 +114,7 @@ func (db *SuperGroupMgoDB) GetSuperGroupByUserID(ctx context.Context, userID str func (db *SuperGroupMgoDB) DeleteSuperGroup(ctx context.Context, groupID string) error { opts := options.Session().SetDefaultReadConcern(readconcern.Majority()) - return db.mgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { + return db.MgoDB.Client().UseSessionWithOptions(ctx, opts, func(sCtx mongo.SessionContext) error { superGroup := &SuperGroup{} _, err := db.superGroupCollection.DeleteOne(sCtx, bson.M{"group_id": groupID}) if err != nil { diff --git a/pkg/proto/admin_cms/admin_cms.proto b/pkg/proto/admin_cms/admin_cms.proto index 5ba1539ec..b654c0b22 100644 --- a/pkg/proto/admin_cms/admin_cms.proto +++ b/pkg/proto/admin_cms/admin_cms.proto @@ -3,24 +3,15 @@ option go_package = "Open_IM/pkg/proto/admin_cms;admin_cms"; import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; package admin_cms; - -message CommonResp { - int32 errCode = 1; - string errMsg = 2; -} - message AdminLoginReq { - string operationID = 1; string adminID = 2; string secret = 3; } - message AdminLoginResp { string token = 1; string userName = 2; string faceURL = 3; - CommonResp commonResp = 4; } message GetUserTokenReq { diff --git a/pkg/proto/cache/cache.pb.go b/pkg/proto/cache/cache.pb.go deleted file mode 100644 index bf903873b..000000000 --- a/pkg/proto/cache/cache.pb.go +++ /dev/null @@ -1,853 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: cache/cache.proto - -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 "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// 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 { - 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 (m *GetFriendIDListFromCacheReq) Reset() { *m = GetFriendIDListFromCacheReq{} } -func (m *GetFriendIDListFromCacheReq) String() string { return proto.CompactTextString(m) } -func (*GetFriendIDListFromCacheReq) ProtoMessage() {} -func (*GetFriendIDListFromCacheReq) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_GetFriendIDListFromCacheReq proto.InternalMessageInfo - -func (m *GetFriendIDListFromCacheReq) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *GetFriendIDListFromCacheReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type GetFriendIDListFromCacheResp struct { - 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 (m *GetFriendIDListFromCacheResp) Reset() { *m = GetFriendIDListFromCacheResp{} } -func (m *GetFriendIDListFromCacheResp) String() string { return proto.CompactTextString(m) } -func (*GetFriendIDListFromCacheResp) ProtoMessage() {} -func (*GetFriendIDListFromCacheResp) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_GetFriendIDListFromCacheResp proto.InternalMessageInfo - -func (m *GetFriendIDListFromCacheResp) GetUserIDList() []string { - if m != nil { - return m.UserIDList - } - return nil -} - -func (m *GetFriendIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - -type DelFriendIDListFromCacheReq struct { - 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 (m *DelFriendIDListFromCacheReq) Reset() { *m = DelFriendIDListFromCacheReq{} } -func (m *DelFriendIDListFromCacheReq) String() string { return proto.CompactTextString(m) } -func (*DelFriendIDListFromCacheReq) ProtoMessage() {} -func (*DelFriendIDListFromCacheReq) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_DelFriendIDListFromCacheReq proto.InternalMessageInfo - -func (m *DelFriendIDListFromCacheReq) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *DelFriendIDListFromCacheReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type DelFriendIDListFromCacheResp struct { - 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 (m *DelFriendIDListFromCacheResp) Reset() { *m = DelFriendIDListFromCacheResp{} } -func (m *DelFriendIDListFromCacheResp) String() string { return proto.CompactTextString(m) } -func (*DelFriendIDListFromCacheResp) ProtoMessage() {} -func (*DelFriendIDListFromCacheResp) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_DelFriendIDListFromCacheResp proto.InternalMessageInfo - -func (m *DelFriendIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - -type GetBlackIDListFromCacheReq struct { - 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 (m *GetBlackIDListFromCacheReq) Reset() { *m = GetBlackIDListFromCacheReq{} } -func (m *GetBlackIDListFromCacheReq) String() string { return proto.CompactTextString(m) } -func (*GetBlackIDListFromCacheReq) ProtoMessage() {} -func (*GetBlackIDListFromCacheReq) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_GetBlackIDListFromCacheReq proto.InternalMessageInfo - -func (m *GetBlackIDListFromCacheReq) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *GetBlackIDListFromCacheReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type GetBlackIDListFromCacheResp struct { - 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 (m *GetBlackIDListFromCacheResp) Reset() { *m = GetBlackIDListFromCacheResp{} } -func (m *GetBlackIDListFromCacheResp) String() string { return proto.CompactTextString(m) } -func (*GetBlackIDListFromCacheResp) ProtoMessage() {} -func (*GetBlackIDListFromCacheResp) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_GetBlackIDListFromCacheResp proto.InternalMessageInfo - -func (m *GetBlackIDListFromCacheResp) GetUserIDList() []string { - if m != nil { - return m.UserIDList - } - return nil -} - -func (m *GetBlackIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - -type DelBlackIDListFromCacheReq struct { - 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 (m *DelBlackIDListFromCacheReq) Reset() { *m = DelBlackIDListFromCacheReq{} } -func (m *DelBlackIDListFromCacheReq) String() string { return proto.CompactTextString(m) } -func (*DelBlackIDListFromCacheReq) ProtoMessage() {} -func (*DelBlackIDListFromCacheReq) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_DelBlackIDListFromCacheReq proto.InternalMessageInfo - -func (m *DelBlackIDListFromCacheReq) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *DelBlackIDListFromCacheReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type DelBlackIDListFromCacheResp struct { - 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 (m *DelBlackIDListFromCacheResp) Reset() { *m = DelBlackIDListFromCacheResp{} } -func (m *DelBlackIDListFromCacheResp) String() string { return proto.CompactTextString(m) } -func (*DelBlackIDListFromCacheResp) ProtoMessage() {} -func (*DelBlackIDListFromCacheResp) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_DelBlackIDListFromCacheResp proto.InternalMessageInfo - -func (m *DelBlackIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - -type GetGroupMemberIDListFromCacheReq struct { - 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 (m *GetGroupMemberIDListFromCacheReq) Reset() { *m = GetGroupMemberIDListFromCacheReq{} } -func (m *GetGroupMemberIDListFromCacheReq) String() string { return proto.CompactTextString(m) } -func (*GetGroupMemberIDListFromCacheReq) ProtoMessage() {} -func (*GetGroupMemberIDListFromCacheReq) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_GetGroupMemberIDListFromCacheReq proto.InternalMessageInfo - -func (m *GetGroupMemberIDListFromCacheReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *GetGroupMemberIDListFromCacheReq) GetGroupID() string { - if m != nil { - return m.GroupID - } - return "" -} - -type GetGroupMemberIDListFromCacheResp struct { - 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 (m *GetGroupMemberIDListFromCacheResp) Reset() { *m = GetGroupMemberIDListFromCacheResp{} } -func (m *GetGroupMemberIDListFromCacheResp) String() string { return proto.CompactTextString(m) } -func (*GetGroupMemberIDListFromCacheResp) ProtoMessage() {} -func (*GetGroupMemberIDListFromCacheResp) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_GetGroupMemberIDListFromCacheResp proto.InternalMessageInfo - -func (m *GetGroupMemberIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return nil -} - -func (m *GetGroupMemberIDListFromCacheResp) GetUserIDList() []string { - if m != nil { - return m.UserIDList - } - return nil -} - -type DelGroupMemberIDListFromCacheReq struct { - 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 (m *DelGroupMemberIDListFromCacheReq) Reset() { *m = DelGroupMemberIDListFromCacheReq{} } -func (m *DelGroupMemberIDListFromCacheReq) String() string { return proto.CompactTextString(m) } -func (*DelGroupMemberIDListFromCacheReq) ProtoMessage() {} -func (*DelGroupMemberIDListFromCacheReq) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_DelGroupMemberIDListFromCacheReq proto.InternalMessageInfo - -func (m *DelGroupMemberIDListFromCacheReq) GetGroupID() string { - if m != nil { - return m.GroupID - } - return "" -} - -func (m *DelGroupMemberIDListFromCacheReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type DelGroupMemberIDListFromCacheResp struct { - 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 (m *DelGroupMemberIDListFromCacheResp) Reset() { *m = DelGroupMemberIDListFromCacheResp{} } -func (m *DelGroupMemberIDListFromCacheResp) String() string { return proto.CompactTextString(m) } -func (*DelGroupMemberIDListFromCacheResp) ProtoMessage() {} -func (*DelGroupMemberIDListFromCacheResp) Descriptor() ([]byte, []int) { - 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) -} - -var xxx_messageInfo_DelGroupMemberIDListFromCacheResp proto.InternalMessageInfo - -func (m *DelGroupMemberIDListFromCacheResp) GetCommonResp() *sdk_ws.CommonResp { - if m != nil { - return m.CommonResp - } - return 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.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.SupportPackageIsVersion4 - -// Client API for Cache service - -type CacheClient interface { - // friendInfo - GetFriendIDListFromCache(ctx context.Context, in *GetFriendIDListFromCacheReq, opts ...grpc.CallOption) (*GetFriendIDListFromCacheResp, error) - // for dtm - DelFriendIDListFromCache(ctx context.Context, in *DelFriendIDListFromCacheReq, opts ...grpc.CallOption) (*DelFriendIDListFromCacheResp, error) - // blackList - GetBlackIDListFromCache(ctx context.Context, in *GetBlackIDListFromCacheReq, opts ...grpc.CallOption) (*GetBlackIDListFromCacheResp, error) - // for dtm - DelBlackIDListFromCache(ctx context.Context, in *DelBlackIDListFromCacheReq, opts ...grpc.CallOption) (*DelBlackIDListFromCacheResp, error) - // group - GetGroupMemberIDListFromCache(ctx context.Context, in *GetGroupMemberIDListFromCacheReq, opts ...grpc.CallOption) (*GetGroupMemberIDListFromCacheResp, error) - // for dtm - DelGroupMemberIDListFromCache(ctx context.Context, in *DelGroupMemberIDListFromCacheReq, opts ...grpc.CallOption) (*DelGroupMemberIDListFromCacheResp, error) -} - -type cacheClient struct { - cc *grpc.ClientConn -} - -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 := grpc.Invoke(ctx, "/cache.cache/GetFriendIDListFromCache", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cacheClient) DelFriendIDListFromCache(ctx context.Context, in *DelFriendIDListFromCacheReq, opts ...grpc.CallOption) (*DelFriendIDListFromCacheResp, error) { - out := new(DelFriendIDListFromCacheResp) - err := grpc.Invoke(ctx, "/cache.cache/DelFriendIDListFromCache", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cacheClient) GetBlackIDListFromCache(ctx context.Context, in *GetBlackIDListFromCacheReq, opts ...grpc.CallOption) (*GetBlackIDListFromCacheResp, error) { - out := new(GetBlackIDListFromCacheResp) - err := grpc.Invoke(ctx, "/cache.cache/GetBlackIDListFromCache", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cacheClient) DelBlackIDListFromCache(ctx context.Context, in *DelBlackIDListFromCacheReq, opts ...grpc.CallOption) (*DelBlackIDListFromCacheResp, error) { - out := new(DelBlackIDListFromCacheResp) - err := grpc.Invoke(ctx, "/cache.cache/DelBlackIDListFromCache", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cacheClient) GetGroupMemberIDListFromCache(ctx context.Context, in *GetGroupMemberIDListFromCacheReq, opts ...grpc.CallOption) (*GetGroupMemberIDListFromCacheResp, error) { - out := new(GetGroupMemberIDListFromCacheResp) - err := grpc.Invoke(ctx, "/cache.cache/GetGroupMemberIDListFromCache", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *cacheClient) DelGroupMemberIDListFromCache(ctx context.Context, in *DelGroupMemberIDListFromCacheReq, opts ...grpc.CallOption) (*DelGroupMemberIDListFromCacheResp, error) { - out := new(DelGroupMemberIDListFromCacheResp) - err := grpc.Invoke(ctx, "/cache.cache/DelGroupMemberIDListFromCache", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Cache service - -type CacheServer interface { - // friendInfo - GetFriendIDListFromCache(context.Context, *GetFriendIDListFromCacheReq) (*GetFriendIDListFromCacheResp, error) - // for dtm - DelFriendIDListFromCache(context.Context, *DelFriendIDListFromCacheReq) (*DelFriendIDListFromCacheResp, error) - // blackList - GetBlackIDListFromCache(context.Context, *GetBlackIDListFromCacheReq) (*GetBlackIDListFromCacheResp, error) - // for dtm - DelBlackIDListFromCache(context.Context, *DelBlackIDListFromCacheReq) (*DelBlackIDListFromCacheResp, error) - // group - GetGroupMemberIDListFromCache(context.Context, *GetGroupMemberIDListFromCacheReq) (*GetGroupMemberIDListFromCacheResp, error) - // for dtm - DelGroupMemberIDListFromCache(context.Context, *DelGroupMemberIDListFromCacheReq) (*DelGroupMemberIDListFromCacheResp, error) -} - -func RegisterCacheServer(s *grpc.Server, srv CacheServer) { - s.RegisterService(&_Cache_serviceDesc, srv) -} - -func _Cache_GetFriendIDListFromCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFriendIDListFromCacheReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CacheServer).GetFriendIDListFromCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cache.cache/GetFriendIDListFromCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CacheServer).GetFriendIDListFromCache(ctx, req.(*GetFriendIDListFromCacheReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cache_DelFriendIDListFromCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DelFriendIDListFromCacheReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CacheServer).DelFriendIDListFromCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cache.cache/DelFriendIDListFromCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CacheServer).DelFriendIDListFromCache(ctx, req.(*DelFriendIDListFromCacheReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cache_GetBlackIDListFromCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBlackIDListFromCacheReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CacheServer).GetBlackIDListFromCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cache.cache/GetBlackIDListFromCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CacheServer).GetBlackIDListFromCache(ctx, req.(*GetBlackIDListFromCacheReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cache_DelBlackIDListFromCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DelBlackIDListFromCacheReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CacheServer).DelBlackIDListFromCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cache.cache/DelBlackIDListFromCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CacheServer).DelBlackIDListFromCache(ctx, req.(*DelBlackIDListFromCacheReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cache_GetGroupMemberIDListFromCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetGroupMemberIDListFromCacheReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CacheServer).GetGroupMemberIDListFromCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cache.cache/GetGroupMemberIDListFromCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CacheServer).GetGroupMemberIDListFromCache(ctx, req.(*GetGroupMemberIDListFromCacheReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Cache_DelGroupMemberIDListFromCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DelGroupMemberIDListFromCacheReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CacheServer).DelGroupMemberIDListFromCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cache.cache/DelGroupMemberIDListFromCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CacheServer).DelGroupMemberIDListFromCache(ctx, req.(*DelGroupMemberIDListFromCacheReq)) - } - return interceptor(ctx, in, info, handler) -} - -var _Cache_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cache.cache", - HandlerType: (*CacheServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetFriendIDListFromCache", - Handler: _Cache_GetFriendIDListFromCache_Handler, - }, - { - MethodName: "DelFriendIDListFromCache", - Handler: _Cache_DelFriendIDListFromCache_Handler, - }, - { - MethodName: "GetBlackIDListFromCache", - Handler: _Cache_GetBlackIDListFromCache_Handler, - }, - { - MethodName: "DelBlackIDListFromCache", - Handler: _Cache_DelBlackIDListFromCache_Handler, - }, - { - MethodName: "GetGroupMemberIDListFromCache", - Handler: _Cache_GetGroupMemberIDListFromCache_Handler, - }, - { - MethodName: "DelGroupMemberIDListFromCache", - Handler: _Cache_DelGroupMemberIDListFromCache_Handler, - }, - }, - 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 deleted file mode 100644 index 09e960ae2..000000000 --- a/pkg/proto/cache/cache.proto +++ /dev/null @@ -1,85 +0,0 @@ -syntax = "proto3"; -import "Open-IM-Server/pkg/proto/sdk_ws/ws.proto"; -option go_package = "Open_IM/pkg/proto/cache;cache"; -package cache; - - -message GetFriendIDListFromCacheReq { - string userID = 1; - string operationID = 2; -} - -message GetFriendIDListFromCacheResp { - repeated string userIDList = 1; - server_api_params.CommonResp commonResp = 2; -} - -message DelFriendIDListFromCacheReq { - string userID = 1; - string operationID = 2; -} - -message DelFriendIDListFromCacheResp { - server_api_params.CommonResp commonResp = 1; -} - -message GetBlackIDListFromCacheReq { - string userID = 1; - string operationID = 2; -} - -message GetBlackIDListFromCacheResp { - repeated string userIDList = 1; - server_api_params.CommonResp commonResp = 2; -} - -message DelBlackIDListFromCacheReq { - string userID = 1; - string operationID = 2; -} - -message DelBlackIDListFromCacheResp { - server_api_params.CommonResp commonResp = 1; -} - -message GetGroupMemberIDListFromCacheReq { - string operationID = 1; - string groupID = 2; -} - -message GetGroupMemberIDListFromCacheResp { - server_api_params.CommonResp commonResp = 1; - repeated string userIDList = 2; -} - -message DelGroupMemberIDListFromCacheReq { - string groupID = 1; - string operationID = 2; -} - -message DelGroupMemberIDListFromCacheResp { - server_api_params.CommonResp commonResp = 1; -} - -service cache{ - - // friendInfo - rpc GetFriendIDListFromCache(GetFriendIDListFromCacheReq) returns(GetFriendIDListFromCacheResp); - - // for dtm - rpc DelFriendIDListFromCache(DelFriendIDListFromCacheReq) returns(DelFriendIDListFromCacheResp); - - // blackList - rpc GetBlackIDListFromCache(GetBlackIDListFromCacheReq) returns(GetBlackIDListFromCacheResp); - - // for dtm - rpc DelBlackIDListFromCache(DelBlackIDListFromCacheReq) returns (DelBlackIDListFromCacheResp); - - // group - rpc GetGroupMemberIDListFromCache(GetGroupMemberIDListFromCacheReq) returns(GetGroupMemberIDListFromCacheResp); - - // for dtm - rpc DelGroupMemberIDListFromCache(DelGroupMemberIDListFromCacheReq) returns(DelGroupMemberIDListFromCacheResp); -} - -