diff --git a/internal/push/push_rpc_server.go b/internal/push/push_rpc_server.go index d5d4c9242..a8bb18974 100644 --- a/internal/push/push_rpc_server.go +++ b/internal/push/push_rpc_server.go @@ -16,7 +16,6 @@ package push import ( "context" - "github.com/openimsdk/open-im-server/v3/pkg/rpccache" "github.com/OpenIMSDK/protocol/constant" pbpush "github.com/OpenIMSDK/protocol/push" @@ -26,6 +25,7 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/db/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/db/controller" + "github.com/openimsdk/open-im-server/v3/pkg/rpccache" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "google.golang.org/grpc" ) diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 2bf17eaf9..d7f30ebce 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "errors" - "github.com/openimsdk/open-im-server/v3/pkg/rpccache" "sync" "github.com/OpenIMSDK/protocol/constant" @@ -39,6 +38,7 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/common/db/controller" "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" + "github.com/openimsdk/open-im-server/v3/pkg/rpccache" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "golang.org/x/sync/errgroup" "google.golang.org/grpc" diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 81b4d9d45..91eec079b 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -528,7 +528,10 @@ func (c *conversationServer) getConversationInfo( return conversationMsg, nil } -func (c *conversationServer) GetConversationNotReceiveMessageUserIDs(ctx context.Context, req *pbconversation.GetConversationNotReceiveMessageUserIDsReq) (*pbconversation.GetConversationNotReceiveMessageUserIDsResp, error) { +func (c *conversationServer) GetConversationNotReceiveMessageUserIDs( + ctx context.Context, + req *pbconversation.GetConversationNotReceiveMessageUserIDsReq, +) (*pbconversation.GetConversationNotReceiveMessageUserIDsResp, error) { userIDs, err := c.conversationDatabase.GetConversationNotReceiveMessageUserIDs(ctx, req.ConversationID) if err != nil { return nil, err diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 9466c5224..6403a4159 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -16,31 +16,26 @@ package friend import ( "context" - "github.com/OpenIMSDK/tools/tx" - - "github.com/OpenIMSDK/protocol/sdkws" - - "github.com/openimsdk/open-im-server/v3/pkg/authverify" - - "github.com/OpenIMSDK/tools/log" - - "github.com/openimsdk/open-im-server/v3/pkg/common/convert" - "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" - - "google.golang.org/grpc" "github.com/OpenIMSDK/protocol/constant" pbfriend "github.com/OpenIMSDK/protocol/friend" + "github.com/OpenIMSDK/protocol/sdkws" registry "github.com/OpenIMSDK/tools/discoveryregistry" "github.com/OpenIMSDK/tools/errs" + "github.com/OpenIMSDK/tools/log" + "github.com/OpenIMSDK/tools/tx" "github.com/OpenIMSDK/tools/utils" + "github.com/openimsdk/open-im-server/v3/pkg/authverify" "github.com/openimsdk/open-im-server/v3/pkg/common/config" + "github.com/openimsdk/open-im-server/v3/pkg/common/convert" "github.com/openimsdk/open-im-server/v3/pkg/common/db/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/db/controller" "github.com/openimsdk/open-im-server/v3/pkg/common/db/mgo" tablerelation "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" "github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation" + "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient/notification" + "google.golang.org/grpc" ) type friendServer struct { diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 6212dea03..f2d735a70 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -15,8 +15,6 @@ package msg import ( - "github.com/openimsdk/open-im-server/v3/pkg/rpccache" - "github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/protocol/conversation" "github.com/OpenIMSDK/protocol/msg" @@ -25,6 +23,7 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/common/db/cache" "github.com/openimsdk/open-im-server/v3/pkg/common/db/controller" "github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation" + "github.com/openimsdk/open-im-server/v3/pkg/rpccache" "github.com/openimsdk/open-im-server/v3/pkg/rpcclient" "google.golang.org/grpc" ) diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index 318464cf8..bdaa7fd87 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -16,7 +16,6 @@ package msg import ( "context" - "github.com/OpenIMSDK/tools/log" "math/rand" "strconv" "time" @@ -25,6 +24,7 @@ import ( "github.com/OpenIMSDK/protocol/msg" "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/errs" + "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/utils" ) diff --git a/pkg/common/cachekey/black.go b/pkg/common/cachekey/black.go index 527ad14dc..7d2ee2771 100644 --- a/pkg/common/cachekey/black.go +++ b/pkg/common/cachekey/black.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package cachekey const ( diff --git a/pkg/common/cachekey/conversation.go b/pkg/common/cachekey/conversation.go index 665ca11c6..aea4ceec6 100644 --- a/pkg/common/cachekey/conversation.go +++ b/pkg/common/cachekey/conversation.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package cachekey const ( diff --git a/pkg/common/cachekey/friend.go b/pkg/common/cachekey/friend.go index f37c9da37..9691b1f5c 100644 --- a/pkg/common/cachekey/friend.go +++ b/pkg/common/cachekey/friend.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package cachekey const ( diff --git a/pkg/common/cachekey/group.go b/pkg/common/cachekey/group.go index 1dcf0ffce..681121ecb 100644 --- a/pkg/common/cachekey/group.go +++ b/pkg/common/cachekey/group.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package cachekey import ( diff --git a/pkg/common/cachekey/user.go b/pkg/common/cachekey/user.go index 3fb877e22..473ca1b12 100644 --- a/pkg/common/cachekey/user.go +++ b/pkg/common/cachekey/user.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package cachekey const ( diff --git a/pkg/common/config/parse_test.go b/pkg/common/config/parse_test.go index 9b964a277..35b019b83 100644 --- a/pkg/common/config/parse_test.go +++ b/pkg/common/config/parse_test.go @@ -17,10 +17,11 @@ package config import ( _ "embed" "fmt" - "gopkg.in/yaml.v3" "reflect" "testing" + "gopkg.in/yaml.v3" + "github.com/openimsdk/open-im-server/v3/pkg/msgprocessor" ) diff --git a/pkg/common/db/cache/black.go b/pkg/common/db/cache/black.go index fd743e917..a5304b4b0 100644 --- a/pkg/common/db/cache/black.go +++ b/pkg/common/db/cache/black.go @@ -16,12 +16,12 @@ package cache import ( "context" - "github.com/OpenIMSDK/tools/log" - "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "time" + "github.com/OpenIMSDK/tools/log" "github.com/dtm-labs/rockscache" + "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" "github.com/redis/go-redis/v9" ) diff --git a/pkg/common/db/cache/config.go b/pkg/common/db/cache/config.go index 7599d8a11..c760e0c03 100644 --- a/pkg/common/db/cache/config.go +++ b/pkg/common/db/cache/config.go @@ -1,10 +1,25 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package cache import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "strings" "sync" + + "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) var ( diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index ef725642c..c8f752cd3 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -16,15 +16,15 @@ package cache import ( "context" - "github.com/OpenIMSDK/tools/log" - "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "math/big" "strings" "time" + "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/utils" "github.com/dtm-labs/rockscache" + "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" "github.com/redis/go-redis/v9" ) @@ -37,7 +37,7 @@ const ( //recvMsgOptKey = "RECV_MSG_OPT:" //superGroupRecvMsgNotNotifyUserIDsKey = "SUPER_GROUP_RECV_MSG_NOT_NOTIFY_USER_IDS:" //superGroupRecvMsgNotNotifyUserIDsHashKey = "SUPER_GROUP_RECV_MSG_NOT_NOTIFY_USER_IDS_HASH:" - //conversationNotReceiveMessageUserIDsKey = "CONVERSATION_NOT_RECEIVE_MESSAGE_USER_IDS:" + //conversationNotReceiveMessageUserIDsKey = "CONVERSATION_NOT_RECEIVE_MESSAGE_USER_IDS:". conversationExpireTime = time.Second * 60 * 60 * 12 ) diff --git a/pkg/common/db/cache/friend.go b/pkg/common/db/cache/friend.go index 30b8bf7ea..2d20705ef 100644 --- a/pkg/common/db/cache/friend.go +++ b/pkg/common/db/cache/friend.go @@ -16,13 +16,13 @@ package cache import ( "context" - "github.com/OpenIMSDK/tools/log" - "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "time" + "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/utils" "github.com/dtm-labs/rockscache" + "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" "github.com/redis/go-redis/v9" ) @@ -31,7 +31,7 @@ const ( friendExpireTime = time.Second * 60 * 60 * 12 //friendIDsKey = "FRIEND_IDS:" //TwoWayFriendsIDsKey = "COMMON_FRIENDS_IDS:" - //friendKey = "FRIEND_INFO:" + //friendKey = "FRIEND_INFO:". ) // FriendCache is an interface for caching friend-related data. diff --git a/pkg/common/db/cache/group.go b/pkg/common/db/cache/group.go index 37b21ae90..7022461cb 100644 --- a/pkg/common/db/cache/group.go +++ b/pkg/common/db/cache/group.go @@ -17,8 +17,6 @@ package cache import ( "context" "fmt" - "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "time" "github.com/OpenIMSDK/protocol/constant" @@ -26,6 +24,8 @@ import ( "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/utils" "github.com/dtm-labs/rockscache" + "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" "github.com/redis/go-redis/v9" ) @@ -38,7 +38,7 @@ const ( //groupMemberInfoKey = "GROUP_MEMBER_INFO:" //joinedGroupsKey = "JOIN_GROUPS_KEY:" //groupMemberNumKey = "GROUP_MEMBER_NUM_CACHE:" - //groupRoleLevelMemberIDsKey = "GROUP_ROLE_LEVEL_MEMBER_IDS:" + //groupRoleLevelMemberIDsKey = "GROUP_ROLE_LEVEL_MEMBER_IDS:". ) type GroupHash interface { diff --git a/pkg/common/db/cache/meta_cache.go b/pkg/common/db/cache/meta_cache.go index b14851381..431b7c867 100644 --- a/pkg/common/db/cache/meta_cache.go +++ b/pkg/common/db/cache/meta_cache.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "errors" - "github.com/redis/go-redis/v9" "fmt" "time" @@ -27,6 +26,7 @@ import ( "github.com/OpenIMSDK/tools/mw/specialerror" "github.com/OpenIMSDK/tools/utils" "github.com/dtm-labs/rockscache" + "github.com/redis/go-redis/v9" ) const ( diff --git a/pkg/common/db/cache/msg.go b/pkg/common/db/cache/msg.go index eb79fdb70..b8e9dbc77 100644 --- a/pkg/common/db/cache/msg.go +++ b/pkg/common/db/cache/msg.go @@ -38,11 +38,11 @@ const ( conversationUserMinSeq = "CON_USER_MIN_SEQ:" hasReadSeq = "HAS_READ_SEQ:" - //appleDeviceToken = "DEVICE_TOKEN" + //appleDeviceToken = "DEVICE_TOKEN". getuiToken = "GETUI_TOKEN" getuiTaskID = "GETUI_TASK_ID" //signalCache = "SIGNAL_CACHE:" - //signalListCache = "SIGNAL_LIST_CACHE:" + //signalListCache = "SIGNAL_LIST_CACHE:". FCM_TOKEN = "FCM_TOKEN:" messageCache = "MESSAGE_CACHE:" diff --git a/pkg/common/db/cache/user.go b/pkg/common/db/cache/user.go index c081731ce..a60f55836 100644 --- a/pkg/common/db/cache/user.go +++ b/pkg/common/db/cache/user.go @@ -18,8 +18,6 @@ import ( "context" "encoding/json" "errors" - "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "hash/crc32" "strconv" "time" @@ -29,13 +27,15 @@ import ( "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" "github.com/dtm-labs/rockscache" + "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" + "github.com/openimsdk/open-im-server/v3/pkg/common/config" relationtb "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" "github.com/redis/go-redis/v9" ) const ( userExpireTime = time.Second * 60 * 60 * 12 - //userInfoKey = "USER_INFO:" + //userInfoKey = "USER_INFO:". userGlobalRecvMsgOptKey = "USER_GLOBAL_RECV_MSG_OPT_KEY:" olineStatusKey = "ONLINE_STATUS:" userOlineStatusExpireTime = time.Second * 60 * 60 * 24 diff --git a/pkg/common/redispubsub/redispubliser.go b/pkg/common/redispubsub/redispubliser.go index 822b25bf9..6e41af73a 100644 --- a/pkg/common/redispubsub/redispubliser.go +++ b/pkg/common/redispubsub/redispubliser.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package redispubsub import "github.com/redis/go-redis/v9" diff --git a/pkg/common/redispubsub/redissubscriber.go b/pkg/common/redispubsub/redissubscriber.go index a7029a993..aea99b318 100644 --- a/pkg/common/redispubsub/redissubscriber.go +++ b/pkg/common/redispubsub/redissubscriber.go @@ -1,7 +1,22 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package redispubsub import ( "context" + "github.com/redis/go-redis/v9" ) diff --git a/pkg/localcache/cache.go b/pkg/localcache/cache.go index 4b405b46a..91c490922 100644 --- a/pkg/localcache/cache.go +++ b/pkg/localcache/cache.go @@ -1,11 +1,26 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package localcache import ( "context" - "github.com/openimsdk/localcache/link" - "github.com/openimsdk/localcache/lru" "hash/fnv" "unsafe" + + "github.com/openimsdk/localcache/link" + "github.com/openimsdk/localcache/lru" ) type Cache[V any] interface { diff --git a/pkg/localcache/cache_test.go b/pkg/localcache/cache_test.go index c497b7b4a..c206e6799 100644 --- a/pkg/localcache/cache_test.go +++ b/pkg/localcache/cache_test.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package localcache import ( diff --git a/pkg/localcache/link/link.go b/pkg/localcache/link/link.go index 4f238907b..8c7701506 100644 --- a/pkg/localcache/link/link.go +++ b/pkg/localcache/link/link.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package link import ( diff --git a/pkg/localcache/link/link_test.go b/pkg/localcache/link/link_test.go index ed684e693..bb9fee6a0 100644 --- a/pkg/localcache/link/link_test.go +++ b/pkg/localcache/link/link_test.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package link import ( diff --git a/pkg/localcache/lru/lru.go b/pkg/localcache/lru/lru.go index 2995ec028..64280f238 100644 --- a/pkg/localcache/lru/lru.go +++ b/pkg/localcache/lru/lru.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lru import "github.com/hashicorp/golang-lru/v2/simplelru" diff --git a/pkg/localcache/lru/lru_expiration.go b/pkg/localcache/lru/lru_expiration.go index 3cf61f061..970ac083e 100644 --- a/pkg/localcache/lru/lru_expiration.go +++ b/pkg/localcache/lru/lru_expiration.go @@ -1,9 +1,24 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lru import ( - "github.com/hashicorp/golang-lru/v2/expirable" "sync" "time" + + "github.com/hashicorp/golang-lru/v2/expirable" ) func NewExpirationLRU[K comparable, V any](size int, successTTL, failedTTL time.Duration, target Target, onEvict EvictCallback[K, V]) LRU[K, V] { diff --git a/pkg/localcache/lru/lru_lazy.go b/pkg/localcache/lru/lru_lazy.go index a9270ea4a..d6e64aae4 100644 --- a/pkg/localcache/lru/lru_lazy.go +++ b/pkg/localcache/lru/lru_lazy.go @@ -1,9 +1,24 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lru import ( - "github.com/hashicorp/golang-lru/v2/simplelru" "sync" "time" + + "github.com/hashicorp/golang-lru/v2/simplelru" ) type layLruItem[V any] struct { diff --git a/pkg/localcache/lru/lru_lazy_test.go b/pkg/localcache/lru/lru_lazy_test.go index 09fd04cd3..167dd2135 100644 --- a/pkg/localcache/lru/lru_lazy_test.go +++ b/pkg/localcache/lru/lru_lazy_test.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lru import ( diff --git a/pkg/localcache/lru/lru_slot.go b/pkg/localcache/lru/lru_slot.go index c1b8b94d0..d034e94d3 100644 --- a/pkg/localcache/lru/lru_slot.go +++ b/pkg/localcache/lru/lru_slot.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lru func NewSlotLRU[K comparable, V any](slotNum int, hash func(K) uint64, create func() LRU[K, V]) LRU[K, V] { diff --git a/pkg/localcache/option.go b/pkg/localcache/option.go index ecb5da0e6..e60d5aa07 100644 --- a/pkg/localcache/option.go +++ b/pkg/localcache/option.go @@ -1,9 +1,24 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package localcache import ( "context" - "github.com/openimsdk/localcache/lru" "time" + + "github.com/openimsdk/localcache/lru" ) func defaultOption() *option { diff --git a/pkg/localcache/tool.go b/pkg/localcache/tool.go index ea3590823..ec04ea990 100644 --- a/pkg/localcache/tool.go +++ b/pkg/localcache/tool.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package localcache func AnyValue[V any](v any, err error) (V, error) { diff --git a/pkg/rpccache/common.go b/pkg/rpccache/common.go index 6dc826e30..5ed007edc 100644 --- a/pkg/rpccache/common.go +++ b/pkg/rpccache/common.go @@ -1,3 +1,17 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rpccache func newListMap[V comparable](values []V, err error) (*listMap[V], error) { diff --git a/pkg/rpccache/conversation.go b/pkg/rpccache/conversation.go index ae77b29b7..027ef42fa 100644 --- a/pkg/rpccache/conversation.go +++ b/pkg/rpccache/conversation.go @@ -1,7 +1,22 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rpccache import ( "context" + pbconversation "github.com/OpenIMSDK/protocol/conversation" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" diff --git a/pkg/rpccache/friend.go b/pkg/rpccache/friend.go index 66694f618..35122fff5 100644 --- a/pkg/rpccache/friend.go +++ b/pkg/rpccache/friend.go @@ -1,7 +1,22 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rpccache import ( "context" + "github.com/OpenIMSDK/tools/log" "github.com/openimsdk/localcache" "github.com/openimsdk/open-im-server/v3/pkg/common/cachekey" @@ -49,7 +64,7 @@ func (f *FriendLocalCache) IsFriend(ctx context.Context, possibleFriendUserID, u }, cachekey.GetFriendIDsKey(possibleFriendUserID))) } -// IsBlack possibleBlackUserID selfUserID +// IsBlack possibleBlackUserID selfUserID. func (f *FriendLocalCache) IsBlack(ctx context.Context, possibleBlackUserID, userID string) (val bool, err error) { log.ZDebug(ctx, "FriendLocalCache IsBlack req", "possibleBlackUserID", possibleBlackUserID, "userID", userID) defer func() { diff --git a/pkg/rpccache/group.go b/pkg/rpccache/group.go index b3c666da4..402f63185 100644 --- a/pkg/rpccache/group.go +++ b/pkg/rpccache/group.go @@ -1,7 +1,22 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rpccache import ( "context" + "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" diff --git a/pkg/rpccache/subscriber.go b/pkg/rpccache/subscriber.go index 571ff6d2d..cd65094e2 100644 --- a/pkg/rpccache/subscriber.go +++ b/pkg/rpccache/subscriber.go @@ -1,8 +1,23 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rpccache import ( "context" "encoding/json" + "github.com/OpenIMSDK/tools/log" "github.com/redis/go-redis/v9" ) diff --git a/pkg/rpccache/user.go b/pkg/rpccache/user.go index 7d6cd5c7e..c48b05821 100644 --- a/pkg/rpccache/user.go +++ b/pkg/rpccache/user.go @@ -1,7 +1,22 @@ +// Copyright © 2024 OpenIM. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package rpccache import ( "context" + "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" diff --git a/tools/component/component.go b/tools/component/component.go index f926f5e40..3220f36f7 100644 --- a/tools/component/component.go +++ b/tools/component/component.go @@ -30,8 +30,9 @@ import ( "github.com/OpenIMSDK/tools/component" "github.com/OpenIMSDK/tools/errs" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" "gopkg.in/yaml.v3" + + "github.com/openimsdk/open-im-server/v3/pkg/common/config" ) const (