Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Optimizing RPC call #2993

Merged
merged 26 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ddf8b73
pb
withchao Dec 12, 2024
d8f671d
Merge branch 'openimsdk:main' into main
withchao Dec 12, 2024
f1b1d71
Merge branch 'openimsdk:main' into main
withchao Dec 16, 2024
6f169ec
fix: Modifying other fields while setting IsPrivateChat does not take…
withchao Dec 17, 2024
94cb0c0
Merge remote-tracking branch 'origin/main'
withchao Dec 17, 2024
569b92b
Merge branch 'openimsdk:main' into main
withchao Dec 17, 2024
d15414d
fix: quote message error revoke
withchao Dec 17, 2024
2c6f974
Merge remote-tracking branch 'origin/main'
withchao Dec 17, 2024
3753b81
Merge branch 'openimsdk:main' into main
withchao Dec 18, 2024
f03cbec
refactoring scheduled tasks
withchao Dec 18, 2024
705bc37
refactoring scheduled tasks
withchao Dec 19, 2024
8807597
refactoring scheduled tasks
withchao Dec 19, 2024
1949d6c
refactoring scheduled tasks
withchao Dec 19, 2024
86d5825
refactoring scheduled tasks
withchao Dec 19, 2024
46a8d17
refactoring scheduled tasks
withchao Dec 20, 2024
277354b
Merge branch 'openimsdk:main' into main
withchao Dec 20, 2024
9625cc5
rpc client
withchao Dec 20, 2024
d274d65
Merge branch 'openimsdk:main' into main
withchao Dec 23, 2024
a11dd60
rpc client
withchao Dec 23, 2024
774b3a0
rpc client
withchao Dec 23, 2024
fc6569b
rpc client
withchao Dec 23, 2024
a53fe0b
rpc client
withchao Dec 23, 2024
d9566e9
rpc client
withchao Dec 24, 2024
cf78df3
rpc client
withchao Dec 24, 2024
33457dc
rpc client
withchao Dec 24, 2024
6d017da
Merge remote-tracking branch 'origin/main' into rpc_client
withchao Dec 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/openimsdk/open-im-server/v3

go 1.22.7

toolchain go1.23.2

require (
firebase.google.com/go/v4 v4.14.1
github.com/dtm-labs/rockscache v0.1.1
Expand All @@ -14,8 +12,8 @@ require (
github.com/gorilla/websocket v1.5.1
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/mitchellh/mapstructure v1.5.0
github.com/openimsdk/protocol v0.0.72-alpha.67
github.com/openimsdk/tools v0.0.50-alpha.58
github.com/openimsdk/protocol v0.0.72-alpha.68
github.com/openimsdk/tools v0.0.50-alpha.60
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.18.0
github.com/stretchr/testify v1.9.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y=
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
github.com/openimsdk/gomake v0.0.15-alpha.2 h1:5Q8yl8ezy2yx+q8/ucU/t4kJnDfCzNOrkXcDACCqtyM=
github.com/openimsdk/gomake v0.0.15-alpha.2/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
github.com/openimsdk/protocol v0.0.72-alpha.67 h1:zlLbVkoT0OYsjO2RCutQuDFllcfNvZfdYchvlR6UIe0=
github.com/openimsdk/protocol v0.0.72-alpha.67/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
github.com/openimsdk/tools v0.0.50-alpha.58 h1:hkFL02Bzzp/l5x+tb7kJ9zes7hilh65EQ4qEIthsQX4=
github.com/openimsdk/tools v0.0.50-alpha.58/go.mod h1:muCtxguNJv8lFwLei27UASu2Nvg4ERSeN0R4K5tivk0=
github.com/openimsdk/protocol v0.0.72-alpha.68 h1:Ekn6S9Ftt12Xs/p9kJ39RDr2gSwIczz+MmSHQE4lAek=
github.com/openimsdk/protocol v0.0.72-alpha.68/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
github.com/openimsdk/tools v0.0.50-alpha.60 h1:dYqYpSdSN5o6CxlEjua2USfwfUiG0tUWFBpqghTjbWE=
github.com/openimsdk/tools v0.0.50-alpha.60/go.mod h1:muCtxguNJv8lFwLei27UASu2Nvg4ERSeN0R4K5tivk0=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
Expand Down
16 changes: 9 additions & 7 deletions internal/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@ import (
"github.com/openimsdk/tools/a2r"
)

type AuthApi struct{}
type AuthApi struct {
Client auth.AuthClient
}

func NewAuthApi() AuthApi {
return AuthApi{}
func NewAuthApi(client auth.AuthClient) AuthApi {
return AuthApi{client}
}

func (o *AuthApi) GetAdminToken(c *gin.Context) {
a2r.CallV2(c, auth.GetAdminTokenCaller.Invoke)
a2r.Call(c, auth.AuthClient.GetAdminToken, o.Client)
}

func (o *AuthApi) GetUserToken(c *gin.Context) {
a2r.CallV2(c, auth.GetUserTokenCaller.Invoke)
a2r.Call(c, auth.AuthClient.GetUserToken, o.Client)
}

func (o *AuthApi) ParseToken(c *gin.Context) {
a2r.CallV2(c, auth.ParseTokenCaller.Invoke)
a2r.Call(c, auth.AuthClient.ParseToken, o.Client)
}

func (o *AuthApi) ForceLogout(c *gin.Context) {
a2r.CallV2(c, auth.ForceLogoutCaller.Invoke)
a2r.Call(c, auth.AuthClient.ForceLogout, o.Client)
}
30 changes: 16 additions & 14 deletions internal/api/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,54 @@ import (
"github.com/openimsdk/tools/a2r"
)

type ConversationApi struct{}
type ConversationApi struct {
Client conversation.ConversationClient
}

func NewConversationApi() ConversationApi {
return ConversationApi{}
func NewConversationApi(client conversation.ConversationClient) ConversationApi {
return ConversationApi{client}
}

func (o *ConversationApi) GetAllConversations(c *gin.Context) {
a2r.CallV2(c, conversation.GetAllConversationsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetAllConversations, o.Client)
}

func (o *ConversationApi) GetSortedConversationList(c *gin.Context) {
a2r.CallV2(c, conversation.GetSortedConversationListCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetSortedConversationList, o.Client)
}

func (o *ConversationApi) GetConversation(c *gin.Context) {
a2r.CallV2(c, conversation.GetConversationCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetConversation, o.Client)
}

func (o *ConversationApi) GetConversations(c *gin.Context) {
a2r.CallV2(c, conversation.GetConversationsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetConversations, o.Client)
}

func (o *ConversationApi) SetConversations(c *gin.Context) {
a2r.CallV2(c, conversation.SetConversationsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.SetConversations, o.Client)
}

func (o *ConversationApi) GetConversationOfflinePushUserIDs(c *gin.Context) {
a2r.CallV2(c, conversation.GetConversationOfflinePushUserIDsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetConversationOfflinePushUserIDs, o.Client)
}

func (o *ConversationApi) GetFullOwnerConversationIDs(c *gin.Context) {
a2r.CallV2(c, conversation.GetFullOwnerConversationIDsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetFullOwnerConversationIDs, o.Client)
}

func (o *ConversationApi) GetIncrementalConversation(c *gin.Context) {
a2r.CallV2(c, conversation.GetIncrementalConversationCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetIncrementalConversation, o.Client)
}

func (o *ConversationApi) GetOwnerConversation(c *gin.Context) {
a2r.CallV2(c, conversation.GetOwnerConversationCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetOwnerConversation, o.Client)
}

func (o *ConversationApi) GetNotNotifyConversationIDs(c *gin.Context) {
a2r.CallV2(c, conversation.GetNotNotifyConversationIDsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetNotNotifyConversationIDs, o.Client)
}

func (o *ConversationApi) GetPinnedConversationIDs(c *gin.Context) {
a2r.CallV2(c, conversation.GetPinnedConversationIDsCaller.Invoke)
a2r.Call(c, conversation.ConversationClient.GetPinnedConversationIDs, o.Client)
}
50 changes: 26 additions & 24 deletions internal/api/friend.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,94 +21,96 @@ import (
"github.com/openimsdk/tools/a2r"
)

type FriendApi struct{}
type FriendApi struct {
Client relation.FriendClient
}

func NewFriendApi() FriendApi {
return FriendApi{}
func NewFriendApi(client relation.FriendClient) FriendApi {
return FriendApi{client}
}

func (o *FriendApi) ApplyToAddFriend(c *gin.Context) {
a2r.CallV2(c, relation.ApplyToAddFriendCaller.Invoke)
a2r.Call(c, relation.FriendClient.ApplyToAddFriend, o.Client)
}

func (o *FriendApi) RespondFriendApply(c *gin.Context) {
a2r.CallV2(c, relation.RespondFriendApplyCaller.Invoke)
a2r.Call(c, relation.FriendClient.RespondFriendApply, o.Client)
}

func (o *FriendApi) DeleteFriend(c *gin.Context) {
a2r.CallV2(c, relation.DeleteFriendCaller.Invoke)
a2r.Call(c, relation.FriendClient.DeleteFriend, o.Client)
}

func (o *FriendApi) GetFriendApplyList(c *gin.Context) {
a2r.CallV2(c, relation.GetPaginationFriendsApplyToCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetPaginationFriendsApplyTo, o.Client)
}

func (o *FriendApi) GetDesignatedFriendsApply(c *gin.Context) {
a2r.CallV2(c, relation.GetDesignatedFriendsApplyCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetDesignatedFriendsApply, o.Client)
}

func (o *FriendApi) GetSelfApplyList(c *gin.Context) {
a2r.CallV2(c, relation.GetPaginationFriendsApplyFromCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetPaginationFriendsApplyFrom, o.Client)
}

func (o *FriendApi) GetFriendList(c *gin.Context) {
a2r.CallV2(c, relation.GetPaginationFriendsCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetPaginationFriends, o.Client)
}

func (o *FriendApi) GetDesignatedFriends(c *gin.Context) {
a2r.CallV2(c, relation.GetDesignatedFriendsCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetDesignatedFriends, o.Client)
}

func (o *FriendApi) SetFriendRemark(c *gin.Context) {
a2r.CallV2(c, relation.SetFriendRemarkCaller.Invoke)
a2r.Call(c, relation.FriendClient.SetFriendRemark, o.Client)
}

func (o *FriendApi) AddBlack(c *gin.Context) {
a2r.CallV2(c, relation.AddBlackCaller.Invoke)
a2r.Call(c, relation.FriendClient.AddBlack, o.Client)
}

func (o *FriendApi) GetPaginationBlacks(c *gin.Context) {
a2r.CallV2(c, relation.GetPaginationBlacksCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetPaginationBlacks, o.Client)
}

func (o *FriendApi) GetSpecifiedBlacks(c *gin.Context) {
a2r.CallV2(c, relation.GetSpecifiedBlacksCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetSpecifiedBlacks, o.Client)
}

func (o *FriendApi) RemoveBlack(c *gin.Context) {
a2r.CallV2(c, relation.RemoveBlackCaller.Invoke)
a2r.Call(c, relation.FriendClient.RemoveBlack, o.Client)
}

func (o *FriendApi) ImportFriends(c *gin.Context) {
a2r.CallV2(c, relation.ImportFriendsCaller.Invoke)
a2r.Call(c, relation.FriendClient.ImportFriends, o.Client)
}

func (o *FriendApi) IsFriend(c *gin.Context) {
a2r.CallV2(c, relation.IsFriendCaller.Invoke)
a2r.Call(c, relation.FriendClient.IsFriend, o.Client)
}

func (o *FriendApi) GetFriendIDs(c *gin.Context) {
a2r.CallV2(c, relation.GetFriendIDsCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetFriendIDs, o.Client)
}

func (o *FriendApi) GetSpecifiedFriendsInfo(c *gin.Context) {
a2r.CallV2(c, relation.GetSpecifiedFriendsInfoCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetSpecifiedFriendsInfo, o.Client)
}

func (o *FriendApi) UpdateFriends(c *gin.Context) {
a2r.CallV2(c, relation.UpdateFriendsCaller.Invoke)
a2r.Call(c, relation.FriendClient.UpdateFriends, o.Client)
}

func (o *FriendApi) GetIncrementalFriends(c *gin.Context) {
a2r.CallV2(c, relation.GetIncrementalFriendsCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetIncrementalFriends, o.Client)
}

// GetIncrementalBlacks is temporarily unused.
// Deprecated: This function is currently unused and may be removed in future versions.
func (o *FriendApi) GetIncrementalBlacks(c *gin.Context) {
a2r.CallV2(c, relation.GetIncrementalBlacksCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetIncrementalBlacks, o.Client)
}

func (o *FriendApi) GetFullFriendUserIDs(c *gin.Context) {
a2r.CallV2(c, relation.GetFullFriendUserIDsCaller.Invoke)
a2r.Call(c, relation.FriendClient.GetFullFriendUserIDs, o.Client)
}
Loading
Loading