mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 17:45:59 +08:00
* feat: Add light mode and dark mode.(#89) Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: make file code len Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: fix scripts support win Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: make build issue Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: golint and format Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * feat: add scripts sudo limits of authority Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: docker images fix Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> * fix: docker images fix Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Vendored
+3
-3
@@ -29,13 +29,13 @@ const (
|
||||
blackExpireTime = time.Second * 60 * 60 * 12
|
||||
)
|
||||
|
||||
// args fn will exec when no data in msgCache
|
||||
// args fn will exec when no data in msgCache.
|
||||
type BlackCache interface {
|
||||
//get blackIDs from msgCache
|
||||
// get blackIDs from msgCache
|
||||
metaCache
|
||||
NewCache() BlackCache
|
||||
GetBlackIDs(ctx context.Context, userID string) (blackIDs []string, err error)
|
||||
//del user's blackIDs msgCache, exec when a user's black list changed
|
||||
// del user's blackIDs msgCache, exec when a user's black list changed
|
||||
DelBlackIDs(ctx context.Context, userID string) BlackCache
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -41,7 +41,7 @@ const (
|
||||
conversationExpireTime = time.Second * 60 * 60 * 12
|
||||
)
|
||||
|
||||
// arg fn will exec when no data in msgCache
|
||||
// arg fn will exec when no data in msgCache.
|
||||
type ConversationCache interface {
|
||||
metaCache
|
||||
NewCache() ConversationCache
|
||||
|
||||
Vendored
+2
-2
@@ -32,7 +32,7 @@ const (
|
||||
friendKey = "FRIEND_INFO:"
|
||||
)
|
||||
|
||||
// args fn will exec when no data in msgCache
|
||||
// args fn will exec when no data in msgCache.
|
||||
type FriendCache interface {
|
||||
metaCache
|
||||
NewCache() FriendCache
|
||||
@@ -109,7 +109,7 @@ func (f *FriendCacheRedis) DelFriendIDs(ownerUserID ...string) FriendCache {
|
||||
return new
|
||||
}
|
||||
|
||||
// todo
|
||||
// todo.
|
||||
func (f *FriendCacheRedis) GetTwoWayFriendIDs(
|
||||
ctx context.Context,
|
||||
ownerUserID string,
|
||||
|
||||
Vendored
+6
-5
@@ -106,7 +106,8 @@ func NewGroupCacheRedis(
|
||||
opts rockscache.Options,
|
||||
) GroupCache {
|
||||
rcClient := rockscache.NewClient(rdb, opts)
|
||||
return &GroupCacheRedis{rcClient: rcClient, expireTime: groupExpireTime,
|
||||
return &GroupCacheRedis{
|
||||
rcClient: rcClient, expireTime: groupExpireTime,
|
||||
groupDB: groupDB, groupMemberDB: groupMemberDB, groupRequestDB: groupRequestDB,
|
||||
mongoDB: mongoClient, metaCache: NewMetaCacheRedis(rcClient),
|
||||
}
|
||||
@@ -176,7 +177,7 @@ func (g *GroupCacheRedis) GetGroupMemberIndex(groupMember *relationTb.GroupMembe
|
||||
return 0, errIndex
|
||||
}
|
||||
|
||||
// / groupInfo
|
||||
// / groupInfo.
|
||||
func (g *GroupCacheRedis) GetGroupsInfo(
|
||||
ctx context.Context,
|
||||
groupIDs []string,
|
||||
@@ -265,7 +266,7 @@ func (g *GroupCacheRedis) GetSuperGroupMemberIDs(
|
||||
)
|
||||
}
|
||||
|
||||
// userJoinSuperGroup
|
||||
// userJoinSuperGroup.
|
||||
func (g *GroupCacheRedis) DelJoinedSuperGroupIDs(userIDs ...string) GroupCache {
|
||||
new := g.NewCache()
|
||||
var keys []string
|
||||
@@ -286,7 +287,7 @@ func (g *GroupCacheRedis) DelSuperGroupMemberIDs(groupIDs ...string) GroupCache
|
||||
return new
|
||||
}
|
||||
|
||||
// groupMembersHash
|
||||
// groupMembersHash.
|
||||
func (g *GroupCacheRedis) GetGroupMembersHash(ctx context.Context, groupID string) (hashCode uint64, err error) {
|
||||
return getCache(
|
||||
ctx,
|
||||
@@ -331,7 +332,7 @@ func (g *GroupCacheRedis) DelGroupMembersHash(groupID string) GroupCache {
|
||||
return cache
|
||||
}
|
||||
|
||||
// groupMemberIDs
|
||||
// groupMemberIDs.
|
||||
func (g *GroupCacheRedis) GetGroupMemberIDs(ctx context.Context, groupID string) (groupMemberIDs []string, err error) {
|
||||
return getCache(
|
||||
ctx,
|
||||
|
||||
Vendored
+2
-2
@@ -28,10 +28,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
maxRetry = 10 //number of retries
|
||||
maxRetry = 10 // number of retries
|
||||
)
|
||||
|
||||
// NewRedis Initialize redis connection
|
||||
// NewRedis Initialize redis connection.
|
||||
func NewRedis() (redis.UniversalClient, error) {
|
||||
if len(config.Config.Redis.Address) == 0 {
|
||||
return nil, errors.New("redis address is empty")
|
||||
|
||||
+3
-2
@@ -16,11 +16,12 @@ package cache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"testing"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
)
|
||||
|
||||
//TestNewRedis Test redis connection
|
||||
// TestNewRedis Test redis connection
|
||||
func TestNewRedis(t *testing.T) {
|
||||
err := config.InitConfig("config_folder_path")
|
||||
if err != nil {
|
||||
|
||||
Vendored
+3
-1
@@ -212,6 +212,7 @@ func (c *msgCache) GetMaxSeqs(ctx context.Context, conversationIDs []string) (m
|
||||
func (c *msgCache) GetMaxSeq(ctx context.Context, conversationID string) (int64, error) {
|
||||
return c.getSeq(ctx, conversationID, c.getMaxSeqKey)
|
||||
}
|
||||
|
||||
func (c *msgCache) SetMinSeq(ctx context.Context, conversationID string, minSeq int64) error {
|
||||
return c.setSeq(ctx, conversationID, minSeq, c.getMinSeqKey)
|
||||
}
|
||||
@@ -235,6 +236,7 @@ func (c *msgCache) SetMinSeqs(ctx context.Context, seqs map[string]int64) error
|
||||
func (c *msgCache) GetMinSeqs(ctx context.Context, conversationIDs []string) (map[string]int64, error) {
|
||||
return c.getSeqs(ctx, conversationIDs, c.getMinSeqKey)
|
||||
}
|
||||
|
||||
func (c *msgCache) GetMinSeq(ctx context.Context, conversationID string) (int64, error) {
|
||||
return c.getSeq(ctx, conversationID, c.getMinSeqKey)
|
||||
}
|
||||
@@ -359,7 +361,7 @@ func (c *msgCache) GetMessagesBySeq(
|
||||
) (seqMsgs []*sdkws.MsgData, failedSeqs []int64, err error) {
|
||||
pipe := c.rdb.Pipeline()
|
||||
for _, v := range seqs {
|
||||
//MESSAGE_CACHE:169.254.225.224_reliability1653387820_0_1
|
||||
// MESSAGE_CACHE:169.254.225.224_reliability1653387820_0_1
|
||||
key := c.getMessageCacheKey(conversationID, v)
|
||||
if err := pipe.Get(ctx, key).Err(); err != nil && err != redis.Nil {
|
||||
return nil, nil, err
|
||||
|
||||
Reference in New Issue
Block a user