From 2b041d8f6a71efc73159051b9c3f53a46ebc0777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=85=BE=E5=AE=87?= <2631223275@qq.com> Date: Tue, 11 Jul 2023 17:34:39 +0800 Subject: [PATCH 01/20] Add database retry --- pkg/common/db/relation/mysql_init.go | 33 ++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/pkg/common/db/relation/mysql_init.go b/pkg/common/db/relation/mysql_init.go index 67419c7bf..fe467b675 100644 --- a/pkg/common/db/relation/mysql_init.go +++ b/pkg/common/db/relation/mysql_init.go @@ -30,16 +30,18 @@ import ( "gorm.io/gorm/logger" ) +const ( + maxRetry = 100 +) + +//newMysqlGormDB Initialize the database connection func newMysqlGormDB() (*gorm.DB, error) { dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local", config.Config.Mysql.Username, config.Config.Mysql.Password, config.Config.Mysql.Address[0], "mysql") - db, err := gorm.Open(mysql.Open(dsn), nil) + + db, err := connectToDatabase(dsn, maxRetry) if err != nil { - time.Sleep(time.Duration(30) * time.Second) - db, err = gorm.Open(mysql.Open(dsn), nil) - if err != nil { - panic(err.Error() + " open failed " + dsn) - } + panic(err.Error() + " Open failed " + dsn) } sqlDB, err := db.DB() if err != nil { @@ -82,7 +84,24 @@ func newMysqlGormDB() (*gorm.DB, error) { return db, nil } -// gorm mysql +//connectToDatabase Connection retry for mysql +func connectToDatabase(dsn string, maxRetry int) (*gorm.DB, error) { + var db *gorm.DB + var err error + for i := 0; i <= maxRetry; i++ { + db, err = gorm.Open(mysql.Open(dsn), nil) + if err == nil { + return db, nil + } + if mysqlErr, ok := err.(*mysqlDriver.MySQLError); ok && mysqlErr.Number == 1045 { + return nil, err + } + time.Sleep(time.Duration(1) * time.Second) + } + return nil, err +} + +// NewGormDB gorm mysql func NewGormDB() (*gorm.DB, error) { specialerror.AddReplace(gorm.ErrRecordNotFound, errs.ErrRecordNotFound) specialerror.AddErrHandler(replaceDuplicateKey) From 2693db218ad2224a749a2b21dcc14a48502a2fac Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Wed, 12 Jul 2023 11:35:06 +0800 Subject: [PATCH 02/20] For "add database retry" add test --- pkg/common/db/relation/mysql_init.go | 2 +- pkg/common/db/relation/mysql_init_test.go | 37 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 pkg/common/db/relation/mysql_init_test.go diff --git a/pkg/common/db/relation/mysql_init.go b/pkg/common/db/relation/mysql_init.go index fe467b675..8586ac338 100644 --- a/pkg/common/db/relation/mysql_init.go +++ b/pkg/common/db/relation/mysql_init.go @@ -31,7 +31,7 @@ import ( ) const ( - maxRetry = 100 + maxRetry = 100 //number of retries ) //newMysqlGormDB Initialize the database connection diff --git a/pkg/common/db/relation/mysql_init_test.go b/pkg/common/db/relation/mysql_init_test.go new file mode 100644 index 000000000..c6fd3e14b --- /dev/null +++ b/pkg/common/db/relation/mysql_init_test.go @@ -0,0 +1,37 @@ +// Copyright © 2023 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 relation + +import ( + "fmt" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "testing" +) + +//TestNewGormDB Test the retry of sporadic errors and the direct exit of wrong password. +func TestNewGormDB(t *testing.T) { + err := config.InitConfig("config_folder_path") + if err != nil { + return + } + db, err := newMysqlGormDB() + if err != nil { + fmt.Println("password error") + return + } + if db != nil { + fmt.Println("success connect") + } +} From 6bc369ed0087ff50afa98ba337baf816616205bf Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Wed, 12 Jul 2023 11:43:30 +0800 Subject: [PATCH 03/20] For "add database retry" add test --- pkg/common/db/relation/mysql_init_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/common/db/relation/mysql_init_test.go b/pkg/common/db/relation/mysql_init_test.go index c6fd3e14b..a4f38f7bc 100644 --- a/pkg/common/db/relation/mysql_init_test.go +++ b/pkg/common/db/relation/mysql_init_test.go @@ -24,6 +24,7 @@ import ( func TestNewGormDB(t *testing.T) { err := config.InitConfig("config_folder_path") if err != nil { + fmt.Println("config load error") return } db, err := newMysqlGormDB() From 2f5bcf1cf71a683620b0cd6c3e0918f939e03dfe Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Wed, 12 Jul 2023 11:53:22 +0800 Subject: [PATCH 04/20] For 'add database retry' add test Signed-off-by: plutoyty <2631223275@qq.com> --- .idea/.gitignore | 8 ++++++++ .idea/Open-IM-Server.iml | 9 +++++++++ .idea/modules.xml | 8 ++++++++ .idea/restkit/RESTKit_CommonSetting.xml | 6 ++++++ .idea/restkit/RESTKit_Environment.xml | 6 ++++++ .idea/restkit/RESTKit_RequestSetting.xml | 7 +++++++ .idea/vcs.xml | 6 ++++++ 7 files changed, 50 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Open-IM-Server.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/restkit/RESTKit_CommonSetting.xml create mode 100644 .idea/restkit/RESTKit_Environment.xml create mode 100644 .idea/restkit/RESTKit_RequestSetting.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..35410cacd --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Open-IM-Server.iml b/.idea/Open-IM-Server.iml new file mode 100644 index 000000000..5e764c4f0 --- /dev/null +++ b/.idea/Open-IM-Server.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..d9805dbb6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/restkit/RESTKit_CommonSetting.xml b/.idea/restkit/RESTKit_CommonSetting.xml new file mode 100644 index 000000000..26e6a792c --- /dev/null +++ b/.idea/restkit/RESTKit_CommonSetting.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/restkit/RESTKit_Environment.xml b/.idea/restkit/RESTKit_Environment.xml new file mode 100644 index 000000000..cb8704de7 --- /dev/null +++ b/.idea/restkit/RESTKit_Environment.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/restkit/RESTKit_RequestSetting.xml b/.idea/restkit/RESTKit_RequestSetting.xml new file mode 100644 index 000000000..6e47d4d1b --- /dev/null +++ b/.idea/restkit/RESTKit_RequestSetting.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From a735a70a7b8e3204bfc15da7eb9fb02a133e9bf8 Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Wed, 12 Jul 2023 12:05:32 +0800 Subject: [PATCH 05/20] Remove .idea directory and add it to .gitignore --- .idea/.gitignore | 8 -------- .idea/Open-IM-Server.iml | 9 --------- .idea/modules.xml | 8 -------- .idea/restkit/RESTKit_CommonSetting.xml | 6 ------ .idea/restkit/RESTKit_Environment.xml | 6 ------ .idea/restkit/RESTKit_RequestSetting.xml | 7 ------- .idea/vcs.xml | 6 ------ 7 files changed, 50 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/Open-IM-Server.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/restkit/RESTKit_CommonSetting.xml delete mode 100644 .idea/restkit/RESTKit_Environment.xml delete mode 100644 .idea/restkit/RESTKit_RequestSetting.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 35410cacd..000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml -# 基于编辑器的 HTTP 客户端请求 -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/Open-IM-Server.iml b/.idea/Open-IM-Server.iml deleted file mode 100644 index 5e764c4f0..000000000 --- a/.idea/Open-IM-Server.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index d9805dbb6..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/restkit/RESTKit_CommonSetting.xml b/.idea/restkit/RESTKit_CommonSetting.xml deleted file mode 100644 index 26e6a792c..000000000 --- a/.idea/restkit/RESTKit_CommonSetting.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/restkit/RESTKit_Environment.xml b/.idea/restkit/RESTKit_Environment.xml deleted file mode 100644 index cb8704de7..000000000 --- a/.idea/restkit/RESTKit_Environment.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/restkit/RESTKit_RequestSetting.xml b/.idea/restkit/RESTKit_RequestSetting.xml deleted file mode 100644 index 6e47d4d1b..000000000 --- a/.idea/restkit/RESTKit_RequestSetting.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfb..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 35b1f75036c9939a894e6187c73ac2190ca07778 Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Wed, 12 Jul 2023 19:15:39 +0800 Subject: [PATCH 06/20] Add retry mechanism to mongoDB, Redis, Kafka --- .gitignore | 1 + config/config.yaml | 2 +- pkg/common/db/cache/init_redis.go | 31 ++++++++++++------- pkg/common/db/cache/init_redis_test.go | 30 +++++++++++++++++++ pkg/common/db/unrelation/extend_msg.go | 6 ++-- pkg/common/db/unrelation/mongo.go | 41 +++++++++++++++++--------- pkg/common/http/http_client.go | 21 +++++++++---- pkg/common/kafka/producer.go | 27 ++++++++++++++--- pkg/common/mw/gin.go | 9 +++--- 9 files changed, 125 insertions(+), 43 deletions(-) create mode 100644 pkg/common/db/cache/init_redis_test.go diff --git a/.gitignore b/.gitignore index 6e29bad2c..cabe1a427 100644 --- a/.gitignore +++ b/.gitignore @@ -389,3 +389,4 @@ Sessionx.vim [._]*.un~ # End of https://www.toptal.com/developers/gitignore/api/go,git,vim,tags,test,emacs,backup,jetbrains +.idea \ No newline at end of file diff --git a/config/config.yaml b/config/config.yaml index ea6f8772d..4ff0e44b7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -36,7 +36,7 @@ mysql: mongo: uri: #不为空则直接使用该值 address: [ 127.0.0.1:37017 ] #单机时为mongo地址,使用分片集群时,为mongos地址 - database: openIM_v3 #mongo db 默认即可 + database: openIM_v3 #mongo db 默认即可 username: root #用户名 password: openIM123 #密码 maxPoolSize: 100 diff --git a/pkg/common/db/cache/init_redis.go b/pkg/common/db/cache/init_redis.go index 72dfc8caf..be0431adf 100644 --- a/pkg/common/db/cache/init_redis.go +++ b/pkg/common/db/cache/init_redis.go @@ -27,6 +27,11 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" ) +const ( + maxRetry = 10 //number of retries +) + +// NewRedis Initialize redis connection func NewRedis() (redis.UniversalClient, error) { if len(config.Config.Redis.Address) == 0 { return nil, errors.New("redis address is empty") @@ -35,25 +40,29 @@ func NewRedis() (redis.UniversalClient, error) { var rdb redis.UniversalClient if len(config.Config.Redis.Address) > 1 { rdb = redis.NewClusterClient(&redis.ClusterOptions{ - Addrs: config.Config.Redis.Address, - Username: config.Config.Redis.Username, - Password: config.Config.Redis.Password, // no password set - PoolSize: 50, + Addrs: config.Config.Redis.Address, + Username: config.Config.Redis.Username, + Password: config.Config.Redis.Password, // no password set + PoolSize: 50, + MaxRetries: maxRetry, }) } else { rdb = redis.NewClient(&redis.Options{ - Addr: config.Config.Redis.Address[0], - Username: config.Config.Redis.Username, - Password: config.Config.Redis.Password, // no password set - DB: 0, // use default DB - PoolSize: 100, // 连接池大小 + Addr: config.Config.Redis.Address[0], + Username: config.Config.Redis.Username, + Password: config.Config.Redis.Password, // no password set + DB: 0, // use default DB + PoolSize: 100, // connection pool size + MaxRetries: maxRetry, }) } + + var err error = nil ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() - err := rdb.Ping(ctx).Err() + err = rdb.Ping(ctx).Err() if err != nil { return nil, fmt.Errorf("redis ping %w", err) } - return rdb, nil + return rdb, err } diff --git a/pkg/common/db/cache/init_redis_test.go b/pkg/common/db/cache/init_redis_test.go new file mode 100644 index 000000000..6f78a43bd --- /dev/null +++ b/pkg/common/db/cache/init_redis_test.go @@ -0,0 +1,30 @@ +// Copyright © 2023 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 ( + "fmt" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "testing" +) + +//TestNewRedis Test redis connection +func TestNewRedis(t *testing.T) { + err := config.InitConfig("config_folder_path") + if err != nil { + fmt.Println("config load error") + return + } +} diff --git a/pkg/common/db/unrelation/extend_msg.go b/pkg/common/db/unrelation/extend_msg.go index 17e0b2e19..77f65cbd2 100644 --- a/pkg/common/db/unrelation/extend_msg.go +++ b/pkg/common/db/unrelation/extend_msg.go @@ -100,7 +100,7 @@ func (e *ExtendMsgSetMongoDriver) GetExtendMsgSet( return &setList[0], nil } -// first modify msg +// InsertExtendMsg first modify msg. func (e *ExtendMsgSetMongoDriver) InsertExtendMsg( ctx context.Context, conversationID string, @@ -130,7 +130,7 @@ func (e *ExtendMsgSetMongoDriver) InsertExtendMsg( return utils.Wrap(err, "") } -// insert or update +// InsertOrUpdateReactionExtendMsgSet insert or update. func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet( ctx context.Context, conversationID string, @@ -163,7 +163,7 @@ func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet( return utils.Wrap(err, "") } -// delete TypeKey +// DeleteReactionExtendMsgSet delete TypeKey. func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet( ctx context.Context, conversationID string, diff --git a/pkg/common/db/unrelation/mongo.go b/pkg/common/db/unrelation/mongo.go index 51b9e4b7e..911edef3c 100644 --- a/pkg/common/db/unrelation/mongo.go +++ b/pkg/common/db/unrelation/mongo.go @@ -31,19 +31,21 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) +const ( + maxRetry = 10 //number of retries +) + type Mongo struct { db *mongo.Client } +// NewMongo Initialize MongoDB connection func NewMongo() (*Mongo, error) { specialerror.AddReplace(mongo.ErrNoDocuments, errs.ErrRecordNotFound) - uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" + url := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" if config.Config.Mongo.Uri != "" { - // example: - // mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize - uri = config.Config.Mongo.Uri + url = config.Config.Mongo.Uri } else { - //mongodb://mongodb1.example.com:27317,mongodb2.example.com:27017/?replicaSet=mySet&authSource=authDB mongodbHosts := "" for i, v := range config.Config.Mongo.Address { if i == len(config.Config.Mongo.Address)-1 { @@ -53,23 +55,34 @@ func NewMongo() (*Mongo, error) { } } if config.Config.Mongo.Password != "" && config.Config.Mongo.Username != "" { - uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", + url = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", config.Config.Mongo.Username, config.Config.Mongo.Password, mongodbHosts, config.Config.Mongo.Database, config.Config.Mongo.MaxPoolSize) } else { - uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&authSource=admin", + url = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&authSource=admin", mongodbHosts, config.Config.Mongo.Database, config.Config.Mongo.MaxPoolSize) } } - fmt.Println("mongo:", uri) - ctx, cancel := context.WithTimeout(context.Background(), time.Second*60) - defer cancel() - mongoClient, err := mongo.Connect(ctx, options.Client().ApplyURI(uri)) - if err != nil { - return nil, err + fmt.Println("mongo:", url) + var mongoClient *mongo.Client + var err error = nil + for i := 0; i <= maxRetry; i++ { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + defer cancel() + mongoClient, err = mongo.Connect(ctx, options.Client().ApplyURI(url)) + if err == nil { + return &Mongo{db: mongoClient}, nil + } + if cmdErr, ok := err.(mongo.CommandError); ok { + if cmdErr.Code == 13 || cmdErr.Code == 18 { + return nil, err + } else { + fmt.Printf("Failed to connect to MongoDB: %s\n", err) + } + } } - return &Mongo{db: mongoClient}, nil + return nil, err } func (m *Mongo) GetClient() *mongo.Client { diff --git a/pkg/common/http/http_client.go b/pkg/common/http/http_client.go index 72e3fae62..153deb30e 100644 --- a/pkg/common/http/http_client.go +++ b/pkg/common/http/http_client.go @@ -1,9 +1,18 @@ -/* -** description(""). -** copyright('open-im,www.open-im.io'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/5/27 10:31). - */package http +// Copyright © 2023 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 http import ( "bytes" diff --git a/pkg/common/kafka/producer.go b/pkg/common/kafka/producer.go index 4c4ebc460..a66ef3dba 100644 --- a/pkg/common/kafka/producer.go +++ b/pkg/common/kafka/producer.go @@ -17,12 +17,12 @@ package kafka import ( "context" "errors" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" log "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "time" "github.com/Shopify/sarama" "google.golang.org/protobuf/proto" @@ -30,6 +30,10 @@ import ( prome "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" ) +const ( + maxRetry = 10 //number of retries +) + var errEmptyMsg = errors.New("binary msg is empty") type Producer struct { @@ -39,6 +43,7 @@ type Producer struct { producer sarama.SyncProducer } +// NewKafkaProducer Initialize kafka producer func NewKafkaProducer(addr []string, topic string) *Producer { p := Producer{} p.config = sarama.NewConfig() //Instantiate a sarama Config @@ -53,9 +58,23 @@ func NewKafkaProducer(addr []string, topic string) *Producer { } p.addr = addr p.topic = topic - producer, err := sarama.NewSyncProducer(p.addr, p.config) //Initialize the client - if err != nil { - panic(err.Error()) + var producer sarama.SyncProducer + var err error + for i := 0; i <= maxRetry; i++ { + producer, err = sarama.NewSyncProducer(p.addr, p.config) //Initialize the client + if err == nil { + p.producer = producer + return &p + } + //TODO If the password is wrong, exit directly + //if packetErr, ok := err.(*sarama.PacketEncodingError); ok { + //if _, ok := packetErr.Err.(sarama.AuthenticationError); ok { + // fmt.Println("Kafka password is wrong.") + //} + //} else { + // fmt.Printf("Failed to create Kafka producer: %v\n", err) + //} + time.Sleep(time.Duration(1) * time.Second) } p.producer = producer return &p diff --git a/pkg/common/mw/gin.go b/pkg/common/mw/gin.go index 65f98dca3..a544c2a25 100644 --- a/pkg/common/mw/gin.go +++ b/pkg/common/mw/gin.go @@ -31,6 +31,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" ) +// CorsHandler gin cross-domain configuration. func CorsHandler() gin.HandlerFunc { return func(c *gin.Context) { c.Writer.Header().Set("Access-Control-Allow-Origin", "*") @@ -39,19 +40,19 @@ func CorsHandler() gin.HandlerFunc { c.Header( "Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers,Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma,FooBar", - ) // 跨域关键设置 让浏览器可以解析 + ) // Cross-domain key settings allow browsers to resolve. c.Header( "Access-Control-Max-Age", "172800", - ) // 缓存请求信息 单位为秒 + ) // Cache request information in seconds. c.Header( "Access-Control-Allow-Credentials", "false", - ) // 跨域请求是否需要带cookie信息 默认设置为true + ) // Whether cross-domain requests need to carry cookie information, the default setting is true. c.Header( "content-type", "application/json", - ) // 设置返回格式是json + ) // Set the return format to json. //Release all option pre-requests if c.Request.Method == http.MethodOptions { c.JSON(http.StatusOK, "Options Request!") From d41f2a7aef2802f9656241873b25d23ff391d30a Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Wed, 12 Jul 2023 20:21:52 +0800 Subject: [PATCH 07/20] Add retry mechanism to mongoDB, Redis, Kafka --- config/config.yaml | 59 +++++++++++++++++--------- pkg/common/db/cache/init_redis_test.go | 6 +++ pkg/common/kafka/producer.go | 3 ++ 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index a001c68c5..4ff0e44b7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -56,11 +56,14 @@ kafka: topic: "offlineMsgToMongoMysql" #不建议修改 msgToPush: topic: "msgToPush" #不建议修改 + msgToModify: + topic: "msgToModify" #不建议修改 consumerGroupID: #消费者组,不建议修改 msgToRedis: redis # msgToMongo: mongo # msgToMySql: mysql # msgToPush: push # + msgToModify: modify # rpc: @@ -73,26 +76,41 @@ api: listenIP: #默认为0.0.0.0 object: - enable: "minio" #使用minio - apiURL: "http://127.0.0.1:10002/object/" + enable: minio #使用minio + apiURL: http://127.0.0.1:10002/third/object minio: - bucket: "openim" #不建议修改 - endpoint: "http://127.0.0.1:10005" #minio对外服务的ip和端口,app要能访问此ip和端口 - accessKeyID: "root" #ID - secretAccessKey: "openIM123" #秘钥 - sessionToken: "" #token - cos: #tencent cos - bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" - secretID: "" - secretKey: "" - sessionToken: "" - oss: #ali oss - endpoint: "https://oss-cn-chengdu.aliyuncs.com" - bucket: "demo-9999999" - bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" - accessKeyID: "" - accessKeySecret: "" - sessionToken: "" + tempBucket: "openim" #不建议修改 + dataBucket: "openim" #不建议修改 + location: us-east-1 #不建议修改 + endpoint: http://127.0.0.1:10005 #minio对外服务的ip和端口,app要能访问此ip和端口 + accessKeyID: root #ID + secretAccessKey: openIM123 #秘钥 + isDistributedMod: false #是否分布式多硬盘部署,如果是多硬盘部署,需要修改为true + tencent: #tencent cos + appID: + region: + bucket: + secretID: + secretKey: + ali: #ali oss + regionID: + accessKeyID: + accessKeySecret: + stsEndpoint: + ossEndpoint: + bucket: + finalHost: + stsDurationSeconds: + OssRoleArn: + aws: + accessKeyID: + accessKeySecret: + region: + bucket: + finalHost: + roleArn: + externalId: + roleSessionName: rpcPort: #rpc服务端口,不建议修改,端口由脚本读取后传入程序,如启动多个程序,只需要填入多个端口,用逗号隔开,如 [10110, 10111] openImUserPort: [ 10110 ] @@ -164,8 +182,7 @@ groupMessageHasReadReceiptEnable: true #群聊已读是否开 singleMessageHasReadReceiptEnable: true #单聊已读是否开启 retainChatRecords: 365 #mongo保存离线消息时间(天) -chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期(超过retainChatRecords时间)消息,这个删除是为了清理满足上个配置retainChatRecords的过期消息,不会发送通知,仅仅作为清理磁盘使用 -msgDestructTime: "0 2 * * *" #消息自动删除时间,每天凌晨2点删除过期消息,这个删除是为了删除保留时间超过超过会话字段msg_destruct_time(秒)的消息。 +chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期(超过retainChatRecords时间)消息 secret: tuoyun #秘钥,获取token时校验 diff --git a/pkg/common/db/cache/init_redis_test.go b/pkg/common/db/cache/init_redis_test.go index 6f78a43bd..7bf1a4a7d 100644 --- a/pkg/common/db/cache/init_redis_test.go +++ b/pkg/common/db/cache/init_redis_test.go @@ -27,4 +27,10 @@ func TestNewRedis(t *testing.T) { fmt.Println("config load error") return } + redis, err := NewRedis() + if err != nil { + fmt.Println(err) + return + } + fmt.Println(redis) } diff --git a/pkg/common/kafka/producer.go b/pkg/common/kafka/producer.go index a66ef3dba..a749c76f8 100644 --- a/pkg/common/kafka/producer.go +++ b/pkg/common/kafka/producer.go @@ -76,6 +76,9 @@ func NewKafkaProducer(addr []string, topic string) *Producer { //} time.Sleep(time.Duration(1) * time.Second) } + if err != nil { + panic(err.Error()) + } p.producer = producer return &p } From 4cacc3f6216c01b390ea99a96c69e54d3be52cd8 Mon Sep 17 00:00:00 2001 From: WangchuXiao Date: Thu, 13 Jul 2023 15:26:25 +0800 Subject: [PATCH 08/20] fix bug: friend, args error (#534) * fix bug: args error * fix bug: args error * fix bug: add friend need update both request * fix bug: add friend need update both request --- internal/rpc/friend/friend.go | 2 +- pkg/common/constant/constant.go | 5 +++-- pkg/common/convert/black.go | 3 +++ pkg/common/convert/friend.go | 6 ++++++ pkg/common/db/controller/friend.go | 17 ++++++++++++++++- pkg/proto/group/group.go | 3 --- pkg/proto/msg/msg.go | 12 ------------ 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index c07b1423c..4c528d1d1 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -246,7 +246,6 @@ func (s *friendServer) GetPaginationFriendsApplyTo( req *pbfriend.GetPaginationFriendsApplyToReq, ) (resp *pbfriend.GetPaginationFriendsApplyToResp, err error) { defer log.ZInfo(ctx, utils.GetFuncName()+" Return") - resp = &pbfriend.GetPaginationFriendsApplyToResp{} if err := s.userRpcClient.Access(ctx, req.UserID); err != nil { return nil, err } @@ -255,6 +254,7 @@ func (s *friendServer) GetPaginationFriendsApplyTo( if err != nil { return nil, err } + resp = &pbfriend.GetPaginationFriendsApplyToResp{} resp.FriendRequests, err = convert.FriendRequestDB2Pb(ctx, friendRequests, s.userRpcClient.GetUsersInfoMap) if err != nil { return nil, err diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index ef33b9867..2e5432b48 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -291,8 +291,9 @@ const ( GroupResponseAgree = 1 GroupResponseRefuse = -1 - FriendResponseAgree = 1 - FriendResponseRefuse = -1 + FriendResponseNotHandle = 0 + FriendResponseAgree = 1 + FriendResponseRefuse = -1 Male = 1 Female = 2 diff --git a/pkg/common/convert/black.go b/pkg/common/convert/black.go index 684a40d0d..ba0e2a5da 100644 --- a/pkg/common/convert/black.go +++ b/pkg/common/convert/black.go @@ -27,6 +27,9 @@ func BlackDB2Pb( blackDBs []*relation.BlackModel, f func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error), ) (blackPbs []*sdk.BlackInfo, err error) { + if len(blackDBs) == 0 { + return nil, nil + } var userIDs []string for _, blackDB := range blackDBs { userIDs = append(userIDs, blackDB.BlockUserID) diff --git a/pkg/common/convert/friend.go b/pkg/common/convert/friend.go index 018aee42f..0531ad195 100644 --- a/pkg/common/convert/friend.go +++ b/pkg/common/convert/friend.go @@ -54,6 +54,9 @@ func FriendsDB2Pb( friendsDB []*relation.FriendModel, getUsers func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error), ) (friendsPb []*sdkws.FriendInfo, err error) { + if len(friendsDB) == 0 { + return nil, nil + } var userID []string for _, friendDB := range friendsDB { userID = append(userID, friendDB.FriendUserID) @@ -80,6 +83,9 @@ func FriendRequestDB2Pb( friendRequests []*relation.FriendRequestModel, getUsers func(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error), ) ([]*sdkws.FriendRequest, error) { + if len(friendRequests) == 0 { + return nil, nil + } userIDMap := make(map[string]struct{}) for _, friendRequest := range friendRequests { userIDMap[friendRequest.ToUserID] = struct{}{} diff --git a/pkg/common/db/controller/friend.go b/pkg/common/db/controller/friend.go index 116345219..4d549efcf 100644 --- a/pkg/common/db/controller/friend.go +++ b/pkg/common/db/controller/friend.go @@ -221,6 +221,7 @@ func (f *friendDatabase) AgreeFriendRequest( friendRequest *relation.FriendRequestModel, ) (err error) { return f.tx.Transaction(func(tx any) error { + now := time.Now() fr, err := f.friendRequest.NewTx(tx).Take(ctx, friendRequest.FromUserID, friendRequest.ToUserID) if err != nil { return err @@ -230,11 +231,25 @@ func (f *friendDatabase) AgreeFriendRequest( } friendRequest.HandlerUserID = mcontext.GetOpUserID(ctx) friendRequest.HandleResult = constant.FriendResponseAgree - friendRequest.HandleTime = time.Now() + friendRequest.HandleTime = now err = f.friendRequest.NewTx(tx).Update(ctx, friendRequest) if err != nil { return err } + + fr2, err := f.friendRequest.NewTx(tx).Take(ctx, friendRequest.ToUserID, friendRequest.FromUserID) + if err == nil && fr2.HandleResult == constant.FriendResponseNotHandle { + fr2.HandlerUserID = mcontext.GetOpUserID(ctx) + fr2.HandleResult = constant.FriendResponseAgree + fr2.HandleTime = now + err = f.friendRequest.NewTx(tx).Update(ctx, fr2) + if err != nil { + return err + } + } else if errs.Unwrap(err) != gorm.ErrRecordNotFound { + return err + } + exists, err := f.friend.NewTx(tx).FindUserState(ctx, friendRequest.FromUserID, friendRequest.ToUserID) if err != nil { return err diff --git a/pkg/proto/group/group.go b/pkg/proto/group/group.go index 64e7f0f61..5b387cb3a 100644 --- a/pkg/proto/group/group.go +++ b/pkg/proto/group/group.go @@ -23,9 +23,6 @@ func (x *CreateGroupReq) Check() error { if x.GroupInfo == nil { return errs.ErrArgs.Wrap("groupInfo is empty") } - if x.GroupInfo.OwnerUserID == "" { - return errs.ErrArgs.Wrap("GroupInfo.ownerUserID") - } if x.GroupInfo.GroupType > 2 || x.GroupInfo.GroupType < 0 { return errs.ErrArgs.Wrap("GroupType is invalid") } diff --git a/pkg/proto/msg/msg.go b/pkg/proto/msg/msg.go index aeb6deece..62b776856 100644 --- a/pkg/proto/msg/msg.go +++ b/pkg/proto/msg/msg.go @@ -133,9 +133,6 @@ func (x *MarkConversationAsReadReq) Check() error { if x.ConversationID == "" { return errs.ErrArgs.Wrap("conversationID is empty") } - if x.Seqs == nil { - return errs.ErrArgs.Wrap("seqs is empty") - } if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } @@ -165,9 +162,6 @@ func (x *ClearConversationsMsgReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } - if x.DeleteSyncOpt == nil { - return errs.ErrArgs.Wrap("deleteSyncOpt is empty") - } return nil } @@ -175,9 +169,6 @@ func (x *UserClearAllMsgReq) Check() error { if x.UserID == "" { return errs.ErrArgs.Wrap("userID is empty") } - if x.DeleteSyncOpt == nil { - return errs.ErrArgs.Wrap("deleteSyncOpt is empty") - } return nil } @@ -191,9 +182,6 @@ func (x *DeleteMsgsReq) Check() error { if x.Seqs == nil { return errs.ErrArgs.Wrap("seqs is empty") } - if x.DeleteSyncOpt == nil { - return errs.ErrArgs.Wrap("deleteSyncOpt is empty") - } return nil } From ce33b79915d66a6a231f0a68d1bdc190ed626a44 Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:51:52 +0800 Subject: [PATCH 09/20] fix: conflict resolve main (#537) * statistics user register * refactor: router change * minio init * UserRegisterCount * push use local conn * refactor: user pb update * remove online push close grpc conn * refactor: user pb update * refactor:pb file * msgs statistics * msgs statistics * revoke userID * refactor: errcode update * active user * active user * active user * refactor: errcode update * feat: conn update token * active user * active user * feat: conn update token * active user * feat: conn update token * feat: conn update token * feat: conn update token * add tx_oss cos * active user * active user * group create * group create * feat: group notification show to conversation * feat: group notification show to conversation * group active * user active * sendNotificationWithName * withname * privateChat * a2r call option * grpc with detail return error * change log error * chain unary interceptor * api nil slice map * fix sync has read * fix: text update * fix: update add model * set conversations update * set privateChat * fix: content update * remove unuse rpc * msgDestruct * cron use rpc mw * set IsMsgDestruct * msg destruct * msgDestruct * s3 minio, cos, oss support * feat: add implement of GetUsersOnlineStatus, #472 (#477) * s3 minio, cos, oss support * s3 route * remove extendMsg code * s3 route * remove unuse code * s3 pb * s3 pb * s3 pb * s3 presigned put * s3 presigned test * s3 presigned test * s3 presigned test * s3 presigned test * s3 presigned test * s3 presigned test * s3 presigned test * s3 presigned test * Update .gitignore (#482) * s3 debug log * s3 debug log * cron add log and fix cron * add log * cron * s3 config * fix kick user bug * s3 cos * add kick log * s3 cos test * s3 cos test * s3 cos test * kick user log * kickuserlog * s3 cos copy * s3 cos copy * s3 url * s3 url * s3 AccessURL * log * s3 InitiateMultipartUpload add ExpireTime * feat: regenerate pb file * feat: regenerate pb file * Revert "feat: regenerate pb file" This reverts commit 434f22564a89f816cbe944ab61bd9ff3414f0885. * Delete .idea directory * feat: regenerate pb file * fix: remove import C * fix: add msg transfer main file * fix: get user online status fix --------- Co-authored-by: withchao <993506633@qq.com> Co-authored-by: wangchuxiao Co-authored-by: BanTanger <88583317+BanTanger@users.noreply.github.com> Co-authored-by: withchao <48119764+withchao@users.noreply.github.com> Co-authored-by: Alan <68671759+hanzhixiao@users.noreply.github.com> --- config/config.yaml | 63 +- internal/msgtransfer/init.go | 32 +- internal/push/push_to_client.go | 103 +- internal/rpc/conversation/conversaion.go | 86 +- internal/rpc/group/group.go | 218 +--- internal/rpc/group/statistics.go | 8 +- internal/rpc/msg/statistics.go | 22 +- internal/rpc/third/s3.go | 13 +- internal/rpc/third/third.go | 18 +- internal/rpc/third/tool.go | 5 +- internal/rpc/user/user.go | 57 +- internal/tools/conversation.go | 51 +- internal/tools/cron_task.go | 13 +- internal/tools/msg.go | 69 +- pkg/common/db/controller/conversation.go | 103 +- pkg/common/db/controller/group.go | 6 +- pkg/common/db/controller/msg.go | 422 +------ pkg/common/db/controller/s3.go | 27 +- pkg/common/db/relation/group_model.go | 44 +- pkg/common/db/s3/cont/controller.go | 25 +- pkg/common/db/s3/cont/error.go | 1 - pkg/common/db/s3/cos/cos.go | 66 +- pkg/common/db/s3/minio/minio.go | 51 +- pkg/common/db/s3/oss/oss.go | 48 +- pkg/common/db/s3/oss/sign.go | 8 +- pkg/common/db/s3/s3.go | 23 +- pkg/common/db/table/relation/conversation.go | 47 +- pkg/common/log/sql_logger.go | 43 +- pkg/discoveryregistry/zookeeper/discover.go | 38 +- pkg/proto/auth/auth.pb.go | 19 +- pkg/proto/conversation/conversation.pb.go | 22 +- pkg/proto/errinfo/errinfo.pb.go | 19 +- pkg/proto/friend/friend.pb.go | 22 +- pkg/proto/group/group.pb.go | 24 +- pkg/proto/msg/msg.pb.go | 1084 +++--------------- pkg/proto/msggateway/msggateway.pb.go | 22 +- pkg/proto/push/push.pb.go | 22 +- pkg/proto/sdkws/sdkws.pb.go | 22 +- pkg/proto/statistics/statistics.pb.go | 17 +- pkg/proto/third/third.pb.go | 19 +- pkg/proto/user/user.pb.go | 24 +- pkg/proto/wrapperspb/wrapperspb.pb.go | 19 +- pkg/rpcclient/conversation.go | 83 +- pkg/rpcclient/msg.go | 63 +- pkg/rpcclient/notification/group.go | 262 +---- pkg/rpcclient/notification/msg.go | 15 +- pkg/rpcclient/third.go | 37 +- 47 files changed, 616 insertions(+), 2889 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index 2bea593ba..07d46957e 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -36,7 +36,7 @@ mysql: mongo: uri: #不为空则直接使用该值 address: [ 127.0.0.1:37017 ] #单机时为mongo地址,使用分片集群时,为mongos地址 - database: openIM_v3 #mongo db 默认即可 + database: openIM_v3 #mongo db 默认即可 username: root #用户名 password: openIM123 #密码 maxPoolSize: 100 @@ -56,14 +56,11 @@ kafka: topic: "offlineMsgToMongoMysql" #不建议修改 msgToPush: topic: "msgToPush" #不建议修改 - msgToModify: - topic: "msgToModify" #不建议修改 consumerGroupID: #消费者组,不建议修改 msgToRedis: redis # msgToMongo: mongo # msgToMySql: mysql # msgToPush: push # - msgToModify: modify # rpc: @@ -76,41 +73,26 @@ api: listenIP: #默认为0.0.0.0 object: - enable: minio #使用minio - apiURL: http://127.0.0.1:10002/third/object + enable: "minio" #使用minio + apiURL: "http://127.0.0.1:10002/object/" minio: - tempBucket: "openim" #不建议修改 - dataBucket: "openim" #不建议修改 - location: us-east-1 #不建议修改 - endpoint: http://127.0.0.1:10005 #minio对外服务的ip和端口,app要能访问此ip和端口 - accessKeyID: root #ID - secretAccessKey: openIM123 #秘钥 - isDistributedMod: false #是否分布式多硬盘部署,如果是多硬盘部署,需要修改为true - tencent: #tencent cos - appID: - region: - bucket: - secretID: - secretKey: - ali: #ali oss - regionID: - accessKeyID: - accessKeySecret: - stsEndpoint: - ossEndpoint: - bucket: - finalHost: - stsDurationSeconds: - OssRoleArn: - aws: - accessKeyID: - accessKeySecret: - region: - bucket: - finalHost: - roleArn: - externalId: - roleSessionName: + bucket: "openim" #不建议修改 + endpoint: "http://127.0.0.1:10005" #minio对外服务的ip和端口,app要能访问此ip和端口 + accessKeyID: "root" #ID + secretAccessKey: "openIM123" #秘钥 + sessionToken: "" #token + cos: #tencent cos + bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" + secretID: "" + secretKey: "" + sessionToken: "" + oss: #ali oss + endpoint: "https://oss-cn-chengdu.aliyuncs.com" + bucket: "demo-9999999" + bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" + accessKeyID: "" + accessKeySecret: "" + sessionToken: "" rpcPort: #rpc服务端口,不建议修改,端口由脚本读取后传入程序,如启动多个程序,只需要填入多个端口,用逗号隔开,如 [10110, 10111] openImUserPort: [ 10110 ] @@ -135,7 +117,7 @@ rpcRegisterName: #rpc注册服务名,不建议修改 openImThirdName: Third log: - storageLocation: ../../../../../logs/ #TODO: 存放目录 + storageLocation: ../logs/ #存放目录 rotationTime: 24 #日志旋转时间 remainRotationCount: 2 #日志数量 remainLogLevel: 6 #日志级别 6表示全都打印, @@ -182,7 +164,8 @@ groupMessageHasReadReceiptEnable: true #群聊已读是否开 singleMessageHasReadReceiptEnable: true #单聊已读是否开启 retainChatRecords: 365 #mongo保存离线消息时间(天) -chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期(超过retainChatRecords时间)消息 +chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期(超过retainChatRecords时间)消息,这个删除是为了清理满足上个配置retainChatRecords的过期消息,不会发送通知,仅仅作为清理磁盘使用 +msgDestructTime: "0 2 * * *" #消息自动删除时间,每天凌晨2点删除过期消息,这个删除是为了删除保留时间超过超过会话字段msg_destruct_time(秒)的消息。 secret: tuoyun #秘钥,获取token时校验 diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index 8b812bac9..1f166d743 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -5,9 +5,6 @@ import ( "sync" "time" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" @@ -19,6 +16,8 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" openKeeper "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry/zookeeper" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) type MsgTransfer struct { @@ -47,18 +46,9 @@ func StartTransfer(prometheusPort int) error { if err := mongo.CreateMsgIndex(); err != nil { return err } - client, err := openKeeper.NewClient( - config.Config.Zookeeper.ZkAddr, - config.Config.Zookeeper.Schema, - openKeeper.WithFreq( - time.Hour, - ), - openKeeper.WithRoundRobin(), - openKeeper.WithUserNameAndPassword(config.Config.Zookeeper.Username, - config.Config.Zookeeper.Password), - openKeeper.WithTimeout(10), - openKeeper.WithLogger(log.NewZkLogger()), - ) + client, err := openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema, + openKeeper.WithFreq(time.Hour), openKeeper.WithRoundRobin(), openKeeper.WithUserNameAndPassword(config.Config.Zookeeper.Username, + config.Config.Zookeeper.Password), openKeeper.WithTimeout(10), openKeeper.WithLogger(log.NewZkLogger())) if err != nil { return err } @@ -68,9 +58,8 @@ func StartTransfer(prometheusPort int) error { client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) msgModel := cache.NewMsgCacheModel(rdb) msgDocModel := unrelation.NewMsgMongoDriver(mongo.GetDatabase()) - msgMysModel := relation.NewChatLogGorm(db) - chatLogDatabase := controller.NewChatLogDatabase(msgMysModel) - msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, msgModel, msgMysModel) + chatLogDatabase := controller.NewChatLogDatabase(relation.NewChatLogGorm(db)) + msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, msgModel) conversationRpcClient := rpcclient.NewConversationRpcClient(client) groupRpcClient := rpcclient.NewGroupRpcClient(client) msgTransfer := NewMsgTransfer(chatLogDatabase, msgDatabase, &conversationRpcClient, &groupRpcClient) @@ -81,11 +70,8 @@ func StartTransfer(prometheusPort int) error { func NewMsgTransfer(chatLogDatabase controller.ChatLogDatabase, msgDatabase controller.CommonMsgDatabase, conversationRpcClient *rpcclient.ConversationRpcClient, groupRpcClient *rpcclient.GroupRpcClient) *MsgTransfer { - return &MsgTransfer{ - persistentCH: NewPersistentConsumerHandler(chatLogDatabase), - historyCH: NewOnlineHistoryRedisConsumerHandler(msgDatabase, conversationRpcClient, groupRpcClient), - historyMongoCH: NewOnlineHistoryMongoConsumerHandler(msgDatabase), - } + return &MsgTransfer{persistentCH: NewPersistentConsumerHandler(chatLogDatabase), historyCH: NewOnlineHistoryRedisConsumerHandler(msgDatabase, conversationRpcClient, groupRpcClient), + historyMongoCH: NewOnlineHistoryMongoConsumerHandler(msgDatabase)} } func (m *MsgTransfer) initPrometheus() { diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 4aae679af..607d862e1 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -38,16 +38,9 @@ type Pusher struct { var errNoOfflinePusher = errors.New("no offlinePusher is configured") -func NewPusher( - discov discoveryregistry.SvcDiscoveryRegistry, - offlinePusher offlinepush.OfflinePusher, - database controller.PushDatabase, - groupLocalCache *localcache.GroupLocalCache, - conversationLocalCache *localcache.ConversationLocalCache, - conversationRpcClient *rpcclient.ConversationRpcClient, - groupRpcClient *rpcclient.GroupRpcClient, - msgRpcClient *rpcclient.MessageRpcClient, -) *Pusher { +func NewPusher(discov discoveryregistry.SvcDiscoveryRegistry, offlinePusher offlinepush.OfflinePusher, database controller.PushDatabase, + groupLocalCache *localcache.GroupLocalCache, conversationLocalCache *localcache.ConversationLocalCache, + conversationRpcClient *rpcclient.ConversationRpcClient, groupRpcClient *rpcclient.GroupRpcClient, msgRpcClient *rpcclient.MessageRpcClient) *Pusher { return &Pusher{ discov: discov, database: database, @@ -94,18 +87,7 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg return err } isOfflinePush := utils.GetSwitchFromOptions(msg.Options, constant.IsOfflinePush) - log.ZDebug( - ctx, - "push_result", - "ws push result", - wsResults, - "sendData", - msg, - "isOfflinePush", - isOfflinePush, - "push_to_userID", - userIDs, - ) + log.ZDebug(ctx, "push_result", "ws push result", wsResults, "sendData", msg, "isOfflinePush", isOfflinePush, "push_to_userID", userIDs) p.successCount++ for _, userID := range userIDs { if isOfflinePush && userID != msg.SendID { @@ -156,15 +138,7 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws } defer func(groupID string, userIDs []string) { if err := p.DeleteMemberAndSetConversationSeq(ctx, groupID, userIDs); err != nil { - log.ZError( - ctx, - "MemberQuitNotification DeleteMemberAndSetConversationSeq", - err, - "groupID", - groupID, - "userIDs", - userIDs, - ) + log.ZError(ctx, "MemberQuitNotification DeleteMemberAndSetConversationSeq", err, "groupID", groupID, "userIDs", userIDs) } }(groupID, []string{tips.QuitUser.UserID}) pushToUserIDs = append(pushToUserIDs, tips.QuitUser.UserID) @@ -173,21 +147,10 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws if p.UnmarshalNotificationElem(msg.Content, &tips) != nil { return err } - kickedUsers := utils.Slice( - tips.KickedUserList, - func(e *sdkws.GroupMemberFullInfo) string { return e.UserID }, - ) + kickedUsers := utils.Slice(tips.KickedUserList, func(e *sdkws.GroupMemberFullInfo) string { return e.UserID }) defer func(groupID string, userIDs []string) { if err := p.DeleteMemberAndSetConversationSeq(ctx, groupID, userIDs); err != nil { - log.ZError( - ctx, - "MemberKickedNotification DeleteMemberAndSetConversationSeq", - err, - "groupID", - groupID, - "userIDs", - userIDs, - ) + log.ZError(ctx, "MemberKickedNotification DeleteMemberAndSetConversationSeq", err, "groupID", groupID, "userIDs", userIDs) } }(groupID, kickedUsers) pushToUserIDs = append(pushToUserIDs, kickedUsers...) @@ -197,16 +160,7 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws if p.UnmarshalNotificationElem(msg.Content, &tips) != nil { return err } - log.ZInfo( - ctx, - "GroupDismissedNotificationInfo****", - "groupID", - groupID, - "num", - len(pushToUserIDs), - "list", - pushToUserIDs, - ) + log.ZInfo(ctx, "GroupDismissedNotificationInfo****", "groupID", groupID, "num", len(pushToUserIDs), "list", pushToUserIDs) if len(config.Config.Manager.UserID) > 0 { ctx = mcontext.WithOpUserIDContext(ctx, config.Config.Manager.UserID[0]) } @@ -270,23 +224,9 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws log.ZError(ctx, "offlinePushMsg failed", err, "groupID", groupID, "msg", msg) return err } - _, err := p.GetConnsAndOnlinePush( - ctx, - msg, - utils.IntersectString(needOfflinePushUserIDs, WebAndPcBackgroundUserIDs), - ) + _, err := p.GetConnsAndOnlinePush(ctx, msg, utils.IntersectString(needOfflinePushUserIDs, WebAndPcBackgroundUserIDs)) if err != nil { - log.ZError( - ctx, - "offlinePushMsg failed", - err, - "groupID", - groupID, - "msg", - msg, - "userIDs", - utils.IntersectString(needOfflinePushUserIDs, WebAndPcBackgroundUserIDs), - ) + log.ZError(ctx, "offlinePushMsg failed", err, "groupID", groupID, "msg", msg, "userIDs", utils.IntersectString(needOfflinePushUserIDs, WebAndPcBackgroundUserIDs)) return err } } @@ -294,11 +234,7 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws return nil } -func (p *Pusher) GetConnsAndOnlinePush( - ctx context.Context, - msg *sdkws.MsgData, - pushToUserIDs []string, -) (wsResults []*msggateway.SingleMsgToUserResults, err error) { +func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData, pushToUserIDs []string) (wsResults []*msggateway.SingleMsgToUserResults, err error) { conns, err := p.discov.GetConns(ctx, config.Config.RpcRegisterName.OpenImMessageGatewayName) log.ZDebug(ctx, "get gateway conn", "conn length", len(conns)) if err != nil { @@ -307,10 +243,7 @@ func (p *Pusher) GetConnsAndOnlinePush( //Online push message for _, v := range conns { msgClient := msggateway.NewMsgGatewayClient(v) - reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg( - ctx, - &msggateway.OnlineBatchPushOneMsgReq{MsgData: msg, PushToUserIDs: pushToUserIDs}, - ) + reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(ctx, &msggateway.OnlineBatchPushOneMsgReq{MsgData: msg, PushToUserIDs: pushToUserIDs}) if err != nil { continue } @@ -323,12 +256,7 @@ func (p *Pusher) GetConnsAndOnlinePush( return wsResults, nil } -func (p *Pusher) offlinePushMsg( - ctx context.Context, - conversationID string, - msg *sdkws.MsgData, - offlinePushUserIDs []string, -) error { +func (p *Pusher) offlinePushMsg(ctx context.Context, conversationID string, msg *sdkws.MsgData, offlinePushUserIDs []string) error { title, content, opts, err := p.getOfflinePushInfos(conversationID, msg) if err != nil { return err @@ -362,10 +290,7 @@ func (p *Pusher) GetOfflinePushOpts(msg *sdkws.MsgData) (opts *offlinepush.Opts, return opts, nil } -func (p *Pusher) getOfflinePushInfos( - conversationID string, - msg *sdkws.MsgData, -) (title, content string, opts *offlinepush.Opts, err error) { +func (p *Pusher) getOfflinePushInfos(conversationID string, msg *sdkws.MsgData) (title, content string, opts *offlinepush.Opts, err error) { if p.offlinePusher == nil { err = errNoOfflinePusher return diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 4af5dd8b4..1f45d0224 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -3,8 +3,6 @@ package conversation import ( "context" - "google.golang.org/grpc" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" @@ -19,6 +17,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "google.golang.org/grpc" ) type conversationServer struct { @@ -45,19 +44,12 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e pbConversation.RegisterConversationServer(server, &conversationServer{ conversationNotificationSender: notification.NewConversationNotificationSender(&msgRpcClient), groupRpcClient: &groupRpcClient, - conversationDatabase: controller.NewConversationDatabase( - conversationDB, - cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), - tx.NewGorm(db), - ), + conversationDatabase: controller.NewConversationDatabase(conversationDB, cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), conversationDB), tx.NewGorm(db)), }) return nil } -func (c *conversationServer) GetConversation( - ctx context.Context, - req *pbConversation.GetConversationReq, -) (*pbConversation.GetConversationResp, error) { +func (c *conversationServer) GetConversation(ctx context.Context, req *pbConversation.GetConversationReq) (*pbConversation.GetConversationResp, error) { conversations, err := c.conversationDatabase.FindConversations(ctx, req.OwnerUserID, []string{req.ConversationID}) if err != nil { return nil, err @@ -70,10 +62,7 @@ func (c *conversationServer) GetConversation( return resp, nil } -func (c *conversationServer) GetAllConversations( - ctx context.Context, - req *pbConversation.GetAllConversationsReq, -) (*pbConversation.GetAllConversationsResp, error) { +func (c *conversationServer) GetAllConversations(ctx context.Context, req *pbConversation.GetAllConversationsReq) (*pbConversation.GetAllConversationsResp, error) { conversations, err := c.conversationDatabase.GetUserAllConversation(ctx, req.OwnerUserID) if err != nil { return nil, err @@ -83,10 +72,7 @@ func (c *conversationServer) GetAllConversations( return resp, nil } -func (c *conversationServer) GetConversations( - ctx context.Context, - req *pbConversation.GetConversationsReq, -) (*pbConversation.GetConversationsResp, error) { +func (c *conversationServer) GetConversations(ctx context.Context, req *pbConversation.GetConversationsReq) (*pbConversation.GetConversationsResp, error) { conversations, err := c.conversationDatabase.FindConversations(ctx, req.OwnerUserID, req.ConversationIDs) if err != nil { return nil, err @@ -96,19 +82,12 @@ func (c *conversationServer) GetConversations( return resp, nil } -func (c *conversationServer) SetConversation( - ctx context.Context, - req *pbConversation.SetConversationReq, -) (*pbConversation.SetConversationResp, error) { +func (c *conversationServer) SetConversation(ctx context.Context, req *pbConversation.SetConversationReq) (*pbConversation.SetConversationResp, error) { var conversation tableRelation.ConversationModel if err := utils.CopyStructFields(&conversation, req.Conversation); err != nil { return nil, err } - err := c.conversationDatabase.SetUserConversations( - ctx, - req.Conversation.OwnerUserID, - []*tableRelation.ConversationModel{&conversation}, - ) + err := c.conversationDatabase.SetUserConversations(ctx, req.Conversation.OwnerUserID, []*tableRelation.ConversationModel{&conversation}) if err != nil { return nil, err } @@ -117,10 +96,7 @@ func (c *conversationServer) SetConversation( return resp, nil } -func (c *conversationServer) SetConversations( - ctx context.Context, - req *pbConversation.SetConversationsReq, -) (*pbConversation.SetConversationsResp, error) { +func (c *conversationServer) SetConversations(ctx context.Context, req *pbConversation.SetConversationsReq) (*pbConversation.SetConversationsResp, error) { if req.Conversation == nil { return nil, errs.ErrArgs.Wrap("conversation must not be nil") } @@ -178,12 +154,7 @@ func (c *conversationServer) SetConversations( return nil, err } for _, userID := range req.UserIDs { - c.conversationNotificationSender.ConversationSetPrivateNotification( - ctx, - userID, - req.Conversation.UserID, - req.Conversation.IsPrivateChat.Value, - ) + c.conversationNotificationSender.ConversationSetPrivateNotification(ctx, userID, req.Conversation.UserID, req.Conversation.IsPrivateChat.Value) } } if req.Conversation.BurnDuration != nil { @@ -200,10 +171,7 @@ func (c *conversationServer) SetConversations( } // 获取超级大群开启免打扰的用户ID -func (c *conversationServer) GetRecvMsgNotNotifyUserIDs( - ctx context.Context, - req *pbConversation.GetRecvMsgNotNotifyUserIDsReq, -) (*pbConversation.GetRecvMsgNotNotifyUserIDsResp, error) { +func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbConversation.GetRecvMsgNotNotifyUserIDsReq) (*pbConversation.GetRecvMsgNotNotifyUserIDsResp, error) { userIDs, err := c.conversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID) if err != nil { return nil, err @@ -212,10 +180,7 @@ func (c *conversationServer) GetRecvMsgNotNotifyUserIDs( } // create conversation without notification for msg redis transfer -func (c *conversationServer) CreateSingleChatConversations( - ctx context.Context, - req *pbConversation.CreateSingleChatConversationsReq, -) (*pbConversation.CreateSingleChatConversationsResp, error) { +func (c *conversationServer) CreateSingleChatConversations(ctx context.Context, req *pbConversation.CreateSingleChatConversationsReq) (*pbConversation.CreateSingleChatConversationsResp, error) { var conversation tableRelation.ConversationModel conversation.ConversationID = utils.GetConversationIDBySessionType(constant.SingleChatType, req.RecvID, req.SendID) conversation.ConversationType = constant.SingleChatType @@ -236,10 +201,7 @@ func (c *conversationServer) CreateSingleChatConversations( return &pbConversation.CreateSingleChatConversationsResp{}, nil } -func (c *conversationServer) CreateGroupChatConversations( - ctx context.Context, - req *pbConversation.CreateGroupChatConversationsReq, -) (*pbConversation.CreateGroupChatConversationsResp, error) { +func (c *conversationServer) CreateGroupChatConversations(ctx context.Context, req *pbConversation.CreateGroupChatConversationsReq) (*pbConversation.CreateGroupChatConversationsResp, error) { err := c.conversationDatabase.CreateGroupChatConversation(ctx, req.GroupID, req.UserIDs) if err != nil { return nil, err @@ -247,10 +209,7 @@ func (c *conversationServer) CreateGroupChatConversations( return &pbConversation.CreateGroupChatConversationsResp{}, nil } -func (c *conversationServer) SetConversationMaxSeq( - ctx context.Context, - req *pbConversation.SetConversationMaxSeqReq, -) (*pbConversation.SetConversationMaxSeqResp, error) { +func (c *conversationServer) SetConversationMaxSeq(ctx context.Context, req *pbConversation.SetConversationMaxSeqReq) (*pbConversation.SetConversationMaxSeqResp, error) { if err := c.conversationDatabase.UpdateUsersConversationFiled(ctx, req.OwnerUserID, req.ConversationID, map[string]interface{}{"max_seq": req.MaxSeq}); err != nil { return nil, err @@ -258,10 +217,7 @@ func (c *conversationServer) SetConversationMaxSeq( return &pbConversation.SetConversationMaxSeqResp{}, nil } -func (c *conversationServer) GetConversationIDs( - ctx context.Context, - req *pbConversation.GetConversationIDsReq, -) (*pbConversation.GetConversationIDsResp, error) { +func (c *conversationServer) GetConversationIDs(ctx context.Context, req *pbConversation.GetConversationIDsReq) (*pbConversation.GetConversationIDsResp, error) { conversationIDs, err := c.conversationDatabase.GetConversationIDs(ctx, req.UserID) if err != nil { return nil, err @@ -269,10 +225,7 @@ func (c *conversationServer) GetConversationIDs( return &pbConversation.GetConversationIDsResp{ConversationIDs: conversationIDs}, nil } -func (c *conversationServer) GetUserConversationIDsHash( - ctx context.Context, - req *pbConversation.GetUserConversationIDsHashReq, -) (*pbConversation.GetUserConversationIDsHashResp, error) { +func (c *conversationServer) GetUserConversationIDsHash(ctx context.Context, req *pbConversation.GetUserConversationIDsHashReq) (*pbConversation.GetUserConversationIDsHashResp, error) { hash, err := c.conversationDatabase.GetUserConversationIDsHash(ctx, req.OwnerUserID) if err != nil { return nil, err @@ -280,15 +233,10 @@ func (c *conversationServer) GetUserConversationIDsHash( return &pbConversation.GetUserConversationIDsHashResp{Hash: hash}, nil } -func (c *conversationServer) GetConversationsByConversationID( - ctx context.Context, - req *pbConversation.GetConversationsByConversationIDReq, -) (*pbConversation.GetConversationsByConversationIDResp, error) { +func (c *conversationServer) GetConversationsByConversationID(ctx context.Context, req *pbConversation.GetConversationsByConversationIDReq) (*pbConversation.GetConversationsByConversationIDResp, error) { conversations, err := c.conversationDatabase.GetConversationsByConversationID(ctx, req.ConversationIDs) if err != nil { return nil, err } - return &pbConversation.GetConversationsByConversationIDResp{ - Conversations: convert.ConversationsDB2Pb(conversations), - }, nil + return &pbConversation.GetConversationsByConversationIDResp{Conversations: convert.ConversationsDB2Pb(conversations)}, nil } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index acafc130a..ec5d0bdb5 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -3,23 +3,20 @@ package group import ( "context" "fmt" + pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" + "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" "math/big" "math/rand" "strconv" "strings" "time" - pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" - "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" - "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw/specialerror" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" - "google.golang.org/grpc" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" @@ -34,6 +31,7 @@ import ( pbGroup "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "google.golang.org/grpc" ) func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error { @@ -59,18 +57,13 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e pbGroup.RegisterGroupServer(server, &groupServer{ GroupDatabase: database, User: userRpcClient, - Notification: notification.NewGroupNotificationSender( - database, - &msgRpcClient, - &userRpcClient, - func(ctx context.Context, userIDs []string) ([]notification.CommonUser, error) { - users, err := userRpcClient.GetUsersInfo(ctx, userIDs) - if err != nil { - return nil, err - } - return utils.Slice(users, func(e *sdkws.UserInfo) notification.CommonUser { return e }), nil - }, - ), + Notification: notification.NewGroupNotificationSender(database, &msgRpcClient, &userRpcClient, func(ctx context.Context, userIDs []string) ([]notification.CommonUser, error) { + users, err := userRpcClient.GetUsersInfo(ctx, userIDs) + if err != nil { + return nil, err + } + return utils.Slice(users, func(e *sdkws.UserInfo) notification.CommonUser { return e }), nil + }), conversationRpcClient: conversationRpcClient, msgRpcClient: msgRpcClient, }) @@ -127,16 +120,7 @@ func (s *groupServer) GenGroupID(ctx context.Context, groupID *string) error { } } for i := 0; i < 10; i++ { - id := utils.Md5( - strings.Join( - []string{ - mcontext.GetOperationID(ctx), - strconv.FormatInt(time.Now().UnixNano(), 10), - strconv.Itoa(rand.Int()), - }, - ",;,", - ), - ) + id := utils.Md5(strings.Join([]string{mcontext.GetOperationID(ctx), strconv.FormatInt(time.Now().UnixNano(), 10), strconv.Itoa(rand.Int())}, ",;,")) bi := big.NewInt(0) bi.SetString(id[0:8], 16) id = bi.String() @@ -250,10 +234,7 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR return resp, nil } -func (s *groupServer) GetJoinedGroupList( - ctx context.Context, - req *pbGroup.GetJoinedGroupListReq, -) (*pbGroup.GetJoinedGroupListResp, error) { +func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJoinedGroupListReq) (*pbGroup.GetJoinedGroupListResp, error) { resp := &pbGroup.GetJoinedGroupListResp{} if err := tokenverify.CheckAccessV3(ctx, req.FromUserID); err != nil { return nil, err @@ -263,8 +244,7 @@ func (s *groupServer) GetJoinedGroupList( pageNumber = req.Pagination.PageNumber showNumber = req.Pagination.ShowNumber } - // total, members, err := s.GroupDatabase.PageGroupMember(ctx, nil, []string{req.FromUserID}, nil, pageNumber, - // showNumber) + //total, members, err := s.GroupDatabase.PageGroupMember(ctx, nil, []string{req.FromUserID}, nil, pageNumber, showNumber) total, members, err := s.GroupDatabase.PageGetJoinGroup(ctx, req.FromUserID, pageNumber, showNumber) if err != nil { return nil, err @@ -303,10 +283,7 @@ func (s *groupServer) GetJoinedGroupList( return resp, nil } -func (s *groupServer) InviteUserToGroup( - ctx context.Context, - req *pbGroup.InviteUserToGroupReq, -) (*pbGroup.InviteUserToGroupResp, error) { +func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.InviteUserToGroupReq) (*pbGroup.InviteUserToGroupResp, error) { resp := &pbGroup.InviteUserToGroupResp{} if len(req.InvitedUserIDs) == 0 { return nil, errs.ErrArgs.Wrap("user empty") @@ -407,10 +384,7 @@ func (s *groupServer) InviteUserToGroup( return resp, nil } -func (s *groupServer) GetGroupAllMember( - ctx context.Context, - req *pbGroup.GetGroupAllMemberReq, -) (*pbGroup.GetGroupAllMemberResp, error) { +func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) { resp := &pbGroup.GetGroupAllMemberResp{} group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { @@ -438,10 +412,7 @@ func (s *groupServer) GetGroupAllMember( return resp, nil } -func (s *groupServer) GetGroupMemberList( - ctx context.Context, - req *pbGroup.GetGroupMemberListReq, -) (*pbGroup.GetGroupMemberListResp, error) { +func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) { resp := &pbGroup.GetGroupMemberListResp{} total, members, err := s.PageGetGroupMember(ctx, req.GroupID, req.Pagination.PageNumber, req.Pagination.ShowNumber) log.ZDebug(ctx, "GetGroupMemberList", "total", total, "members", members, "length", len(members)) @@ -454,10 +425,7 @@ func (s *groupServer) GetGroupMemberList( return resp, nil } -func (s *groupServer) KickGroupMember( - ctx context.Context, - req *pbGroup.KickGroupMemberReq, -) (*pbGroup.KickGroupMemberResp, error) { +func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) { resp := &pbGroup.KickGroupMemberResp{} group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { @@ -565,10 +533,7 @@ func (s *groupServer) KickGroupMember( return resp, nil } -func (s *groupServer) GetGroupMembersInfo( - ctx context.Context, - req *pbGroup.GetGroupMembersInfoReq, -) (*pbGroup.GetGroupMembersInfoResp, error) { +func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) { resp := &pbGroup.GetGroupMembersInfoResp{} if len(req.UserIDs) == 0 { return nil, errs.ErrArgs.Wrap("userIDs empty") @@ -595,10 +560,7 @@ func (s *groupServer) GetGroupMembersInfo( return resp, nil } -func (s *groupServer) GetGroupApplicationList( - ctx context.Context, - req *pbGroup.GetGroupApplicationListReq, -) (*pbGroup.GetGroupApplicationListResp, error) { +func (s *groupServer) GetGroupApplicationList(ctx context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) { pageNumber, showNumber := utils.GetPage(req.Pagination) groupIDs, err := s.GroupDatabase.FindUserManagedGroupID(ctx, req.FromUserID) @@ -649,19 +611,12 @@ func (s *groupServer) GetGroupApplicationList( return e.GroupID }) resp.GroupRequests = utils.Slice(groupRequests, func(e *relationTb.GroupRequestModel) *sdkws.GroupRequest { - return convert.Db2PbGroupRequest( - e, - userMap[e.UserID], - convert.Db2PbGroupInfo(groupMap[e.GroupID], ownerMap[e.GroupID].UserID, groupMemberNumMap[e.GroupID]), - ) + return convert.Db2PbGroupRequest(e, userMap[e.UserID], convert.Db2PbGroupInfo(groupMap[e.GroupID], ownerMap[e.GroupID].UserID, groupMemberNumMap[e.GroupID])) }) return resp, nil } -func (s *groupServer) GetGroupsInfo( - ctx context.Context, - req *pbGroup.GetGroupsInfoReq, -) (*pbGroup.GetGroupsInfoResp, error) { +func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsInfoReq) (*pbGroup.GetGroupsInfoResp, error) { resp := &pbGroup.GetGroupsInfoResp{} if len(req.GroupIDs) == 0 { return nil, errs.ErrArgs.Wrap("groupID is empty") @@ -691,10 +646,7 @@ func (s *groupServer) GetGroupsInfo( return resp, nil } -func (s *groupServer) GroupApplicationResponse( - ctx context.Context, - req *pbGroup.GroupApplicationResponseReq, -) (*pbGroup.GroupApplicationResponseResp, error) { +func (s *groupServer) GroupApplicationResponse(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) { defer log.ZInfo(ctx, utils.GetFuncName()+" Return") if !utils.Contain(req.HandleResult, constant.GroupResponseAgree, constant.GroupResponseRefuse) { return nil, errs.ErrArgs.Wrap("HandleResult unknown") @@ -766,10 +718,7 @@ func (s *groupServer) GroupApplicationResponse( return &pbGroup.GroupApplicationResponseResp{}, nil } -func (s *groupServer) JoinGroup( - ctx context.Context, - req *pbGroup.JoinGroupReq, -) (resp *pbGroup.JoinGroupResp, err error) { +func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (resp *pbGroup.JoinGroupResp, err error) { defer log.ZInfo(ctx, "JoinGroup.Return") user, err := s.User.GetUserInfo(ctx, req.InviterUserID) if err != nil { @@ -869,10 +818,7 @@ func (s *groupServer) deleteMemberAndSetConversationSeq(ctx context.Context, gro return s.conversationRpcClient.SetConversationMaxSeq(ctx, userIDs, conevrsationID, maxSeq) } -func (s *groupServer) SetGroupInfo( - ctx context.Context, - req *pbGroup.SetGroupInfoReq, -) (*pbGroup.SetGroupInfoResp, error) { +func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.SetGroupInfoResp, error) { var opMember *relationTb.GroupMemberModel if !tokenverify.IsAppManagerUid(ctx) { var err error @@ -924,17 +870,11 @@ func (s *groupServer) SetGroupInfo( go func() { nctx := mcontext.NewCtx("@@@" + mcontext.GetOperationID(ctx)) conversation := &pbConversation.ConversationReq{ - ConversationID: utils.GetConversationIDBySessionType( - constant.SuperGroupChatType, - req.GroupInfoForSet.GroupID, - ), + ConversationID: utils.GetConversationIDBySessionType(constant.SuperGroupChatType, req.GroupInfoForSet.GroupID), ConversationType: constant.SuperGroupChatType, GroupID: req.GroupInfoForSet.GroupID, } - resp, err := s.GetGroupMemberUserIDs( - nctx, - &pbGroup.GetGroupMemberUserIDsReq{GroupID: req.GroupInfoForSet.GroupID}, - ) + resp, err := s.GetGroupMemberUserIDs(nctx, &pbGroup.GetGroupMemberUserIDsReq{GroupID: req.GroupInfoForSet.GroupID}) if err != nil { log.ZWarn(ctx, "GetGroupMemberIDs", err) return @@ -945,10 +885,7 @@ func (s *groupServer) SetGroupInfo( } }() num++ - s.Notification.GroupInfoSetAnnouncementNotification( - ctx, - &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser}, - ) + s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser}) } switch len(data) - num { @@ -965,10 +902,7 @@ func (s *groupServer) SetGroupInfo( return resp, nil } -func (s *groupServer) TransferGroupOwner( - ctx context.Context, - req *pbGroup.TransferGroupOwnerReq, -) (*pbGroup.TransferGroupOwnerResp, error) { +func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) { resp := &pbGroup.TransferGroupOwnerResp{} group, err := s.GroupDatabase.TakeGroup(ctx, req.GroupID) if err != nil { @@ -1047,20 +981,9 @@ func (s *groupServer) GetGroups(ctx context.Context, req *pbGroup.GetGroupsReq) return resp, nil } -func (s *groupServer) GetGroupMembersCMS( - ctx context.Context, - req *pbGroup.GetGroupMembersCMSReq, -) (*pbGroup.GetGroupMembersCMSResp, error) { +func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbGroup.GetGroupMembersCMSReq) (*pbGroup.GetGroupMembersCMSResp, error) { resp := &pbGroup.GetGroupMembersCMSResp{} - total, members, err := s.GroupDatabase.SearchGroupMember( - ctx, - req.UserName, - []string{req.GroupID}, - nil, - nil, - req.Pagination.PageNumber, - req.Pagination.ShowNumber, - ) + total, members, err := s.GroupDatabase.SearchGroupMember(ctx, req.UserName, []string{req.GroupID}, nil, nil, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -1080,10 +1003,7 @@ func (s *groupServer) GetGroupMembersCMS( return resp, nil } -func (s *groupServer) GetUserReqApplicationList( - ctx context.Context, - req *pbGroup.GetUserReqApplicationListReq, -) (*pbGroup.GetUserReqApplicationListResp, error) { +func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGroup.GetUserReqApplicationListReq) (*pbGroup.GetUserReqApplicationListResp, error) { resp := &pbGroup.GetUserReqApplicationListResp{} user, err := s.User.GetPublicUserInfo(ctx, req.UserID) if err != nil { @@ -1130,19 +1050,12 @@ func (s *groupServer) GetUserReqApplicationList( return nil, err } resp.GroupRequests = utils.Slice(requests, func(e *relationTb.GroupRequestModel) *sdkws.GroupRequest { - return convert.Db2PbGroupRequest( - e, - user, - convert.Db2PbGroupInfo(groupMap[e.GroupID], ownerMap[e.GroupID].UserID, uint32(groupMemberNum[e.GroupID])), - ) + return convert.Db2PbGroupRequest(e, user, convert.Db2PbGroupInfo(groupMap[e.GroupID], ownerMap[e.GroupID].UserID, uint32(groupMemberNum[e.GroupID]))) }) return resp, nil } -func (s *groupServer) DismissGroup( - ctx context.Context, - req *pbGroup.DismissGroupReq, -) (*pbGroup.DismissGroupResp, error) { +func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGroupReq) (*pbGroup.DismissGroupResp, error) { defer log.ZInfo(ctx, "DismissGroup.return") resp := &pbGroup.DismissGroupResp{} owner, err := s.TakeGroupOwner(ctx, req.GroupID) @@ -1191,10 +1104,7 @@ func (s *groupServer) DismissGroup( return resp, nil } -func (s *groupServer) MuteGroupMember( - ctx context.Context, - req *pbGroup.MuteGroupMemberReq, -) (*pbGroup.MuteGroupMemberResp, error) { +func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) { resp := &pbGroup.MuteGroupMemberResp{} //if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { // return nil, err @@ -1229,10 +1139,7 @@ func (s *groupServer) MuteGroupMember( return resp, nil } -func (s *groupServer) CancelMuteGroupMember( - ctx context.Context, - req *pbGroup.CancelMuteGroupMemberReq, -) (*pbGroup.CancelMuteGroupMemberResp, error) { +func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) { resp := &pbGroup.CancelMuteGroupMemberResp{} //member, err := s.GroupDatabase.TakeGroupMember(ctx, req.GroupID, req.UserID) //if err != nil { @@ -1244,8 +1151,7 @@ func (s *groupServer) CancelMuteGroupMember( // return nil, err // } // if opMember.RoleLevel <= member.RoleLevel { - // return nil, errs.ErrNoPermission.Wrap(fmt.Sprintf("self RoleLevel %d target %d", opMember.RoleLevel, - // member.RoleLevel)) + // return nil, errs.ErrNoPermission.Wrap(fmt.Sprintf("self RoleLevel %d target %d", opMember.RoleLevel, member.RoleLevel)) // } //} //if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil { @@ -1293,10 +1199,7 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) return resp, nil } -func (s *groupServer) CancelMuteGroup( - ctx context.Context, - req *pbGroup.CancelMuteGroupReq, -) (*pbGroup.CancelMuteGroupResp, error) { +func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMuteGroupReq) (*pbGroup.CancelMuteGroupResp, error) { resp := &pbGroup.CancelMuteGroupResp{} if err := s.CheckGroupAdmin(ctx, req.GroupID); err != nil { return nil, err @@ -1308,10 +1211,7 @@ func (s *groupServer) CancelMuteGroup( return resp, nil } -func (s *groupServer) SetGroupMemberInfo( - ctx context.Context, - req *pbGroup.SetGroupMemberInfoReq, -) (*pbGroup.SetGroupMemberInfoResp, error) { +func (s *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbGroup.SetGroupMemberInfoReq) (*pbGroup.SetGroupMemberInfoResp, error) { resp := &pbGroup.SetGroupMemberInfoResp{} if len(req.Members) == 0 { return nil, errs.ErrArgs.Wrap("members empty") @@ -1338,11 +1238,9 @@ func (s *groupServer) SetGroupMemberInfo( delete(duplicateMap, [...]string{member.GroupID, member.UserID}) } if len(duplicateMap) > 0 { - return nil, errs.ErrArgs.Wrap( - "user not found" + strings.Join(utils.Slice(utils.Keys(duplicateMap), func(e [2]string) string { - return fmt.Sprintf("[group: %s user: %s]", e[0], e[1]) - }), ","), - ) + return nil, errs.ErrArgs.Wrap("user not found" + strings.Join(utils.Slice(utils.Keys(duplicateMap), func(e [2]string) string { + return fmt.Sprintf("[group: %s user: %s]", e[0], e[1]) + }), ",")) } memberMap := utils.SliceToMap(members, func(e *relationTb.GroupMemberModel) [2]string { return [...]string{e.GroupID, e.UserID} @@ -1372,9 +1270,7 @@ func (s *groupServer) SetGroupMemberInfo( } dbMember, ok := memberMap[[...]string{member.GroupID, member.UserID}] if !ok { - return nil, errs.ErrRecordNotFound.Wrap( - fmt.Sprintf("user %s not in group %s", member.UserID, member.GroupID), - ) + return nil, errs.ErrRecordNotFound.Wrap(fmt.Sprintf("user %s not in group %s", member.UserID, member.GroupID)) } //if opMember.RoleLevel == constant.GroupOwner { // continue @@ -1436,25 +1332,14 @@ func (s *groupServer) SetGroupMemberInfo( if member.Nickname != nil || member.FaceURL != nil || member.Ex != nil { log.ZDebug(ctx, "setGroupMemberInfo notification", "member", member.UserID) if err := s.Notification.GroupMemberInfoSetNotification(ctx, member.GroupID, member.UserID); err != nil { - log.ZError( - ctx, - "setGroupMemberInfo notification failed", - err, - "member", - member.UserID, - "groupID", - member.GroupID, - ) + log.ZError(ctx, "setGroupMemberInfo notification failed", err, "member", member.UserID, "groupID", member.GroupID) } } } return resp, nil } -func (s *groupServer) GetGroupAbstractInfo( - ctx context.Context, - req *pbGroup.GetGroupAbstractInfoReq, -) (*pbGroup.GetGroupAbstractInfoResp, error) { +func (s *groupServer) GetGroupAbstractInfo(ctx context.Context, req *pbGroup.GetGroupAbstractInfoReq) (*pbGroup.GetGroupAbstractInfoResp, error) { resp := &pbGroup.GetGroupAbstractInfoResp{} if len(req.GroupIDs) == 0 { return nil, errs.ErrArgs.Wrap("groupIDs empty") @@ -1485,10 +1370,7 @@ func (s *groupServer) GetGroupAbstractInfo( return resp, nil } -func (s *groupServer) GetUserInGroupMembers( - ctx context.Context, - req *pbGroup.GetUserInGroupMembersReq, -) (*pbGroup.GetUserInGroupMembersResp, error) { +func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbGroup.GetUserInGroupMembersReq) (*pbGroup.GetUserInGroupMembersResp, error) { resp := &pbGroup.GetUserInGroupMembersResp{} if len(req.GroupIDs) == 0 { return nil, errs.ErrArgs.Wrap("groupIDs empty") @@ -1512,10 +1394,7 @@ func (s *groupServer) GetUserInGroupMembers( return resp, nil } -func (s *groupServer) GetGroupMemberUserIDs( - ctx context.Context, - req *pbGroup.GetGroupMemberUserIDsReq, -) (resp *pbGroup.GetGroupMemberUserIDsResp, err error) { +func (s *groupServer) GetGroupMemberUserIDs(ctx context.Context, req *pbGroup.GetGroupMemberUserIDsReq) (resp *pbGroup.GetGroupMemberUserIDsResp, err error) { resp = &pbGroup.GetGroupMemberUserIDsResp{} resp.UserIDs, err = s.GroupDatabase.FindGroupMemberUserID(ctx, req.GroupID) if err != nil { @@ -1524,10 +1403,7 @@ func (s *groupServer) GetGroupMemberUserIDs( return resp, nil } -func (s *groupServer) GetGroupMemberRoleLevel( - ctx context.Context, - req *pbGroup.GetGroupMemberRoleLevelReq, -) (*pbGroup.GetGroupMemberRoleLevelResp, error) { +func (s *groupServer) GetGroupMemberRoleLevel(ctx context.Context, req *pbGroup.GetGroupMemberRoleLevelReq) (*pbGroup.GetGroupMemberRoleLevelResp, error) { resp := &pbGroup.GetGroupMemberRoleLevelResp{} if len(req.RoleLevels) == 0 { return nil, errs.ErrArgs.Wrap("RoleLevels empty") diff --git a/internal/rpc/group/statistics.go b/internal/rpc/group/statistics.go index 45d47b932..c6664b4df 100644 --- a/internal/rpc/group/statistics.go +++ b/internal/rpc/group/statistics.go @@ -2,16 +2,12 @@ package group import ( "context" - "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" + "time" ) -func (s *groupServer) GroupCreateCount( - ctx context.Context, - req *group.GroupCreateCountReq, -) (*group.GroupCreateCountResp, error) { +func (s *groupServer) GroupCreateCount(ctx context.Context, req *group.GroupCreateCountReq) (*group.GroupCreateCountResp, error) { if req.Start > req.End { return nil, errs.ErrArgs.Wrap("start > end") } diff --git a/internal/rpc/msg/statistics.go b/internal/rpc/msg/statistics.go index cfcbd7c82..872ec8f18 100644 --- a/internal/rpc/msg/statistics.go +++ b/internal/rpc/msg/statistics.go @@ -2,24 +2,15 @@ package msg import ( "context" - "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "time" ) func (m *msgServer) GetActiveUser(ctx context.Context, req *msg.GetActiveUserReq) (*msg.GetActiveUserResp, error) { - msgCount, userCount, users, dateCount, err := m.MsgDatabase.RangeUserSendCount( - ctx, - time.UnixMilli(req.Start), - time.UnixMilli(req.End), - req.Group, - req.Ase, - req.Pagination.PageNumber, - req.Pagination.ShowNumber, - ) + msgCount, userCount, users, dateCount, err := m.MsgDatabase.RangeUserSendCount(ctx, time.UnixMilli(req.Start), time.UnixMilli(req.End), req.Group, req.Ase, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } @@ -54,14 +45,7 @@ func (m *msgServer) GetActiveUser(ctx context.Context, req *msg.GetActiveUserReq } func (m *msgServer) GetActiveGroup(ctx context.Context, req *msg.GetActiveGroupReq) (*msg.GetActiveGroupResp, error) { - msgCount, groupCount, groups, dateCount, err := m.MsgDatabase.RangeGroupSendCount( - ctx, - time.UnixMilli(req.Start), - time.UnixMilli(req.End), - req.Ase, - req.Pagination.PageNumber, - req.Pagination.ShowNumber, - ) + msgCount, groupCount, groups, dateCount, err := m.MsgDatabase.RangeGroupSendCount(ctx, time.UnixMilli(req.Start), time.UnixMilli(req.End), req.Ase, req.Pagination.PageNumber, req.Pagination.ShowNumber) if err != nil { return nil, err } diff --git a/internal/rpc/third/s3.go b/internal/rpc/third/s3.go index bd26a6e42..4cbbd3d7d 100644 --- a/internal/rpc/third/s3.go +++ b/internal/rpc/third/s3.go @@ -2,8 +2,6 @@ package third import ( "context" - "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cont" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" @@ -11,6 +9,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "time" ) func (t *thirdServer) PartLimit(ctx context.Context, req *third.PartLimitReq) (*third.PartLimitResp, error) { @@ -30,10 +29,7 @@ func (t *thirdServer) PartSize(ctx context.Context, req *third.PartSizeReq) (*th return &third.PartSizeResp{Size: size}, nil } -func (t *thirdServer) InitiateMultipartUpload( - ctx context.Context, - req *third.InitiateMultipartUploadReq, -) (*third.InitiateMultipartUploadResp, error) { +func (t *thirdServer) InitiateMultipartUpload(ctx context.Context, req *third.InitiateMultipartUploadReq) (*third.InitiateMultipartUploadResp, error) { defer log.ZDebug(ctx, "return") if err := checkUploadName(ctx, req.Name); err != nil { return nil, err @@ -112,10 +108,7 @@ func (t *thirdServer) AuthSign(ctx context.Context, req *third.AuthSignReq) (*th return resp, nil } -func (t *thirdServer) CompleteMultipartUpload( - ctx context.Context, - req *third.CompleteMultipartUploadReq, -) (*third.CompleteMultipartUploadResp, error) { +func (t *thirdServer) CompleteMultipartUpload(ctx context.Context, req *third.CompleteMultipartUploadReq) (*third.CompleteMultipartUploadResp, error) { defer log.ZDebug(ctx, "return") if err := checkUploadName(ctx, req.Name); err != nil { return nil, err diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go index 02e5a1588..7c487b1d2 100644 --- a/internal/rpc/third/third.go +++ b/internal/rpc/third/third.go @@ -3,15 +3,12 @@ package third import ( "context" "fmt" - "net/url" - "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cos" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/minio" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/oss" - - "google.golang.org/grpc" + "net/url" + "time" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" @@ -21,6 +18,7 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" + "google.golang.org/grpc" ) func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error { @@ -79,10 +77,7 @@ type thirdServer struct { defaultExpire time.Duration } -func (t *thirdServer) FcmUpdateToken( - ctx context.Context, - req *third.FcmUpdateTokenReq, -) (resp *third.FcmUpdateTokenResp, err error) { +func (t *thirdServer) FcmUpdateToken(ctx context.Context, req *third.FcmUpdateTokenReq) (resp *third.FcmUpdateTokenResp, err error) { err = t.thirdDatabase.FcmUpdateToken(ctx, req.Account, int(req.PlatformID), req.FcmToken, req.ExpireTime) if err != nil { return nil, err @@ -90,10 +85,7 @@ func (t *thirdServer) FcmUpdateToken( return &third.FcmUpdateTokenResp{}, nil } -func (t *thirdServer) SetAppBadge( - ctx context.Context, - req *third.SetAppBadgeReq, -) (resp *third.SetAppBadgeResp, err error) { +func (t *thirdServer) SetAppBadge(ctx context.Context, req *third.SetAppBadgeReq) (resp *third.SetAppBadgeResp, err error) { err = t.thirdDatabase.SetAppBadge(ctx, req.UserID, int(req.AppUnreadCount)) if err != nil { return nil, err diff --git a/internal/rpc/third/tool.go b/internal/rpc/third/tool.go index 379731434..84017ae1f 100644 --- a/internal/rpc/third/tool.go +++ b/internal/rpc/third/tool.go @@ -4,13 +4,12 @@ import ( "context" "errors" "fmt" - "strings" - "unicode/utf8" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/tokenverify" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third" + "strings" + "unicode/utf8" ) func toPbMapArray(m map[string][]string) []*third.KeyValues { diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index cbf525d27..4619db4ce 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -3,11 +3,10 @@ package user import ( "context" "errors" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "strings" "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert" @@ -24,9 +23,8 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" - "google.golang.org/grpc" - "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "google.golang.org/grpc" ) type userServer struct { @@ -61,22 +59,16 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error { friendRpcClient := rpcclient.NewFriendRpcClient(client) msgRpcClient := rpcclient.NewMessageRpcClient(client) u := &userServer{ - UserDatabase: database, - RegisterCenter: client, - friendRpcClient: &friendRpcClient, - notificationSender: notification.NewFriendNotificationSender( - &msgRpcClient, - notification.WithDBFunc(database.FindWithError), - ), + UserDatabase: database, + RegisterCenter: client, + friendRpcClient: &friendRpcClient, + notificationSender: notification.NewFriendNotificationSender(&msgRpcClient, notification.WithDBFunc(database.FindWithError)), } pbuser.RegisterUserServer(server, u) return u.UserDatabase.InitOnce(context.Background(), users) } -func (s *userServer) GetDesignateUsers( - ctx context.Context, - req *pbuser.GetDesignateUsersReq, -) (resp *pbuser.GetDesignateUsersResp, err error) { +func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbuser.GetDesignateUsersReq) (resp *pbuser.GetDesignateUsersResp, err error) { resp = &pbuser.GetDesignateUsersResp{} users, err := s.FindWithError(ctx, req.UserIDs) if err != nil { @@ -89,10 +81,7 @@ func (s *userServer) GetDesignateUsers( return resp, nil } -func (s *userServer) UpdateUserInfo( - ctx context.Context, - req *pbuser.UpdateUserInfoReq, -) (resp *pbuser.UpdateUserInfoResp, err error) { +func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserInfoReq) (resp *pbuser.UpdateUserInfoResp, err error) { resp = &pbuser.UpdateUserInfoResp{} err = tokenverify.CheckAccessV3(ctx, req.UserInfo.UserID) if err != nil { @@ -117,10 +106,7 @@ func (s *userServer) UpdateUserInfo( return resp, nil } -func (s *userServer) SetGlobalRecvMessageOpt( - ctx context.Context, - req *pbuser.SetGlobalRecvMessageOptReq, -) (resp *pbuser.SetGlobalRecvMessageOptResp, err error) { +func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.SetGlobalRecvMessageOptReq) (resp *pbuser.SetGlobalRecvMessageOptResp, err error) { resp = &pbuser.SetGlobalRecvMessageOptResp{} if _, err := s.FindWithError(ctx, []string{req.UserID}); err != nil { return nil, err @@ -134,10 +120,7 @@ func (s *userServer) SetGlobalRecvMessageOpt( return resp, nil } -func (s *userServer) AccountCheck( - ctx context.Context, - req *pbuser.AccountCheckReq, -) (resp *pbuser.AccountCheckResp, err error) { +func (s *userServer) AccountCheck(ctx context.Context, req *pbuser.AccountCheckReq) (resp *pbuser.AccountCheckResp, err error) { resp = &pbuser.AccountCheckResp{} if utils.Duplicate(req.CheckUserIDs) { return nil, errs.ErrArgs.Wrap("userID repeated") @@ -166,10 +149,7 @@ func (s *userServer) AccountCheck( return resp, nil } -func (s *userServer) GetPaginationUsers( - ctx context.Context, - req *pbuser.GetPaginationUsersReq, -) (resp *pbuser.GetPaginationUsersResp, err error) { +func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbuser.GetPaginationUsersReq) (resp *pbuser.GetPaginationUsersResp, err error) { var pageNumber, showNumber int32 if req.Pagination != nil { pageNumber = req.Pagination.PageNumber @@ -182,10 +162,7 @@ func (s *userServer) GetPaginationUsers( return &pbuser.GetPaginationUsersResp{Total: int32(total), Users: convert.UsersDB2Pb(users)}, err } -func (s *userServer) UserRegister( - ctx context.Context, - req *pbuser.UserRegisterReq, -) (resp *pbuser.UserRegisterResp, err error) { +func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterReq) (resp *pbuser.UserRegisterResp, err error) { resp = &pbuser.UserRegisterResp{} if len(req.Users) == 0 { return nil, errs.ErrArgs.Wrap("users is empty") @@ -233,10 +210,7 @@ func (s *userServer) UserRegister( return resp, nil } -func (s *userServer) GetGlobalRecvMessageOpt( - ctx context.Context, - req *pbuser.GetGlobalRecvMessageOptReq, -) (resp *pbuser.GetGlobalRecvMessageOptResp, err error) { +func (s *userServer) GetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.GetGlobalRecvMessageOptReq) (resp *pbuser.GetGlobalRecvMessageOptResp, err error) { user, err := s.FindWithError(ctx, []string{req.UserID}) if err != nil { return nil, err @@ -244,10 +218,7 @@ func (s *userServer) GetGlobalRecvMessageOpt( return &pbuser.GetGlobalRecvMessageOptResp{GlobalRecvMsgOpt: user[0].GlobalRecvMsgOpt}, nil } -func (s *userServer) GetAllUserID( - ctx context.Context, - req *pbuser.GetAllUserIDReq, -) (resp *pbuser.GetAllUserIDResp, err error) { +func (s *userServer) GetAllUserID(ctx context.Context, req *pbuser.GetAllUserIDReq) (resp *pbuser.GetAllUserIDResp, err error) { userIDs, err := s.UserDatabase.GetAllUserID(ctx) if err != nil { return nil, err diff --git a/internal/tools/conversation.go b/internal/tools/conversation.go index 1fcab854e..1cad58248 100644 --- a/internal/tools/conversation.go +++ b/internal/tools/conversation.go @@ -19,60 +19,19 @@ func (c *MsgTool) ConversationsDestructMsgs() { } log.ZDebug(context.Background(), "nums conversations need destruct", "nums", len(conversations)) for _, conversation := range conversations { - log.ZDebug( - ctx, - "UserMsgsDestruct", - "conversationID", - conversation.ConversationID, - "ownerUserID", - conversation.OwnerUserID, - "msgDestructTime", - conversation.MsgDestructTime, - "lastMsgDestructTime", - conversation.LatestMsgDestructTime, - ) - seqs, err := c.msgDatabase.UserMsgsDestruct( - ctx, - conversation.OwnerUserID, - conversation.ConversationID, - conversation.MsgDestructTime, - conversation.LatestMsgDestructTime, - ) + log.ZDebug(ctx, "UserMsgsDestruct", "conversationID", conversation.ConversationID, "ownerUserID", conversation.OwnerUserID, "msgDestructTime", conversation.MsgDestructTime, "lastMsgDestructTime", conversation.LatestMsgDestructTime) + seqs, err := c.msgDatabase.UserMsgsDestruct(ctx, conversation.OwnerUserID, conversation.ConversationID, conversation.MsgDestructTime, conversation.LatestMsgDestructTime) if err != nil { - log.ZError( - ctx, - "user msg destruct failed", - err, - "conversationID", - conversation.ConversationID, - "ownerUserID", - conversation.OwnerUserID, - ) + log.ZError(ctx, "user msg destruct failed", err, "conversationID", conversation.ConversationID, "ownerUserID", conversation.OwnerUserID) continue } if err := c.conversationDatabase.UpdateUsersConversationFiled(ctx, []string{conversation.OwnerUserID}, conversation.ConversationID, map[string]interface{}{"latest_msg_destruct_time": time.Now()}); err != nil { - log.ZError( - ctx, - "updateUsersConversationFiled failed", - err, - "conversationID", - conversation.ConversationID, - "ownerUserID", - conversation.OwnerUserID, - ) + log.ZError(ctx, "updateUsersConversationFiled failed", err, "conversationID", conversation.ConversationID, "ownerUserID", conversation.OwnerUserID) continue } if len(seqs) > 0 { if err := c.msgNotificationSender.UserDeleteMsgsNotification(ctx, conversation.OwnerUserID, conversation.ConversationID, seqs); err != nil { - log.ZError( - ctx, - "userDeleteMsgsNotification failed", - err, - "conversationID", - conversation.ConversationID, - "ownerUserID", - conversation.OwnerUserID, - ) + log.ZError(ctx, "userDeleteMsgsNotification failed", err, "conversationID", conversation.ConversationID, "ownerUserID", conversation.OwnerUserID) } } } diff --git a/internal/tools/cron_task.go b/internal/tools/cron_task.go index e67c06671..5e4183615 100644 --- a/internal/tools/cron_task.go +++ b/internal/tools/cron_task.go @@ -34,19 +34,10 @@ func StartCronTask() error { c := cron.New() var wg sync.WaitGroup wg.Add(1) - log.ZInfo( - context.Background(), - "start chatRecordsClearTime cron task", - "cron config", - config.Config.ChatRecordsClearTime, - ) + log.ZInfo(context.Background(), "start chatRecordsClearTime cron task", "cron config", config.Config.ChatRecordsClearTime) _, err = c.AddFunc(config.Config.ChatRecordsClearTime, msgTool.AllConversationClearMsgAndFixSeq) if err != nil { - fmt.Println( - "start allConversationClearMsgAndFixSeq cron failed", - err.Error(), - config.Config.ChatRecordsClearTime, - ) + fmt.Println("start allConversationClearMsgAndFixSeq cron failed", err.Error(), config.Config.ChatRecordsClearTime) panic(err) } log.ZInfo(context.Background(), "start msgDestruct cron task", "cron config", config.Config.MsgDestructTime) diff --git a/internal/tools/msg.go b/internal/tools/msg.go index 9d57da768..7247d32eb 100644 --- a/internal/tools/msg.go +++ b/internal/tools/msg.go @@ -6,10 +6,6 @@ import ( "math" "time" - "github.com/redis/go-redis/v9" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller" @@ -24,6 +20,9 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "github.com/redis/go-redis/v9" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) type MsgTool struct { @@ -34,13 +33,8 @@ type MsgTool struct { msgNotificationSender *notification.MsgNotificationSender } -func NewMsgTool( - msgDatabase controller.CommonMsgDatabase, - userDatabase controller.UserDatabase, - groupDatabase controller.GroupDatabase, - conversationDatabase controller.ConversationDatabase, - msgNotificationSender *notification.MsgNotificationSender, -) *MsgTool { +func NewMsgTool(msgDatabase controller.CommonMsgDatabase, userDatabase controller.UserDatabase, + groupDatabase controller.GroupDatabase, conversationDatabase controller.ConversationDatabase, msgNotificationSender *notification.MsgNotificationSender) *MsgTool { return &MsgTool{ msgDatabase: msgDatabase, userDatabase: userDatabase, @@ -63,35 +57,18 @@ func InitMsgTool() (*MsgTool, error) { if err != nil { return nil, err } - discov, err := zookeeper.NewClient( - config.Config.Zookeeper.ZkAddr, - config.Config.Zookeeper.Schema, - zookeeper.WithFreq( - time.Hour, - ), - zookeeper.WithRoundRobin(), - zookeeper.WithUserNameAndPassword(config.Config.Zookeeper.Username, - config.Config.Zookeeper.Password), - zookeeper.WithTimeout(10), - zookeeper.WithLogger(log.NewZkLogger()), - ) + discov, err := zookeeper.NewClient(config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema, + zookeeper.WithFreq(time.Hour), zookeeper.WithRoundRobin(), zookeeper.WithUserNameAndPassword(config.Config.Zookeeper.Username, + config.Config.Zookeeper.Password), zookeeper.WithTimeout(10), zookeeper.WithLogger(log.NewZkLogger())) if err != nil { return nil, err } discov.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) userDB := relation.NewUserGorm(db) - msgDatabase := controller.InitCommonMsgDatabase(rdb, mongo.GetDatabase(), db) - userDatabase := controller.NewUserDatabase( - userDB, - cache.NewUserCacheRedis(rdb, relation.NewUserGorm(db), cache.GetDefaultOpt()), - tx.NewGorm(db), - ) + msgDatabase := controller.InitCommonMsgDatabase(rdb, mongo.GetDatabase()) + userDatabase := controller.NewUserDatabase(userDB, cache.NewUserCacheRedis(rdb, relation.NewUserGorm(db), cache.GetDefaultOpt()), tx.NewGorm(db)) groupDatabase := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase()) - conversationDatabase := controller.NewConversationDatabase( - relation.NewConversationGorm(db), - cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), relation.NewConversationGorm(db)), - tx.NewGorm(db), - ) + conversationDatabase := controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), relation.NewConversationGorm(db)), tx.NewGorm(db)) msgRpcClient := rpcclient.NewMessageRpcClient(discov) msgNotificationSender := notification.NewMsgNotificationSender(rpcclient.WithRpcClient(&msgRpcClient)) msgTool := NewMsgTool(msgDatabase, userDatabase, groupDatabase, conversationDatabase, msgNotificationSender) @@ -116,15 +93,7 @@ func (c *MsgTool) AllConversationClearMsgAndFixSeq() { func (c *MsgTool) ClearConversationsMsg(ctx context.Context, conversationIDs []string) { for _, conversationID := range conversationIDs { if err := c.msgDatabase.DeleteConversationMsgsAndSetMinSeq(ctx, conversationID, int64(config.Config.RetainChatRecords*24*60*60)); err != nil { - log.ZError( - ctx, - "DeleteUserSuperGroupMsgsAndSetMinSeq failed", - err, - "conversationID", - conversationID, - "DBRetainChatRecords", - config.Config.RetainChatRecords, - ) + log.ZError(ctx, "DeleteUserSuperGroupMsgsAndSetMinSeq failed", err, "conversationID", conversationID, "DBRetainChatRecords", config.Config.RetainChatRecords) } if err := c.checkMaxSeq(ctx, conversationID); err != nil { log.ZError(ctx, "fixSeq failed", err, "conversationID", conversationID) @@ -138,19 +107,7 @@ func (c *MsgTool) checkMaxSeqWithMongo(ctx context.Context, conversationID strin return err } if math.Abs(float64(maxSeqMongo-maxSeqCache)) > 10 { - log.ZError( - ctx, - "cache max seq and mongo max seq is diff > 10", - nil, - "maxSeqMongo", - maxSeqMongo, - "minSeqMongo", - minSeqMongo, - "maxSeqCache", - maxSeqCache, - "conversationID", - conversationID, - ) + log.ZError(ctx, "cache max seq and mongo max seq is diff > 10", nil, "maxSeqMongo", maxSeqMongo, "minSeqMongo", minSeqMongo, "maxSeqCache", maxSeqCache, "conversationID", conversationID) } return nil } diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go index a7649b468..7908d163a 100644 --- a/pkg/common/db/controller/conversation.go +++ b/pkg/common/db/controller/conversation.go @@ -14,22 +14,13 @@ import ( type ConversationDatabase interface { //UpdateUserConversationFiled 更新用户该会话的属性信息 - UpdateUsersConversationFiled( - ctx context.Context, - userIDs []string, - conversationID string, - args map[string]interface{}, - ) error + UpdateUsersConversationFiled(ctx context.Context, userIDs []string, conversationID string, args map[string]interface{}) error //CreateConversation 创建一批新的会话 CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error //SyncPeerUserPrivateConversation 同步对端私聊会话内部保证事务操作 SyncPeerUserPrivateConversationTx(ctx context.Context, conversation []*relationTb.ConversationModel) error //FindConversations 根据会话ID获取某个用户的多个会话 - FindConversations( - ctx context.Context, - ownerUserID string, - conversationIDs []string, - ) ([]*relationTb.ConversationModel, error) + FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) //FindRecvMsgNotNotifyUserIDs 获取超级大群开启免打扰的用户ID FindRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) ([]string, error) //GetUserAllConversation 获取一个用户在服务器上所有的会话 @@ -37,29 +28,17 @@ type ConversationDatabase interface { //SetUserConversations 设置用户多个会话属性,如果会话不存在则创建,否则更新,内部保证原子性 SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error //SetUsersConversationFiledTx 设置多个用户会话关于某个字段的更新操作,如果会话不存在则创建,否则更新,内部保证事务操作 - SetUsersConversationFiledTx( - ctx context.Context, - userIDs []string, - conversation *relationTb.ConversationModel, - filedMap map[string]interface{}, - ) error + SetUsersConversationFiledTx(ctx context.Context, userIDs []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) error CreateGroupChatConversation(ctx context.Context, groupID string, userIDs []string) error GetConversationIDs(ctx context.Context, userID string) ([]string, error) GetUserConversationIDsHash(ctx context.Context, ownerUserID string) (hash uint64, err error) GetAllConversationIDs(ctx context.Context) ([]string, error) GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error) - GetConversationsByConversationID( - ctx context.Context, - conversationIDs []string, - ) ([]*relationTb.ConversationModel, error) + GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*relationTb.ConversationModel, error) GetConversationIDsNeedDestruct(ctx context.Context) ([]*relationTb.ConversationModel, error) } -func NewConversationDatabase( - conversation relationTb.ConversationModelInterface, - cache cache.ConversationCache, - tx tx.Tx, -) ConversationDatabase { +func NewConversationDatabase(conversation relationTb.ConversationModelInterface, cache cache.ConversationCache, tx tx.Tx) ConversationDatabase { return &conversationDatabase{ conversationDB: conversation, cache: cache, @@ -73,12 +52,7 @@ type conversationDatabase struct { tx tx.Tx } -func (c *conversationDatabase) SetUsersConversationFiledTx( - ctx context.Context, - userIDs []string, - conversation *relationTb.ConversationModel, - filedMap map[string]interface{}, -) (err error) { +func (c *conversationDatabase) SetUsersConversationFiledTx(ctx context.Context, userIDs []string, conversation *relationTb.ConversationModel, filedMap map[string]interface{}) (err error) { cache := c.cache.NewCache() if err := c.tx.Transaction(func(tx any) error { conversationTx := c.conversationDB.NewTx(tx) @@ -126,12 +100,7 @@ func (c *conversationDatabase) SetUsersConversationFiledTx( return cache.ExecDel(ctx) } -func (c *conversationDatabase) UpdateUsersConversationFiled( - ctx context.Context, - userIDs []string, - conversationID string, - args map[string]interface{}, -) error { +func (c *conversationDatabase) UpdateUsersConversationFiled(ctx context.Context, userIDs []string, conversationID string, args map[string]interface{}) error { _, err := c.conversationDB.UpdateByMap(ctx, userIDs, conversationID, args) if err != nil { return err @@ -139,10 +108,7 @@ func (c *conversationDatabase) UpdateUsersConversationFiled( return c.cache.DelUsersConversation(conversationID, userIDs...).ExecDel(ctx) } -func (c *conversationDatabase) CreateConversation( - ctx context.Context, - conversations []*relationTb.ConversationModel, -) error { +func (c *conversationDatabase) CreateConversation(ctx context.Context, conversations []*relationTb.ConversationModel) error { if err := c.conversationDB.Create(ctx, conversations); err != nil { return err } @@ -155,10 +121,7 @@ func (c *conversationDatabase) CreateConversation( return cache.DelConversationIDs(userIDs...).DelUserConversationIDsHash(userIDs...).ExecDel(ctx) } -func (c *conversationDatabase) SyncPeerUserPrivateConversationTx( - ctx context.Context, - conversations []*relationTb.ConversationModel, -) error { +func (c *conversationDatabase) SyncPeerUserPrivateConversationTx(ctx context.Context, conversations []*relationTb.ConversationModel) error { cache := c.cache.NewCache() if err := c.tx.Transaction(func(tx any) error { conversationTx := c.conversationDB.NewTx(tx) @@ -196,34 +159,19 @@ func (c *conversationDatabase) SyncPeerUserPrivateConversationTx( return cache.ExecDel(ctx) } -func (c *conversationDatabase) FindConversations( - ctx context.Context, - ownerUserID string, - conversationIDs []string, -) ([]*relationTb.ConversationModel, error) { +func (c *conversationDatabase) FindConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*relationTb.ConversationModel, error) { return c.cache.GetConversations(ctx, ownerUserID, conversationIDs) } -func (c *conversationDatabase) GetConversation( - ctx context.Context, - ownerUserID string, - conversationID string, -) (*relationTb.ConversationModel, error) { +func (c *conversationDatabase) GetConversation(ctx context.Context, ownerUserID string, conversationID string) (*relationTb.ConversationModel, error) { return c.cache.GetConversation(ctx, ownerUserID, conversationID) } -func (c *conversationDatabase) GetUserAllConversation( - ctx context.Context, - ownerUserID string, -) ([]*relationTb.ConversationModel, error) { +func (c *conversationDatabase) GetUserAllConversation(ctx context.Context, ownerUserID string) ([]*relationTb.ConversationModel, error) { return c.cache.GetUserAllConversations(ctx, ownerUserID) } -func (c *conversationDatabase) SetUserConversations( - ctx context.Context, - ownerUserID string, - conversations []*relationTb.ConversationModel, -) error { +func (c *conversationDatabase) SetUserConversations(ctx context.Context, ownerUserID string, conversations []*relationTb.ConversationModel) error { cache := c.cache.NewCache() if err := c.tx.Transaction(func(tx any) error { var conversationIDs []string @@ -273,11 +221,7 @@ func (c *conversationDatabase) FindRecvMsgNotNotifyUserIDs(ctx context.Context, return c.cache.GetSuperGroupRecvMsgNotNotifyUserIDs(ctx, groupID) } -func (c *conversationDatabase) CreateGroupChatConversation( - ctx context.Context, - groupID string, - userIDs []string, -) error { +func (c *conversationDatabase) CreateGroupChatConversation(ctx context.Context, groupID string, userIDs []string) error { cache := c.cache.NewCache() conversationID := utils.GetConversationIDBySessionType(constant.SuperGroupChatType, groupID) if err := c.tx.Transaction(func(tx any) error { @@ -317,10 +261,7 @@ func (c *conversationDatabase) GetConversationIDs(ctx context.Context, userID st return c.cache.GetUserConversationIDs(ctx, userID) } -func (c *conversationDatabase) GetUserConversationIDsHash( - ctx context.Context, - ownerUserID string, -) (hash uint64, err error) { +func (c *conversationDatabase) GetUserConversationIDsHash(ctx context.Context, ownerUserID string) (hash uint64, err error) { return c.cache.GetUserConversationIDsHash(ctx, ownerUserID) } @@ -328,22 +269,14 @@ func (c *conversationDatabase) GetAllConversationIDs(ctx context.Context) ([]str return c.conversationDB.GetAllConversationIDs(ctx) } -func (c *conversationDatabase) GetUserAllHasReadSeqs( - ctx context.Context, - ownerUserID string, -) (map[string]int64, error) { +func (c *conversationDatabase) GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error) { return c.cache.GetUserAllHasReadSeqs(ctx, ownerUserID) } -func (c *conversationDatabase) GetConversationsByConversationID( - ctx context.Context, - conversationIDs []string, -) ([]*relationTb.ConversationModel, error) { +func (c *conversationDatabase) GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*relationTb.ConversationModel, error) { return c.conversationDB.GetConversationsByConversationID(ctx, conversationIDs) } -func (c *conversationDatabase) GetConversationIDsNeedDestruct( - ctx context.Context, -) ([]*relationTb.ConversationModel, error) { +func (c *conversationDatabase) GetConversationIDsNeedDestruct(ctx context.Context) ([]*relationTb.ConversationModel, error) { return c.conversationDB.GetConversationIDsNeedDestruct(ctx) } diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index fd465c103..9010e3350 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -573,10 +573,6 @@ func (g *groupDatabase) CountTotal(ctx context.Context, before *time.Time) (coun return g.groupDB.CountTotal(ctx, before) } -func (g *groupDatabase) CountRangeEverydayTotal( - ctx context.Context, - start time.Time, - end time.Time, -) (map[string]int64, error) { +func (g *groupDatabase) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) { return g.groupDB.CountRangeEverydayTotal(ctx, start, end) } diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index b9aefdc72..f23e7580c 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -1,9 +1,6 @@ package controller import ( - relation2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" - "gorm.io/gorm" "time" "github.com/redis/go-redis/v9" @@ -21,11 +18,10 @@ import ( "context" "errors" - "go.mongodb.org/mongo-driver/mongo" - pbMsg "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "go.mongodb.org/mongo-driver/mongo" ) const ( @@ -44,36 +40,16 @@ type CommonMsgDatabase interface { DeleteMessagesFromCache(ctx context.Context, conversationID string, seqs []int64) error DelUserDeleteMsgsList(ctx context.Context, conversationID string, seqs []int64) // incrSeq然后批量插入缓存 - BatchInsertChat2Cache( - ctx context.Context, - conversationID string, - msgs []*sdkws.MsgData, - ) (seq int64, isNewConversation bool, err error) + BatchInsertChat2Cache(ctx context.Context, conversationID string, msgs []*sdkws.MsgData) (seq int64, isNewConversation bool, err error) // 通过seqList获取mongo中写扩散消息 - GetMsgBySeqsRange( - ctx context.Context, - userID string, - conversationID string, - begin, end, num, userMaxSeq int64, - ) (minSeq int64, maxSeq int64, seqMsg []*sdkws.MsgData, err error) + GetMsgBySeqsRange(ctx context.Context, userID string, conversationID string, begin, end, num, userMaxSeq int64) (minSeq int64, maxSeq int64, seqMsg []*sdkws.MsgData, err error) // 通过seqList获取大群在 mongo里面的消息 - GetMsgBySeqs( - ctx context.Context, - userID string, - conversationID string, - seqs []int64, - ) (minSeq int64, maxSeq int64, seqMsg []*sdkws.MsgData, err error) + GetMsgBySeqs(ctx context.Context, userID string, conversationID string, seqs []int64) (minSeq int64, maxSeq int64, seqMsg []*sdkws.MsgData, err error) // 删除会话消息重置最小seq, remainTime为消息保留的时间单位秒,超时消息删除, 传0删除所有消息(此方法不删除redis cache) DeleteConversationMsgsAndSetMinSeq(ctx context.Context, conversationID string, remainTime int64) error // 用户标记删除过期消息返回标记删除的seq列表 - UserMsgsDestruct( - cte context.Context, - userID string, - conversationID string, - destructTime int64, - lastMsgDestructTime time.Time, - ) (seqs []int64, err error) + UserMsgsDestruct(cte context.Context, userID string, conversationID string, destructTime int64, lastMsgDestructTime time.Time) (seqs []int64, err error) // 用户根据seq删除消息 DeleteUserMsgsBySeqs(ctx context.Context, userID string, conversationID string, seqs []int64) error @@ -99,13 +75,9 @@ type CommonMsgDatabase interface { UserSetHasReadSeqs(ctx context.Context, userID string, hasReadSeqs map[string]int64) error GetMongoMaxAndMinSeq(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo int64, err error) - GetConversationMinMaxSeqInMongoAndCache( - ctx context.Context, - conversationID string, - ) (minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache int64, err error) + GetConversationMinMaxSeqInMongoAndCache(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache int64, err error) SetSendMsgStatus(ctx context.Context, id string, status int32) error GetSendMsgStatus(ctx context.Context, id string) (int32, error) - SearchMessage(ctx context.Context, req *pbMsg.SearchMessageReq) (msgData []*sdkws.MsgData, err error) // to mq MsgToMQ(ctx context.Context, key string, msg2mq *sdkws.MsgData) error @@ -113,28 +85,12 @@ type CommonMsgDatabase interface { MsgToPushMQ(ctx context.Context, key, conversarionID string, msg2mq *sdkws.MsgData) (int32, int64, error) MsgToMongoMQ(ctx context.Context, key, conversarionID string, msgs []*sdkws.MsgData, lastSeq int64) error - RangeUserSendCount( - ctx context.Context, - start time.Time, - end time.Time, - group bool, - ase bool, - pageNumber int32, - showNumber int32, - ) (msgCount int64, userCount int64, users []*unRelationTb.UserCount, dateCount map[string]int64, err error) - RangeGroupSendCount( - ctx context.Context, - start time.Time, - end time.Time, - ase bool, - pageNumber int32, - showNumber int32, - ) (msgCount int64, userCount int64, groups []*unRelationTb.GroupCount, dateCount map[string]int64, err error) + RangeUserSendCount(ctx context.Context, start time.Time, end time.Time, group bool, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, users []*unRelationTb.UserCount, dateCount map[string]int64, err error) + RangeGroupSendCount(ctx context.Context, start time.Time, end time.Time, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, groups []*unRelationTb.GroupCount, dateCount map[string]int64, err error) } -func NewCommonMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheModel cache.MsgModel, msgMyqModel relation.ChatLogModelInterface) CommonMsgDatabase { +func NewCommonMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheModel cache.MsgModel) CommonMsgDatabase { return &commonMsgDatabase{ - msgMyq: msgMyqModel, msgDocDatabase: msgDocModel, cache: cacheModel, producer: kafka.NewKafkaProducer(config.Config.Kafka.Addr, config.Config.Kafka.LatestMsgToRedis.Topic), @@ -143,18 +99,16 @@ func NewCommonMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheMo } } -func InitCommonMsgDatabase(rdb redis.UniversalClient, database *mongo.Database, dbGrom *gorm.DB) CommonMsgDatabase { +func InitCommonMsgDatabase(rdb redis.UniversalClient, database *mongo.Database) CommonMsgDatabase { cacheModel := cache.NewMsgCacheModel(rdb) msgDocModel := unrelation.NewMsgMongoDriver(database) - msgMyqModel := relation2.NewChatLogGorm(dbGrom) - CommonMsgDatabase := NewCommonMsgDatabase(msgDocModel, cacheModel, msgMyqModel) + CommonMsgDatabase := NewCommonMsgDatabase(msgDocModel, cacheModel) return CommonMsgDatabase } type commonMsgDatabase struct { msgDocDatabase unRelationTb.MsgDocModelInterface msg unRelationTb.MsgDocModel - msgMyq relation.ChatLogModelInterface cache cache.MsgModel producer *kafka.Producer producerToMongo *kafka.Producer @@ -167,32 +121,16 @@ func (db *commonMsgDatabase) MsgToMQ(ctx context.Context, key string, msg2mq *sd return err } -func (db *commonMsgDatabase) MsgToModifyMQ( - ctx context.Context, - key, conversationID string, - messages []*sdkws.MsgData, -) error { +func (db *commonMsgDatabase) MsgToModifyMQ(ctx context.Context, key, conversationID string, messages []*sdkws.MsgData) error { if len(messages) > 0 { - _, _, err := db.producerToModify.SendMessage( - ctx, - key, - &pbMsg.MsgDataToModifyByMQ{ConversationID: conversationID, Messages: messages}, - ) + _, _, err := db.producerToModify.SendMessage(ctx, key, &pbMsg.MsgDataToModifyByMQ{ConversationID: conversationID, Messages: messages}) return err } return nil } -func (db *commonMsgDatabase) MsgToPushMQ( - ctx context.Context, - key, conversationID string, - msg2mq *sdkws.MsgData, -) (int32, int64, error) { - partition, offset, err := db.producerToPush.SendMessage( - ctx, - key, - &pbMsg.PushMsgDataToMQ{MsgData: msg2mq, ConversationID: conversationID}, - ) +func (db *commonMsgDatabase) MsgToPushMQ(ctx context.Context, key, conversationID string, msg2mq *sdkws.MsgData) (int32, int64, error) { + partition, offset, err := db.producerToPush.SendMessage(ctx, key, &pbMsg.PushMsgDataToMQ{MsgData: msg2mq, ConversationID: conversationID}) if err != nil { log.ZError(ctx, "MsgToPushMQ", err, "key", key, "msg2mq", msg2mq) return 0, 0, err @@ -200,30 +138,15 @@ func (db *commonMsgDatabase) MsgToPushMQ( return partition, offset, nil } -func (db *commonMsgDatabase) MsgToMongoMQ( - ctx context.Context, - key, conversationID string, - messages []*sdkws.MsgData, - lastSeq int64, -) error { +func (db *commonMsgDatabase) MsgToMongoMQ(ctx context.Context, key, conversationID string, messages []*sdkws.MsgData, lastSeq int64) error { if len(messages) > 0 { - _, _, err := db.producerToMongo.SendMessage( - ctx, - key, - &pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, ConversationID: conversationID, MsgData: messages}, - ) + _, _, err := db.producerToMongo.SendMessage(ctx, key, &pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, ConversationID: conversationID, MsgData: messages}) return err } return nil } -func (db *commonMsgDatabase) BatchInsertBlock( - ctx context.Context, - conversationID string, - fields []any, - key int8, - firstSeq int64, -) error { +func (db *commonMsgDatabase) BatchInsertBlock(ctx context.Context, conversationID string, fields []any, key int8, firstSeq int64) error { if len(fields) == 0 { return nil } @@ -324,12 +247,7 @@ func (db *commonMsgDatabase) BatchInsertBlock( return nil } -func (db *commonMsgDatabase) BatchInsertChat2DB( - ctx context.Context, - conversationID string, - msgList []*sdkws.MsgData, - currentMaxSeq int64, -) error { +func (db *commonMsgDatabase) BatchInsertChat2DB(ctx context.Context, conversationID string, msgList []*sdkws.MsgData, currentMaxSeq int64) error { if len(msgList) == 0 { return errs.ErrArgs.Wrap("msgList is empty") } @@ -375,21 +293,11 @@ func (db *commonMsgDatabase) BatchInsertChat2DB( return db.BatchInsertBlock(ctx, conversationID, msgs, updateKeyMsg, msgList[0].Seq) } -func (db *commonMsgDatabase) RevokeMsg( - ctx context.Context, - conversationID string, - seq int64, - revoke *unRelationTb.RevokeModel, -) error { +func (db *commonMsgDatabase) RevokeMsg(ctx context.Context, conversationID string, seq int64, revoke *unRelationTb.RevokeModel) error { return db.BatchInsertBlock(ctx, conversationID, []any{revoke}, updateKeyRevoke, seq) } -func (db *commonMsgDatabase) MarkSingleChatMsgsAsRead( - ctx context.Context, - userID string, - conversationID string, - totalSeqs []int64, -) error { +func (db *commonMsgDatabase) MarkSingleChatMsgsAsRead(ctx context.Context, userID string, conversationID string, totalSeqs []int64) error { for docID, seqs := range db.msg.GetDocIDSeqsMap(conversationID, totalSeqs) { var indexes []int64 for _, seq := range seqs { @@ -412,11 +320,7 @@ func (db *commonMsgDatabase) DelUserDeleteMsgsList(ctx context.Context, conversa db.cache.DelUserDeleteMsgsList(ctx, conversationID, seqs) } -func (db *commonMsgDatabase) BatchInsertChat2Cache( - ctx context.Context, - conversationID string, - msgs []*sdkws.MsgData, -) (seq int64, isNew bool, err error) { +func (db *commonMsgDatabase) BatchInsertChat2Cache(ctx context.Context, conversationID string, msgs []*sdkws.MsgData) (seq int64, isNew bool, err error) { currentMaxSeq, err := db.cache.GetMaxSeq(ctx, conversationID) if err != nil && errs.Unwrap(err) != redis.Nil { prome.Inc(prome.SeqGetFailedCounter) @@ -463,11 +367,7 @@ func (db *commonMsgDatabase) BatchInsertChat2Cache( return lastMaxSeq, isNew, utils.Wrap(err, "") } -func (db *commonMsgDatabase) getMsgBySeqs( - ctx context.Context, - userID, conversationID string, - seqs []int64, -) (totalMsgs []*sdkws.MsgData, err error) { +func (db *commonMsgDatabase) getMsgBySeqs(ctx context.Context, userID, conversationID string, seqs []int64) (totalMsgs []*sdkws.MsgData, err error) { for docID, seqs := range db.msg.GetDocIDSeqsMap(conversationID, seqs) { //log.ZDebug(ctx, "getMsgBySeqs", "docID", docID, "seqs", seqs) msgs, err := db.findMsgInfoBySeq(ctx, userID, docID, seqs) @@ -481,11 +381,7 @@ func (db *commonMsgDatabase) getMsgBySeqs( return totalMsgs, nil } -func (db *commonMsgDatabase) findMsgInfoBySeq( - ctx context.Context, - userID, docID string, - seqs []int64, -) (totalMsgs []*unRelationTb.MsgInfoModel, err error) { +func (db *commonMsgDatabase) findMsgInfoBySeq(ctx context.Context, userID, docID string, seqs []int64) (totalMsgs []*unRelationTb.MsgInfoModel, err error) { msgs, err := db.msgDocDatabase.GetMsgBySeqIndexIn1Doc(ctx, userID, docID, seqs) for _, msg := range msgs { if msg.IsRead { @@ -495,25 +391,8 @@ func (db *commonMsgDatabase) findMsgInfoBySeq( return msgs, err } -func (db *commonMsgDatabase) getMsgBySeqsRange( - ctx context.Context, - userID string, - conversationID string, - allSeqs []int64, - begin, end int64, -) (seqMsgs []*sdkws.MsgData, err error) { - log.ZDebug( - ctx, - "getMsgBySeqsRange", - "conversationID", - conversationID, - "allSeqs", - allSeqs, - "begin", - begin, - "end", - end, - ) +func (db *commonMsgDatabase) getMsgBySeqsRange(ctx context.Context, userID string, conversationID string, allSeqs []int64, begin, end int64) (seqMsgs []*sdkws.MsgData, err error) { + log.ZDebug(ctx, "getMsgBySeqsRange", "conversationID", conversationID, "allSeqs", allSeqs, "begin", begin, "end", end) for docID, seqs := range db.msg.GetDocIDSeqsMap(conversationID, allSeqs) { log.ZDebug(ctx, "getMsgBySeqsRange", "docID", docID, "seqs", seqs) msgs, err := db.findMsgInfoBySeq(ctx, userID, docID, seqs) @@ -530,12 +409,7 @@ func (db *commonMsgDatabase) getMsgBySeqsRange( return seqMsgs, nil } -func (db *commonMsgDatabase) GetMsgBySeqsRange( - ctx context.Context, - userID string, - conversationID string, - begin, end, num, userMaxSeq int64, -) (int64, int64, []*sdkws.MsgData, error) { +func (db *commonMsgDatabase) GetMsgBySeqsRange(ctx context.Context, userID string, conversationID string, begin, end, num, userMaxSeq int64) (int64, int64, []*sdkws.MsgData, error) { userMinSeq, err := db.cache.GetConversationUserMinSeq(ctx, conversationID, userID) if err != nil && errs.Unwrap(err) != redis.Nil { return 0, 0, nil, err @@ -555,18 +429,7 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange( if err != nil && errs.Unwrap(err) != redis.Nil { return 0, 0, nil, err } - log.ZDebug( - ctx, - "GetMsgBySeqsRange", - "userMinSeq", - userMinSeq, - "conMinSeq", - minSeq, - "conMaxSeq", - maxSeq, - "userMaxSeq", - userMaxSeq, - ) + log.ZDebug(ctx, "GetMsgBySeqsRange", "userMinSeq", userMinSeq, "conMinSeq", minSeq, "conMaxSeq", maxSeq, "userMaxSeq", userMaxSeq) if userMaxSeq != 0 { if userMaxSeq < maxSeq { maxSeq = userMaxSeq @@ -616,18 +479,7 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange( cacheDelNum += 1 } } - log.ZDebug( - ctx, - "get delSeqs from redis", - "delSeqs", - delSeqs, - "userID", - userID, - "conversationID", - conversationID, - "cacheDelNum", - cacheDelNum, - ) + log.ZDebug(ctx, "get delSeqs from redis", "delSeqs", delSeqs, "userID", userID, "conversationID", conversationID, "cacheDelNum", cacheDelNum) var reGetSeqsCache []int64 for i := 1; i <= cacheDelNum; { newSeq := newBegin - int64(i) @@ -647,15 +499,7 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange( if err != nil { if err != redis.Nil { prome.Add(prome.MsgPullFromRedisFailedCounter, len(failedSeqs2)) - log.ZError( - ctx, - "get message from redis exception", - err, - "conversationID", - conversationID, - "seqs", - reGetSeqsCache, - ) + log.ZError(ctx, "get message from redis exception", err, "conversationID", conversationID, "seqs", reGetSeqsCache) } } failedSeqs = append(failedSeqs, failedSeqs2...) @@ -681,12 +525,7 @@ func (db *commonMsgDatabase) GetMsgBySeqsRange( return minSeq, maxSeq, successMsgs, nil } -func (db *commonMsgDatabase) GetMsgBySeqs( - ctx context.Context, - userID string, - conversationID string, - seqs []int64, -) (int64, int64, []*sdkws.MsgData, error) { +func (db *commonMsgDatabase) GetMsgBySeqs(ctx context.Context, userID string, conversationID string, seqs []int64) (int64, int64, []*sdkws.MsgData, error) { userMinSeq, err := db.cache.GetConversationUserMinSeq(ctx, conversationID, userID) if err != nil && errs.Unwrap(err) != redis.Nil { return 0, 0, nil, err @@ -712,33 +551,10 @@ func (db *commonMsgDatabase) GetMsgBySeqs( if err != nil { if err != redis.Nil { prome.Add(prome.MsgPullFromRedisFailedCounter, len(failedSeqs)) - log.ZError( - ctx, - "get message from redis exception", - err, - "failedSeqs", - failedSeqs, - "conversationID", - conversationID, - ) + log.ZError(ctx, "get message from redis exception", err, "failedSeqs", failedSeqs, "conversationID", conversationID) } } - log.ZInfo( - ctx, - "db.cache.GetMessagesBySeq", - "userID", - userID, - "conversationID", - conversationID, - "seqs", - seqs, - "successMsgs", - len(successMsgs), - "failedSeqs", - failedSeqs, - "conversationID", - conversationID, - ) + log.ZInfo(ctx, "db.cache.GetMessagesBySeq", "userID", userID, "conversationID", conversationID, "seqs", seqs, "successMsgs", len(successMsgs), "failedSeqs", failedSeqs, "conversationID", conversationID) prome.Add(prome.MsgPullFromRedisSuccessCounter, len(successMsgs)) if len(failedSeqs) > 0 { mongoMsgs, err := db.getMsgBySeqs(ctx, userID, conversationID, failedSeqs) @@ -752,11 +568,7 @@ func (db *commonMsgDatabase) GetMsgBySeqs( return minSeq, maxSeq, successMsgs, nil } -func (db *commonMsgDatabase) DeleteConversationMsgsAndSetMinSeq( - ctx context.Context, - conversationID string, - remainTime int64, -) error { +func (db *commonMsgDatabase) DeleteConversationMsgsAndSetMinSeq(ctx context.Context, conversationID string, remainTime int64) error { var delStruct delMsgRecursionStruct var skip int64 minSeq, err := db.deleteMsgRecursion(ctx, conversationID, skip, &delStruct, remainTime) @@ -776,13 +588,7 @@ func (db *commonMsgDatabase) DeleteConversationMsgsAndSetMinSeq( return db.cache.SetMinSeq(ctx, conversationID, minSeq) } -func (db *commonMsgDatabase) UserMsgsDestruct( - ctx context.Context, - userID string, - conversationID string, - destructTime int64, - lastMsgDestructTime time.Time, -) (seqs []int64, err error) { +func (db *commonMsgDatabase) UserMsgsDestruct(ctx context.Context, userID string, conversationID string, destructTime int64, lastMsgDestructTime time.Time) (seqs []int64, err error) { var index int64 for { // from oldest 2 newest @@ -790,16 +596,7 @@ func (db *commonMsgDatabase) UserMsgsDestruct( if err != nil || msgDocModel.DocID == "" { if err != nil { if err == unrelation.ErrMsgListNotExist { - log.ZDebug( - ctx, - "deleteMsgRecursion finished", - "conversationID", - conversationID, - "userID", - userID, - "index", - index, - ) + log.ZDebug(ctx, "deleteMsgRecursion finished", "conversationID", conversationID, "userID", userID, "index", index) } else { log.ZError(ctx, "deleteMsgRecursion GetUserMsgListByIndex failed", err, "conversationID", conversationID, "index", index) } @@ -848,26 +645,13 @@ func (d *delMsgRecursionStruct) getSetMinSeq() int64 { // seq 70 // set minSeq 21 // recursion 删除list并且返回设置的最小seq -func (db *commonMsgDatabase) deleteMsgRecursion( - ctx context.Context, - conversationID string, - index int64, - delStruct *delMsgRecursionStruct, - remainTime int64, -) (int64, error) { +func (db *commonMsgDatabase) deleteMsgRecursion(ctx context.Context, conversationID string, index int64, delStruct *delMsgRecursionStruct, remainTime int64) (int64, error) { // find from oldest list msgDocModel, err := db.msgDocDatabase.GetMsgDocModelByIndex(ctx, conversationID, index, 1) if err != nil || msgDocModel.DocID == "" { if err != nil { if err == unrelation.ErrMsgListNotExist { - log.ZDebug( - ctx, - "deleteMsgRecursion ErrMsgListNotExist", - "conversationID", - conversationID, - "index:", - index, - ) + log.ZDebug(ctx, "deleteMsgRecursion ErrMsgListNotExist", "conversationID", conversationID, "index:", index) } else { log.ZError(ctx, "deleteMsgRecursion GetUserMsgListByIndex failed", err, "conversationID", conversationID, "index", index) } @@ -879,23 +663,11 @@ func (db *commonMsgDatabase) deleteMsgRecursion( } return delStruct.getSetMinSeq() + 1, nil } - log.ZDebug( - ctx, - "doc info", - "conversationID", - conversationID, - "index", - index, - "docID", - msgDocModel.DocID, - "len", - len(msgDocModel.Msg), - ) + log.ZDebug(ctx, "doc info", "conversationID", conversationID, "index", index, "docID", msgDocModel.DocID, "len", len(msgDocModel.Msg)) if int64(len(msgDocModel.Msg)) > db.msg.GetSingleGocMsgNum() { log.ZWarn(ctx, "msgs too large", nil, "lenth", len(msgDocModel.Msg), "docID:", msgDocModel.DocID) } - if msgDocModel.IsFull() && - msgDocModel.Msg[len(msgDocModel.Msg)-1].Msg.SendTime+(remainTime*1000) < utils.GetCurrentTimestampByMill() { + if msgDocModel.IsFull() && msgDocModel.Msg[len(msgDocModel.Msg)-1].Msg.SendTime+(remainTime*1000) < utils.GetCurrentTimestampByMill() { log.ZDebug(ctx, "doc is full and all msg is expired", "docID", msgDocModel.DocID) delStruct.delDocIDs = append(delStruct.delDocIDs, msgDocModel.DocID) delStruct.minSeq = msgDocModel.Msg[len(msgDocModel.Msg)-1].Msg.Seq @@ -932,11 +704,7 @@ func (db *commonMsgDatabase) deleteMsgRecursion( return seq, err } -func (db *commonMsgDatabase) DeleteMsgsPhysicalBySeqs( - ctx context.Context, - conversationID string, - allSeqs []int64, -) error { +func (db *commonMsgDatabase) DeleteMsgsPhysicalBySeqs(ctx context.Context, conversationID string, allSeqs []int64) error { if err := db.cache.DeleteMessages(ctx, conversationID, allSeqs); err != nil { return err } @@ -952,12 +720,7 @@ func (db *commonMsgDatabase) DeleteMsgsPhysicalBySeqs( return nil } -func (db *commonMsgDatabase) DeleteUserMsgsBySeqs( - ctx context.Context, - userID string, - conversationID string, - seqs []int64, -) error { +func (db *commonMsgDatabase) DeleteUserMsgsBySeqs(ctx context.Context, userID string, conversationID string, seqs []int64) error { cachedMsgs, _, err := db.cache.GetMessagesBySeq(ctx, conversationID, seqs) if err != nil && errs.Unwrap(err) != redis.Nil { log.ZWarn(ctx, "DeleteUserMsgsBySeqs", err, "conversationID", conversationID, "seqs", seqs) @@ -1026,70 +789,31 @@ func (db *commonMsgDatabase) GetMinSeqs(ctx context.Context, conversationIDs []s func (db *commonMsgDatabase) GetMinSeq(ctx context.Context, conversationID string) (int64, error) { return db.cache.GetMinSeq(ctx, conversationID) } - -func (db *commonMsgDatabase) GetConversationUserMinSeq( - ctx context.Context, - conversationID string, - userID string, -) (int64, error) { +func (db *commonMsgDatabase) GetConversationUserMinSeq(ctx context.Context, conversationID string, userID string) (int64, error) { return db.cache.GetConversationUserMinSeq(ctx, conversationID, userID) } - -func (db *commonMsgDatabase) GetConversationUserMinSeqs( - ctx context.Context, - conversationID string, - userIDs []string, -) (map[string]int64, error) { +func (db *commonMsgDatabase) GetConversationUserMinSeqs(ctx context.Context, conversationID string, userIDs []string) (map[string]int64, error) { return db.cache.GetConversationUserMinSeqs(ctx, conversationID, userIDs) } - -func (db *commonMsgDatabase) SetConversationUserMinSeq( - ctx context.Context, - conversationID string, - userID string, - minSeq int64, -) error { +func (db *commonMsgDatabase) SetConversationUserMinSeq(ctx context.Context, conversationID string, userID string, minSeq int64) error { return db.cache.SetConversationUserMinSeq(ctx, conversationID, userID, minSeq) } - -func (db *commonMsgDatabase) SetConversationUserMinSeqs( - ctx context.Context, - conversationID string, - seqs map[string]int64, -) (err error) { +func (db *commonMsgDatabase) SetConversationUserMinSeqs(ctx context.Context, conversationID string, seqs map[string]int64) (err error) { return db.cache.SetConversationUserMinSeqs(ctx, conversationID, seqs) } -func (db *commonMsgDatabase) SetUserConversationsMinSeqs( - ctx context.Context, - userID string, - seqs map[string]int64, -) error { +func (db *commonMsgDatabase) SetUserConversationsMinSeqs(ctx context.Context, userID string, seqs map[string]int64) error { return db.cache.SetUserConversationsMinSeqs(ctx, userID, seqs) } -func (db *commonMsgDatabase) UserSetHasReadSeqs( - ctx context.Context, - userID string, - hasReadSeqs map[string]int64, -) error { +func (db *commonMsgDatabase) UserSetHasReadSeqs(ctx context.Context, userID string, hasReadSeqs map[string]int64) error { return db.cache.UserSetHasReadSeqs(ctx, userID, hasReadSeqs) } -func (db *commonMsgDatabase) SetHasReadSeq( - ctx context.Context, - userID string, - conversationID string, - hasReadSeq int64, -) error { +func (db *commonMsgDatabase) SetHasReadSeq(ctx context.Context, userID string, conversationID string, hasReadSeq int64) error { return db.cache.SetHasReadSeq(ctx, userID, conversationID, hasReadSeq) } - -func (db *commonMsgDatabase) GetHasReadSeqs( - ctx context.Context, - userID string, - conversationIDs []string, -) (map[string]int64, error) { +func (db *commonMsgDatabase) GetHasReadSeqs(ctx context.Context, userID string, conversationIDs []string) (map[string]int64, error) { return db.cache.GetHasReadSeqs(ctx, userID, conversationIDs) } @@ -1105,10 +829,7 @@ func (db *commonMsgDatabase) GetSendMsgStatus(ctx context.Context, id string) (i return db.cache.GetSendMsgStatus(ctx, id) } -func (db *commonMsgDatabase) GetConversationMinMaxSeqInMongoAndCache( - ctx context.Context, - conversationID string, -) (minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache int64, err error) { +func (db *commonMsgDatabase) GetConversationMinMaxSeqInMongoAndCache(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache int64, err error) { minSeqMongo, maxSeqMongo, err = db.GetMinMaxSeqMongo(ctx, conversationID) if err != nil { return @@ -1124,17 +845,11 @@ func (db *commonMsgDatabase) GetConversationMinMaxSeqInMongoAndCache( return } -func (db *commonMsgDatabase) GetMongoMaxAndMinSeq( - ctx context.Context, - conversationID string, -) (minSeqMongo, maxSeqMongo int64, err error) { +func (db *commonMsgDatabase) GetMongoMaxAndMinSeq(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo int64, err error) { return db.GetMinMaxSeqMongo(ctx, conversationID) } -func (db *commonMsgDatabase) GetMinMaxSeqMongo( - ctx context.Context, - conversationID string, -) (minSeqMongo, maxSeqMongo int64, err error) { +func (db *commonMsgDatabase) GetMinMaxSeqMongo(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo int64, err error) { oldestMsgMongo, err := db.msgDocDatabase.GetOldestMsg(ctx, conversationID) if err != nil { return @@ -1148,37 +863,10 @@ func (db *commonMsgDatabase) GetMinMaxSeqMongo( return } -func (db *commonMsgDatabase) RangeUserSendCount( - ctx context.Context, - start time.Time, - end time.Time, - group bool, - ase bool, - pageNumber int32, - showNumber int32, -) (msgCount int64, userCount int64, users []*unRelationTb.UserCount, dateCount map[string]int64, err error) { +func (db *commonMsgDatabase) RangeUserSendCount(ctx context.Context, start time.Time, end time.Time, group bool, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, users []*unRelationTb.UserCount, dateCount map[string]int64, err error) { return db.msgDocDatabase.RangeUserSendCount(ctx, start, end, group, ase, pageNumber, showNumber) } -func (db *commonMsgDatabase) RangeGroupSendCount( - ctx context.Context, - start time.Time, - end time.Time, - ase bool, - pageNumber int32, - showNumber int32, -) (msgCount int64, userCount int64, groups []*unRelationTb.GroupCount, dateCount map[string]int64, err error) { +func (db *commonMsgDatabase) RangeGroupSendCount(ctx context.Context, start time.Time, end time.Time, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, groups []*unRelationTb.GroupCount, dateCount map[string]int64, err error) { return db.msgDocDatabase.RangeGroupSendCount(ctx, start, end, ase, pageNumber, showNumber) } - -func (db *commonMsgDatabase) SearchMessage(ctx context.Context, req *pbMsg.SearchMessageReq) (msgData []*sdkws.MsgData, err error) { - var totalMsgs []*sdkws.MsgData - msgs, err := db.msgDocDatabase.SearchMessage(ctx, req) - if err != nil { - return nil, err - } - for _, msg := range msgs { - totalMsgs = append(totalMsgs, convert.MsgDB2Pb(msg.Msg)) - } - return totalMsgs, nil -} diff --git a/pkg/common/db/controller/s3.go b/pkg/common/db/controller/s3.go index 83f81519a..b3cc9dbb4 100644 --- a/pkg/common/db/controller/s3.go +++ b/pkg/common/db/controller/s3.go @@ -2,25 +2,18 @@ package controller import ( "context" - "path/filepath" - "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3/cont" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" + "path/filepath" + "time" ) type S3Database interface { PartLimit() *s3.PartLimit PartSize(ctx context.Context, size int64) (int64, error) AuthSign(ctx context.Context, uploadID string, partNumbers []int) (*s3.AuthSignResult, error) - InitiateMultipartUpload( - ctx context.Context, - hash string, - size int64, - expire time.Duration, - maxParts int, - ) (*cont.InitiateUploadResult, error) + InitiateMultipartUpload(ctx context.Context, hash string, size int64, expire time.Duration, maxParts int) (*cont.InitiateUploadResult, error) CompleteMultipartUpload(ctx context.Context, uploadID string, parts []string) (*cont.UploadResult, error) AccessURL(ctx context.Context, name string, expire time.Duration) (time.Time, string, error) SetObject(ctx context.Context, info *relation.ObjectModel) error @@ -50,21 +43,11 @@ func (s *s3Database) AuthSign(ctx context.Context, uploadID string, partNumbers return s.s3.AuthSign(ctx, uploadID, partNumbers) } -func (s *s3Database) InitiateMultipartUpload( - ctx context.Context, - hash string, - size int64, - expire time.Duration, - maxParts int, -) (*cont.InitiateUploadResult, error) { +func (s *s3Database) InitiateMultipartUpload(ctx context.Context, hash string, size int64, expire time.Duration, maxParts int) (*cont.InitiateUploadResult, error) { return s.s3.InitiateUpload(ctx, hash, size, expire, maxParts) } -func (s *s3Database) CompleteMultipartUpload( - ctx context.Context, - uploadID string, - parts []string, -) (*cont.UploadResult, error) { +func (s *s3Database) CompleteMultipartUpload(ctx context.Context, uploadID string, parts []string) (*cont.UploadResult, error) { return s.s3.CompleteUpload(ctx, uploadID, parts) } diff --git a/pkg/common/db/relation/group_model.go b/pkg/common/db/relation/group_model.go index d115dd016..f3e1aec2f 100644 --- a/pkg/common/db/relation/group_model.go +++ b/pkg/common/db/relation/group_model.go @@ -2,15 +2,12 @@ package relation import ( "context" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" - "time" - - "gorm.io/gorm" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/ormutil" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "gorm.io/gorm" + "time" ) var _ relation.GroupModelInterface = (*GroupGorm)(nil) @@ -36,13 +33,7 @@ func (g *GroupGorm) UpdateMap(ctx context.Context, groupID string, args map[stri } func (g *GroupGorm) UpdateStatus(ctx context.Context, groupID string, status int32) (err error) { - return utils.Wrap( - g.DB.Where("group_id = ?", groupID). - Model(&relation.GroupModel{}). - Updates(map[string]any{"status": status}). - Error, - "", - ) + return utils.Wrap(g.DB.Where("group_id = ?", groupID).Model(&relation.GroupModel{}).Updates(map[string]any{"status": status}).Error, "") } func (g *GroupGorm) Find(ctx context.Context, groupIDs []string) (groups []*relation.GroupModel, err error) { @@ -54,21 +45,12 @@ func (g *GroupGorm) Take(ctx context.Context, groupID string) (group *relation.G return group, utils.Wrap(g.DB.Where("group_id = ?", groupID).Take(group).Error, "") } -func (g *GroupGorm) Search( - ctx context.Context, - keyword string, - pageNumber, showNumber int32, -) (total uint32, groups []*relation.GroupModel, err error) { - db := g.DB - db = db.WithContext(ctx).Where("status!=?", constant.GroupStatusDismissed) - return ormutil.GormSearch[relation.GroupModel](db, []string{"name"}, keyword, pageNumber, showNumber) +func (g *GroupGorm) Search(ctx context.Context, keyword string, pageNumber, showNumber int32) (total uint32, groups []*relation.GroupModel, err error) { + return ormutil.GormSearch[relation.GroupModel](g.DB, []string{"name"}, keyword, pageNumber, showNumber) } func (g *GroupGorm) GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) { - return groupIDs, utils.Wrap( - g.DB.Model(&relation.GroupModel{}).Where("group_type = ? ", groupType).Pluck("group_id", &groupIDs).Error, - "", - ) + return groupIDs, utils.Wrap(g.DB.Model(&relation.GroupModel{}).Where("group_type = ? ", groupType).Pluck("group_id", &groupIDs).Error, "") } func (g *GroupGorm) CountTotal(ctx context.Context, before *time.Time) (count int64, err error) { @@ -82,22 +64,12 @@ func (g *GroupGorm) CountTotal(ctx context.Context, before *time.Time) (count in return count, nil } -func (g *GroupGorm) CountRangeEverydayTotal( - ctx context.Context, - start time.Time, - end time.Time, -) (map[string]int64, error) { +func (g *GroupGorm) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) { var res []struct { Date time.Time `gorm:"column:date"` Count int64 `gorm:"column:count"` } - err := g.db(ctx). - Model(&relation.GroupModel{}). - Select("DATE(create_time) AS date, count(1) AS count"). - Where("create_time >= ? and create_time < ?", start, end). - Group("date"). - Find(&res). - Error + err := g.db(ctx).Model(&relation.GroupModel{}).Select("DATE(create_time) AS date, count(1) AS count").Where("create_time >= ? and create_time < ?", start, end).Group("date").Find(&res).Error if err != nil { return nil, errs.Wrap(err) } diff --git a/pkg/common/db/s3/cont/controller.go b/pkg/common/db/s3/cont/controller.go index 409f432f9..ba834a739 100644 --- a/pkg/common/db/s3/cont/controller.go +++ b/pkg/common/db/s3/cont/controller.go @@ -6,15 +6,13 @@ import ( "encoding/hex" "errors" "fmt" - "path" - "strings" - "time" - - "github.com/google/uuid" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" + "github.com/google/uuid" + "path" + "strings" + "time" ) func New(impl s3.Interface) *Controller { @@ -58,13 +56,7 @@ func (c *Controller) GetHashObject(ctx context.Context, hash string) (*s3.Object return c.impl.StatObject(ctx, c.HashPath(hash)) } -func (c *Controller) InitiateUpload( - ctx context.Context, - hash string, - size int64, - expire time.Duration, - maxParts int, -) (*InitiateUploadResult, error) { +func (c *Controller) InitiateUpload(ctx context.Context, hash string, size int64, expire time.Duration, maxParts int) (*InitiateUploadResult, error) { defer log.ZDebug(ctx, "return") if size < 0 { return nil, errors.New("invalid size") @@ -247,11 +239,6 @@ func (c *Controller) IsNotFound(err error) bool { return c.impl.IsNotFound(err) } -func (c *Controller) AccessURL( - ctx context.Context, - name string, - expire time.Duration, - opt *s3.AccessURLOption, -) (string, error) { +func (c *Controller) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { return c.impl.AccessURL(ctx, name, expire, opt) } diff --git a/pkg/common/db/s3/cont/error.go b/pkg/common/db/s3/cont/error.go index 67ed3ec69..afd1d0eba 100644 --- a/pkg/common/db/s3/cont/error.go +++ b/pkg/common/db/s3/cont/error.go @@ -2,7 +2,6 @@ package cont import ( "fmt" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" ) diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 545f8b934..4b1b4aa4d 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -4,16 +4,14 @@ import ( "context" "errors" "fmt" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" + "github.com/tencentyun/cos-go-sdk-v5" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/tencentyun/cos-go-sdk-v5" - - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" ) const ( @@ -72,12 +70,7 @@ func (c *Cos) InitiateMultipartUpload(ctx context.Context, name string) (*s3.Ini }, nil } -func (c *Cos) CompleteMultipartUpload( - ctx context.Context, - uploadID string, - name string, - parts []s3.Part, -) (*s3.CompleteMultipartUploadResult, error) { +func (c *Cos) CompleteMultipartUpload(ctx context.Context, uploadID string, name string, parts []s3.Part) (*s3.CompleteMultipartUploadResult, error) { opts := &cos.CompleteMultipartUploadOptions{ Parts: make([]cos.Object, len(parts)), } @@ -116,13 +109,7 @@ func (c *Cos) PartSize(ctx context.Context, size int64) (int64, error) { return partSize, nil } -func (c *Cos) AuthSign( - ctx context.Context, - uploadID string, - name string, - expire time.Duration, - partNumbers []int, -) (*s3.AuthSignResult, error) { +func (c *Cos) AuthSign(ctx context.Context, uploadID string, name string, expire time.Duration, partNumbers []int) (*s3.AuthSignResult, error) { result := s3.AuthSignResult{ URL: c.client.BaseURL.BucketURL.String() + "/" + cos.EncodeURIComponent(name), Query: url.Values{"uploadId": {uploadID}}, @@ -133,13 +120,7 @@ func (c *Cos) AuthSign( if err != nil { return nil, err } - cos.AddAuthorizationHeader( - c.credential.SecretID, - c.credential.SecretKey, - c.credential.SessionToken, - req, - cos.NewAuthTime(expire), - ) + cos.AddAuthorizationHeader(c.credential.SecretID, c.credential.SecretKey, c.credential.SessionToken, req, cos.NewAuthTime(expire)) result.Header = req.Header for i, partNumber := range partNumbers { result.Parts[i] = s3.SignPart{ @@ -151,15 +132,7 @@ func (c *Cos) AuthSign( } func (c *Cos) PresignedPutObject(ctx context.Context, name string, expire time.Duration) (string, error) { - rawURL, err := c.client.Object.GetPresignedURL( - ctx, - http.MethodPut, - name, - c.credential.SecretID, - c.credential.SecretKey, - expire, - nil, - ) + rawURL, err := c.client.Object.GetPresignedURL(ctx, http.MethodPut, name, c.credential.SecretID, c.credential.SecretKey, expire, nil) if err != nil { return "", err } @@ -231,13 +204,7 @@ func (c *Cos) AbortMultipartUpload(ctx context.Context, uploadID string, name st return err } -func (c *Cos) ListUploadedParts( - ctx context.Context, - uploadID string, - name string, - partNumberMarker int, - maxParts int, -) (*s3.ListUploadedPartsResult, error) { +func (c *Cos) ListUploadedParts(ctx context.Context, uploadID string, name string, partNumberMarker int, maxParts int) (*s3.ListUploadedPartsResult, error) { result, _, err := c.client.Object.ListParts(ctx, name, uploadID, &cos.ObjectListPartsOptions{ MaxParts: strconv.Itoa(maxParts), PartNumberMarker: strconv.Itoa(partNumberMarker), @@ -264,12 +231,7 @@ func (c *Cos) ListUploadedParts( return res, nil } -func (c *Cos) AccessURL( - ctx context.Context, - name string, - expire time.Duration, - opt *s3.AccessURLOption, -) (string, error) { +func (c *Cos) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { //reqParams := make(url.Values) //if opt != nil { // if opt.ContentType != "" { @@ -284,15 +246,7 @@ func (c *Cos) AccessURL( } else if expire < time.Second { expire = time.Second } - rawURL, err := c.client.Object.GetPresignedURL( - ctx, - http.MethodGet, - name, - c.credential.SecretID, - c.credential.SecretKey, - expire, - nil, - ) + rawURL, err := c.client.Object.GetPresignedURL(ctx, http.MethodGet, name, c.credential.SecretID, c.credential.SecretKey, expire, nil) if err != nil { return "", err } diff --git a/pkg/common/db/s3/minio/minio.go b/pkg/common/db/s3/minio/minio.go index 84c4348c0..367cbe8a8 100644 --- a/pkg/common/db/s3/minio/minio.go +++ b/pkg/common/db/s3/minio/minio.go @@ -4,18 +4,16 @@ import ( "context" "errors" "fmt" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + "github.com/minio/minio-go/v7/pkg/signer" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" - "github.com/minio/minio-go/v7/pkg/signer" - - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" ) const ( @@ -81,12 +79,7 @@ func (m *Minio) InitiateMultipartUpload(ctx context.Context, name string) (*s3.I }, nil } -func (m *Minio) CompleteMultipartUpload( - ctx context.Context, - uploadID string, - name string, - parts []s3.Part, -) (*s3.CompleteMultipartUploadResult, error) { +func (m *Minio) CompleteMultipartUpload(ctx context.Context, uploadID string, name string, parts []s3.Part) (*s3.CompleteMultipartUploadResult, error) { minioParts := make([]minio.CompletePart, len(parts)) for i, part := range parts { minioParts[i] = minio.CompletePart{ @@ -123,13 +116,7 @@ func (m *Minio) PartSize(ctx context.Context, size int64) (int64, error) { return partSize, nil } -func (m *Minio) AuthSign( - ctx context.Context, - uploadID string, - name string, - expire time.Duration, - partNumbers []int, -) (*s3.AuthSignResult, error) { +func (m *Minio) AuthSign(ctx context.Context, uploadID string, name string, expire time.Duration, partNumbers []int) (*s3.AuthSignResult, error) { creds, err := m.opts.Creds.Get() if err != nil { return nil, err @@ -146,14 +133,7 @@ func (m *Minio) AuthSign( return nil, err } request.Header.Set("X-Amz-Content-Sha256", unsignedPayload) - request = signer.SignV4Trailer( - *request, - creds.AccessKeyID, - creds.SecretAccessKey, - creds.SessionToken, - "us-east-1", - nil, - ) + request = signer.SignV4Trailer(*request, creds.AccessKeyID, creds.SecretAccessKey, creds.SessionToken, "us-east-1", nil) result.Parts[i] = s3.SignPart{ PartNumber: partNumber, URL: request.URL.String(), @@ -224,13 +204,7 @@ func (m *Minio) AbortMultipartUpload(ctx context.Context, uploadID string, name return m.core.AbortMultipartUpload(ctx, m.bucket, name, uploadID) } -func (m *Minio) ListUploadedParts( - ctx context.Context, - uploadID string, - name string, - partNumberMarker int, - maxParts int, -) (*s3.ListUploadedPartsResult, error) { +func (m *Minio) ListUploadedParts(ctx context.Context, uploadID string, name string, partNumberMarker int, maxParts int) (*s3.ListUploadedPartsResult, error) { result, err := m.core.ListObjectParts(ctx, m.bucket, name, uploadID, partNumberMarker, maxParts) if err != nil { return nil, err @@ -253,12 +227,7 @@ func (m *Minio) ListUploadedParts( return res, nil } -func (m *Minio) AccessURL( - ctx context.Context, - name string, - expire time.Duration, - opt *s3.AccessURLOption, -) (string, error) { +func (m *Minio) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { //reqParams := make(url.Values) //if opt != nil { // if opt.ContentType != "" { diff --git a/pkg/common/db/s3/oss/oss.go b/pkg/common/db/s3/oss/oss.go index 6dd144403..f2b50da50 100644 --- a/pkg/common/db/s3/oss/oss.go +++ b/pkg/common/db/s3/oss/oss.go @@ -4,16 +4,14 @@ import ( "context" "errors" "fmt" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" + "github.com/aliyun/aliyun-oss-go-sdk/oss" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/aliyun/aliyun-oss-go-sdk/oss" - - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" ) const ( @@ -75,12 +73,7 @@ func (o *OSS) InitiateMultipartUpload(ctx context.Context, name string) (*s3.Ini }, nil } -func (o *OSS) CompleteMultipartUpload( - ctx context.Context, - uploadID string, - name string, - parts []s3.Part, -) (*s3.CompleteMultipartUploadResult, error) { +func (o *OSS) CompleteMultipartUpload(ctx context.Context, uploadID string, name string, parts []s3.Part) (*s3.CompleteMultipartUploadResult, error) { ossParts := make([]oss.UploadPart, len(parts)) for i, part := range parts { ossParts[i] = oss.UploadPart{ @@ -121,13 +114,7 @@ func (o *OSS) PartSize(ctx context.Context, size int64) (int64, error) { return partSize, nil } -func (o *OSS) AuthSign( - ctx context.Context, - uploadID string, - name string, - expire time.Duration, - partNumbers []int, -) (*s3.AuthSignResult, error) { +func (o *OSS) AuthSign(ctx context.Context, uploadID string, name string, expire time.Duration, partNumbers []int) (*s3.AuthSignResult, error) { result := s3.AuthSignResult{ URL: o.bucketURL + name, Query: url.Values{"uploadId": {uploadID}}, @@ -145,15 +132,7 @@ func (o *OSS) AuthSign( } request.Header.Set(oss.HTTPHeaderHost, request.Host) request.Header.Set(oss.HTTPHeaderDate, time.Now().UTC().Format(http.TimeFormat)) - authorization := fmt.Sprintf( - `OSS %s:%s`, - o.credentials.GetAccessKeyID(), - o.getSignedStr( - request, - fmt.Sprintf(`/%s/%s?partNumber=%d&uploadId=%s`, o.bucket.BucketName, name, partNumber, uploadID), - o.credentials.GetAccessKeySecret(), - ), - ) + authorization := fmt.Sprintf(`OSS %s:%s`, o.credentials.GetAccessKeyID(), o.getSignedStr(request, fmt.Sprintf(`/%s/%s?partNumber=%d&uploadId=%s`, o.bucket.BucketName, name, partNumber, uploadID), o.credentials.GetAccessKeySecret())) request.Header.Set(oss.HTTPHeaderAuthorization, authorization) result.Parts[i] = s3.SignPart{ PartNumber: partNumber, @@ -234,13 +213,7 @@ func (o *OSS) AbortMultipartUpload(ctx context.Context, uploadID string, name st }) } -func (o *OSS) ListUploadedParts( - ctx context.Context, - uploadID string, - name string, - partNumberMarker int, - maxParts int, -) (*s3.ListUploadedPartsResult, error) { +func (o *OSS) ListUploadedParts(ctx context.Context, uploadID string, name string, partNumberMarker int, maxParts int) (*s3.ListUploadedPartsResult, error) { result, err := o.bucket.ListUploadedParts(oss.InitiateMultipartUploadResult{ UploadID: uploadID, Key: name, @@ -267,12 +240,7 @@ func (o *OSS) ListUploadedParts( return res, nil } -func (o *OSS) AccessURL( - ctx context.Context, - name string, - expire time.Duration, - opt *s3.AccessURLOption, -) (string, error) { +func (o *OSS) AccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption) (string, error) { //var opts []oss.Option //if opt != nil { // if opt.ContentType != "" { diff --git a/pkg/common/db/s3/oss/sign.go b/pkg/common/db/s3/oss/sign.go index 1a43effaa..82618d287 100644 --- a/pkg/common/db/s3/oss/sign.go +++ b/pkg/common/db/s3/oss/sign.go @@ -5,13 +5,12 @@ import ( "crypto/sha1" "crypto/sha256" "encoding/base64" + "github.com/aliyun/aliyun-oss-go-sdk/oss" "hash" "io" "net/http" "sort" "strings" - - "github.com/aliyun/aliyun-oss-go-sdk/oss" ) func (o *OSS) getAdditionalHeaderKeys(req *http.Request) ([]string, map[string]string) { @@ -72,10 +71,7 @@ func (o *OSS) getSignedStr(req *http.Request, canonicalizedResource string, keyS // v2 signature if o.bucket.Client.Config.AuthVersion == oss.AuthV2 { - signStr = req.Method + "\n" + contentMd5 + "\n" + contentType + "\n" + date + "\n" + canonicalizedOSSHeaders + strings.Join( - additionalList, - ";", - ) + "\n" + canonicalizedResource + signStr = req.Method + "\n" + contentMd5 + "\n" + contentType + "\n" + date + "\n" + canonicalizedOSSHeaders + strings.Join(additionalList, ";") + "\n" + canonicalizedResource h = hmac.New(func() hash.Hash { return sha256.New() }, []byte(keySecret)) } _, _ = io.WriteString(h, signStr) diff --git a/pkg/common/db/s3/s3.go b/pkg/common/db/s3/s3.go index ded27b3b3..4f1571b1e 100644 --- a/pkg/common/db/s3/s3.go +++ b/pkg/common/db/s3/s3.go @@ -112,21 +112,10 @@ type Interface interface { PartLimit() *PartLimit InitiateMultipartUpload(ctx context.Context, name string) (*InitiateMultipartUploadResult, error) - CompleteMultipartUpload( - ctx context.Context, - uploadID string, - name string, - parts []Part, - ) (*CompleteMultipartUploadResult, error) + CompleteMultipartUpload(ctx context.Context, uploadID string, name string, parts []Part) (*CompleteMultipartUploadResult, error) PartSize(ctx context.Context, size int64) (int64, error) - AuthSign( - ctx context.Context, - uploadID string, - name string, - expire time.Duration, - partNumbers []int, - ) (*AuthSignResult, error) + AuthSign(ctx context.Context, uploadID string, name string, expire time.Duration, partNumbers []int) (*AuthSignResult, error) PresignedPutObject(ctx context.Context, name string, expire time.Duration) (string, error) @@ -139,13 +128,7 @@ type Interface interface { IsNotFound(err error) bool AbortMultipartUpload(ctx context.Context, uploadID string, name string) error - ListUploadedParts( - ctx context.Context, - uploadID string, - name string, - partNumberMarker int, - maxParts int, - ) (*ListUploadedPartsResult, error) + ListUploadedParts(ctx context.Context, uploadID string, name string, partNumberMarker int, maxParts int) (*ListUploadedPartsResult, error) AccessURL(ctx context.Context, name string, expire time.Duration, opt *AccessURLOption) (string, error) } diff --git a/pkg/common/db/table/relation/conversation.go b/pkg/common/db/table/relation/conversation.go index e60ae5a70..6fd260583 100644 --- a/pkg/common/db/table/relation/conversation.go +++ b/pkg/common/db/table/relation/conversation.go @@ -10,20 +10,20 @@ const ( ) type ConversationModel struct { - OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"` - ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"` - ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"` - UserID string `gorm:"column:user_id;type:char(64)" json:"userID"` - GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"` - RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"` - IsPinned bool `gorm:"column:is_pinned" json:"isPinned"` - IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"` - BurnDuration int32 `gorm:"column:burn_duration;default:30" json:"burnDuration"` - GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"` - AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` - Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` - MaxSeq int64 `gorm:"column:max_seq" json:"maxSeq"` - MinSeq int64 `gorm:"column:min_seq" json:"minSeq"` + OwnerUserID string `gorm:"column:owner_user_id;primary_key;type:char(128)" json:"OwnerUserID"` + ConversationID string `gorm:"column:conversation_id;primary_key;type:char(128)" json:"conversationID"` + ConversationType int32 `gorm:"column:conversation_type" json:"conversationType"` + UserID string `gorm:"column:user_id;type:char(64)" json:"userID"` + GroupID string `gorm:"column:group_id;type:char(128)" json:"groupID"` + RecvMsgOpt int32 `gorm:"column:recv_msg_opt" json:"recvMsgOpt"` + IsPinned bool `gorm:"column:is_pinned" json:"isPinned"` + IsPrivateChat bool `gorm:"column:is_private_chat" json:"isPrivateChat"` + BurnDuration int32 `gorm:"column:burn_duration;default:30" json:"burnDuration"` + GroupAtType int32 `gorm:"column:group_at_type" json:"groupAtType"` + AttachedInfo string `gorm:"column:attached_info;type:varchar(1024)" json:"attachedInfo"` + Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` + MaxSeq int64 `gorm:"column:max_seq" json:"maxSeq"` + MinSeq int64 `gorm:"column:min_seq" json:"minSeq"` CreateTime time.Time `gorm:"column:create_time;index:create_time;autoCreateTime"` IsMsgDestruct bool `gorm:"column:is_msg_destruct;default:false"` MsgDestructTime int64 `gorm:"column:msg_destruct_time;default:604800"` @@ -37,26 +37,13 @@ func (ConversationModel) TableName() string { type ConversationModelInterface interface { Create(ctx context.Context, conversations []*ConversationModel) (err error) Delete(ctx context.Context, groupIDs []string) (err error) - UpdateByMap( - ctx context.Context, - userIDs []string, - conversationID string, - args map[string]interface{}, - ) (rows int64, err error) + UpdateByMap(ctx context.Context, userIDs []string, conversationID string, args map[string]interface{}) (rows int64, err error) Update(ctx context.Context, conversation *ConversationModel) (err error) - Find( - ctx context.Context, - ownerUserID string, - conversationIDs []string, - ) (conversations []*ConversationModel, err error) + Find(ctx context.Context, ownerUserID string, conversationIDs []string) (conversations []*ConversationModel, err error) FindUserID(ctx context.Context, userIDs []string, conversationIDs []string) ([]string, error) FindUserIDAllConversationID(ctx context.Context, userID string) ([]string, error) Take(ctx context.Context, userID, conversationID string) (conversation *ConversationModel, err error) - FindConversationID( - ctx context.Context, - userID string, - conversationIDs []string, - ) (existConversationID []string, err error) + FindConversationID(ctx context.Context, userID string, conversationIDs []string) (existConversationID []string, err error) FindUserIDAllConversations(ctx context.Context, userID string) (conversations []*ConversationModel, err error) FindRecvMsgNotNotifyUserIDs(ctx context.Context, groupID string) ([]string, error) GetUserRecvMsgOpt(ctx context.Context, ownerUserID, conversationID string) (opt int, err error) diff --git a/pkg/common/log/sql_logger.go b/pkg/common/log/sql_logger.go index 1622067ba..9e9bb1be6 100644 --- a/pkg/common/log/sql_logger.go +++ b/pkg/common/log/sql_logger.go @@ -17,11 +17,7 @@ type SqlLogger struct { SlowThreshold time.Duration } -func NewSqlLogger( - logLevel gormLogger.LogLevel, - ignoreRecordNotFoundError bool, - slowThreshold time.Duration, -) *SqlLogger { +func NewSqlLogger(logLevel gormLogger.LogLevel, ignoreRecordNotFoundError bool, slowThreshold time.Duration) *SqlLogger { return &SqlLogger{ LogLevel: logLevel, IgnoreRecordNotFoundError: ignoreRecordNotFoundError, @@ -56,17 +52,7 @@ func (l *SqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql s case err != nil && l.LogLevel >= gormLogger.Error && (!errors.Is(err, gorm.ErrRecordNotFound) || !l.IgnoreRecordNotFoundError): sql, rows := fc() if rows == -1 { - ZError( - ctx, - "sql exec detail", - err, - "gorm", - gormUtils.FileWithLineNum(), - "elapsed time", - fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), - "sql", - sql, - ) + ZError(ctx, "sql exec detail", err, "gorm", gormUtils.FileWithLineNum(), "elapsed time", fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), "sql", sql) } else { ZError(ctx, "sql exec detail", err, "gorm", gormUtils.FileWithLineNum(), "elapsed time", fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), "rows", rows, "sql", sql) } @@ -74,35 +60,14 @@ func (l *SqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql s sql, rows := fc() slowLog := fmt.Sprintf("SLOW SQL >= %v", l.SlowThreshold) if rows == -1 { - ZWarn( - ctx, - "sql exec detail", - nil, - "gorm", - gormUtils.FileWithLineNum(), - "slow sql", - slowLog, - "elapsed time", - fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), - "sql", - sql, - ) + ZWarn(ctx, "sql exec detail", nil, "gorm", gormUtils.FileWithLineNum(), "slow sql", slowLog, "elapsed time", fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), "sql", sql) } else { ZWarn(ctx, "sql exec detail", nil, "gorm", gormUtils.FileWithLineNum(), "slow sql", slowLog, "elapsed time", fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), "rows", rows, "sql", sql) } case l.LogLevel == gormLogger.Info: sql, rows := fc() if rows == -1 { - ZDebug( - ctx, - "sql exec detail", - "gorm", - gormUtils.FileWithLineNum(), - "elapsed time", - fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), - "sql", - sql, - ) + ZDebug(ctx, "sql exec detail", "gorm", gormUtils.FileWithLineNum(), "elapsed time", fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), "sql", sql) } else { ZDebug(ctx, "sql exec detail", "gorm", gormUtils.FileWithLineNum(), "elapsed time", fmt.Sprintf("%f(ms)", float64(elapsed.Nanoseconds())/1e6), "rows", rows, "sql", sql) } diff --git a/pkg/discoveryregistry/zookeeper/discover.go b/pkg/discoveryregistry/zookeeper/discover.go index 3fbb63610..a9848ee32 100644 --- a/pkg/discoveryregistry/zookeeper/discover.go +++ b/pkg/discoveryregistry/zookeeper/discover.go @@ -6,10 +6,9 @@ import ( "io" "strings" - "github.com/pkg/errors" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" + "github.com/pkg/errors" "github.com/go-zookeeper/zk" "google.golang.org/grpc" @@ -70,11 +69,7 @@ func (s *ZkClient) GetConnsRemote(serviceName string) (conns []resolver.Address, return conns, nil } -func (s *ZkClient) GetConns( - ctx context.Context, - serviceName string, - opts ...grpc.DialOption, -) ([]grpc.ClientConnInterface, error) { +func (s *ZkClient) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]grpc.ClientConnInterface, error) { s.logger.Printf("get conns from client, serviceName: %s", serviceName) opts = append(s.options, opts...) s.lock.Lock() @@ -88,26 +83,12 @@ func (s *ZkClient) GetConns( return nil, err } if len(addrs) == 0 { - return nil, fmt.Errorf( - "no conn for service %s, grpc server may not exist, local conn is %v, please check zookeeper server %v, path: %s", - serviceName, - s.localConns, - s.zkServers, - s.zkRoot, - ) + return nil, fmt.Errorf("no conn for service %s, grpc server may not exist, local conn is %v, please check zookeeper server %v, path: %s", serviceName, s.localConns, s.zkServers, s.zkRoot) } for _, addr := range addrs { cc, err := grpc.DialContext(ctx, addr.Addr, append(s.options, opts...)...) if err != nil { - log.ZError( - context.Background(), - "dialContext failed", - err, - "addr", - addr.Addr, - "opts", - append(s.options, opts...), - ) + log.ZError(context.Background(), "dialContext failed", err, "addr", addr.Addr, "opts", append(s.options, opts...)) return nil, errs.Wrap(err) } conns = append(conns, cc) @@ -117,15 +98,8 @@ func (s *ZkClient) GetConns( return conns, nil } -func (s *ZkClient) GetConn( - ctx context.Context, - serviceName string, - opts ...grpc.DialOption, -) (grpc.ClientConnInterface, error) { - newOpts := append( - s.options, - grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, s.balancerName)), - ) +func (s *ZkClient) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (grpc.ClientConnInterface, error) { + newOpts := append(s.options, grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, s.balancerName))) s.logger.Printf("get conn from client, serviceName: %s", serviceName) return grpc.DialContext(ctx, fmt.Sprintf("%s:///%s", s.scheme, serviceName), append(newOpts, opts...)...) } diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index 2d1e0493c..095998cc6 100644 --- a/pkg/proto/auth/auth.pb.go +++ b/pkg/proto/auth/auth.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,13 +8,14 @@ package auth import ( context "context" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/pkg/proto/conversation/conversation.pb.go b/pkg/proto/conversation/conversation.pb.go index cf5de48a7..7ec352420 100644 --- a/pkg/proto/conversation/conversation.pb.go +++ b/pkg/proto/conversation/conversation.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,14 +8,16 @@ package conversation import ( context "context" - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" ) const ( diff --git a/pkg/proto/errinfo/errinfo.pb.go b/pkg/proto/errinfo/errinfo.pb.go index 44f906d86..ae10fe976 100644 --- a/pkg/proto/errinfo/errinfo.pb.go +++ b/pkg/proto/errinfo/errinfo.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -21,10 +7,11 @@ package errinfo import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index 5745fcd3c..c49a13999 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,14 +8,16 @@ package friend import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index f4230c794..9541496e2 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,15 +8,17 @@ package group import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" ) const ( diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index d11d46de3..2686704cc 100644 --- a/pkg/proto/msg/msg.pb.go +++ b/pkg/proto/msg/msg.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -2373,488 +2359,6 @@ func (x *GetActiveGroupResp) GetGroups() []*ActiveGroup { return nil } -type SearchMessageReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SendID string `protobuf:"bytes,1,opt,name=sendID,proto3" json:"sendID"` //发送者ID - RecvID string `protobuf:"bytes,2,opt,name=recvID,proto3" json:"recvID"` //接收者ID - MsgType int32 `protobuf:"varint,3,opt,name=msgType,proto3" json:"msgType"` - SendTime string `protobuf:"bytes,4,opt,name=sendTime,proto3" json:"sendTime"` - SessionType int32 `protobuf:"varint,5,opt,name=sessionType,proto3" json:"sessionType"` - Pagination *sdkws.RequestPagination `protobuf:"bytes,6,opt,name=pagination,proto3" json:"pagination"` -} - -func (x *SearchMessageReq) Reset() { - *x = SearchMessageReq{} - if protoimpl.UnsafeEnabled { - mi := &file_msg_msg_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchMessageReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchMessageReq) ProtoMessage() {} - -func (x *SearchMessageReq) ProtoReflect() protoreflect.Message { - mi := &file_msg_msg_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchMessageReq.ProtoReflect.Descriptor instead. -func (*SearchMessageReq) Descriptor() ([]byte, []int) { - return file_msg_msg_proto_rawDescGZIP(), []int{45} -} - -func (x *SearchMessageReq) GetSendID() string { - if x != nil { - return x.SendID - } - return "" -} - -func (x *SearchMessageReq) GetRecvID() string { - if x != nil { - return x.RecvID - } - return "" -} - -func (x *SearchMessageReq) GetMsgType() int32 { - if x != nil { - return x.MsgType - } - return 0 -} - -func (x *SearchMessageReq) GetSendTime() string { - if x != nil { - return x.SendTime - } - return "" -} - -func (x *SearchMessageReq) GetSessionType() int32 { - if x != nil { - return x.SessionType - } - return 0 -} - -func (x *SearchMessageReq) GetPagination() *sdkws.RequestPagination { - if x != nil { - return x.Pagination - } - return nil -} - -type SearchMessageResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ChatLogs []*ChatLog `protobuf:"bytes,1,rep,name=chatLogs,proto3" json:"chatLogs"` - ChatLogsNum int32 `protobuf:"varint,2,opt,name=chatLogsNum,proto3" json:"chatLogsNum"` -} - -func (x *SearchMessageResp) Reset() { - *x = SearchMessageResp{} - if protoimpl.UnsafeEnabled { - mi := &file_msg_msg_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SearchMessageResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SearchMessageResp) ProtoMessage() {} - -func (x *SearchMessageResp) ProtoReflect() protoreflect.Message { - mi := &file_msg_msg_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SearchMessageResp.ProtoReflect.Descriptor instead. -func (*SearchMessageResp) Descriptor() ([]byte, []int) { - return file_msg_msg_proto_rawDescGZIP(), []int{46} -} - -func (x *SearchMessageResp) GetChatLogs() []*ChatLog { - if x != nil { - return x.ChatLogs - } - return nil -} - -func (x *SearchMessageResp) GetChatLogsNum() int32 { - if x != nil { - return x.ChatLogsNum - } - return 0 -} - -type ManageMsgReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RecvID string `protobuf:"bytes,1,opt,name=recvID,proto3" json:"recvID"` - SendID string `protobuf:"bytes,2,opt,name=sendID,proto3" json:"sendID"` - GroupID string `protobuf:"bytes,3,opt,name=groupID,proto3" json:"groupID"` - Seq int64 `protobuf:"varint,4,opt,name=seq,proto3" json:"seq"` - SessionType int32 `protobuf:"varint,5,opt,name=sessionType,proto3" json:"sessionType"` -} - -func (x *ManageMsgReq) Reset() { - *x = ManageMsgReq{} - if protoimpl.UnsafeEnabled { - mi := &file_msg_msg_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ManageMsgReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ManageMsgReq) ProtoMessage() {} - -func (x *ManageMsgReq) ProtoReflect() protoreflect.Message { - mi := &file_msg_msg_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ManageMsgReq.ProtoReflect.Descriptor instead. -func (*ManageMsgReq) Descriptor() ([]byte, []int) { - return file_msg_msg_proto_rawDescGZIP(), []int{47} -} - -func (x *ManageMsgReq) GetRecvID() string { - if x != nil { - return x.RecvID - } - return "" -} - -func (x *ManageMsgReq) GetSendID() string { - if x != nil { - return x.SendID - } - return "" -} - -func (x *ManageMsgReq) GetGroupID() string { - if x != nil { - return x.GroupID - } - return "" -} - -func (x *ManageMsgReq) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -func (x *ManageMsgReq) GetSessionType() int32 { - if x != nil { - return x.SessionType - } - return 0 -} - -type ManageMsgResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ManageMsgResp) Reset() { - *x = ManageMsgResp{} - if protoimpl.UnsafeEnabled { - mi := &file_msg_msg_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ManageMsgResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ManageMsgResp) ProtoMessage() {} - -func (x *ManageMsgResp) ProtoReflect() protoreflect.Message { - mi := &file_msg_msg_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ManageMsgResp.ProtoReflect.Descriptor instead. -func (*ManageMsgResp) Descriptor() ([]byte, []int) { - return file_msg_msg_proto_rawDescGZIP(), []int{48} -} - -type ChatLog struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID,proto3" json:"serverMsgID"` - ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` - SendID string `protobuf:"bytes,3,opt,name=sendID,proto3" json:"sendID"` - RecvID string `protobuf:"bytes,4,opt,name=recvID,proto3" json:"recvID"` - GroupID string `protobuf:"bytes,5,opt,name=groupID,proto3" json:"groupID"` - RecvNickname string `protobuf:"bytes,6,opt,name=recvNickname,proto3" json:"recvNickname"` - SenderPlatformID int32 `protobuf:"varint,7,opt,name=senderPlatformID,proto3" json:"senderPlatformID"` - SenderNickname string `protobuf:"bytes,8,opt,name=senderNickname,proto3" json:"senderNickname"` - SenderFaceURL string `protobuf:"bytes,9,opt,name=senderFaceURL,proto3" json:"senderFaceURL"` - GroupName string `protobuf:"bytes,10,opt,name=groupName,proto3" json:"groupName"` - SessionType int32 `protobuf:"varint,11,opt,name=sessionType,proto3" json:"sessionType"` - MsgFrom int32 `protobuf:"varint,12,opt,name=msgFrom,proto3" json:"msgFrom"` - ContentType int32 `protobuf:"varint,13,opt,name=contentType,proto3" json:"contentType"` - Content string `protobuf:"bytes,14,opt,name=content,proto3" json:"content"` - Status int32 `protobuf:"varint,15,opt,name=status,proto3" json:"status"` - SendTime int64 `protobuf:"varint,16,opt,name=sendTime,proto3" json:"sendTime"` - CreateTime int64 `protobuf:"varint,17,opt,name=createTime,proto3" json:"createTime"` - Ex string `protobuf:"bytes,18,opt,name=ex,proto3" json:"ex"` - GroupFaceURL string `protobuf:"bytes,19,opt,name=groupFaceURL,proto3" json:"groupFaceURL"` - GroupMemberCount uint32 `protobuf:"varint,20,opt,name=groupMemberCount,proto3" json:"groupMemberCount"` - Seq int64 `protobuf:"varint,21,opt,name=seq,proto3" json:"seq"` - GroupOwner string `protobuf:"bytes,22,opt,name=groupOwner,proto3" json:"groupOwner"` - GroupType int32 `protobuf:"varint,23,opt,name=groupType,proto3" json:"groupType"` -} - -func (x *ChatLog) Reset() { - *x = ChatLog{} - if protoimpl.UnsafeEnabled { - mi := &file_msg_msg_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ChatLog) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ChatLog) ProtoMessage() {} - -func (x *ChatLog) ProtoReflect() protoreflect.Message { - mi := &file_msg_msg_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ChatLog.ProtoReflect.Descriptor instead. -func (*ChatLog) Descriptor() ([]byte, []int) { - return file_msg_msg_proto_rawDescGZIP(), []int{49} -} - -func (x *ChatLog) GetServerMsgID() string { - if x != nil { - return x.ServerMsgID - } - return "" -} - -func (x *ChatLog) GetClientMsgID() string { - if x != nil { - return x.ClientMsgID - } - return "" -} - -func (x *ChatLog) GetSendID() string { - if x != nil { - return x.SendID - } - return "" -} - -func (x *ChatLog) GetRecvID() string { - if x != nil { - return x.RecvID - } - return "" -} - -func (x *ChatLog) GetGroupID() string { - if x != nil { - return x.GroupID - } - return "" -} - -func (x *ChatLog) GetRecvNickname() string { - if x != nil { - return x.RecvNickname - } - return "" -} - -func (x *ChatLog) GetSenderPlatformID() int32 { - if x != nil { - return x.SenderPlatformID - } - return 0 -} - -func (x *ChatLog) GetSenderNickname() string { - if x != nil { - return x.SenderNickname - } - return "" -} - -func (x *ChatLog) GetSenderFaceURL() string { - if x != nil { - return x.SenderFaceURL - } - return "" -} - -func (x *ChatLog) GetGroupName() string { - if x != nil { - return x.GroupName - } - return "" -} - -func (x *ChatLog) GetSessionType() int32 { - if x != nil { - return x.SessionType - } - return 0 -} - -func (x *ChatLog) GetMsgFrom() int32 { - if x != nil { - return x.MsgFrom - } - return 0 -} - -func (x *ChatLog) GetContentType() int32 { - if x != nil { - return x.ContentType - } - return 0 -} - -func (x *ChatLog) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *ChatLog) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *ChatLog) GetSendTime() int64 { - if x != nil { - return x.SendTime - } - return 0 -} - -func (x *ChatLog) GetCreateTime() int64 { - if x != nil { - return x.CreateTime - } - return 0 -} - -func (x *ChatLog) GetEx() string { - if x != nil { - return x.Ex - } - return "" -} - -func (x *ChatLog) GetGroupFaceURL() string { - if x != nil { - return x.GroupFaceURL - } - return "" -} - -func (x *ChatLog) GetGroupMemberCount() uint32 { - if x != nil { - return x.GroupMemberCount - } - return 0 -} - -func (x *ChatLog) GetSeq() int64 { - if x != nil { - return x.Seq - } - return 0 -} - -func (x *ChatLog) GetGroupOwner() string { - if x != nil { - return x.GroupOwner - } - return "" -} - -func (x *ChatLog) GetGroupType() int32 { - if x != nil { - return x.GroupType - } - return 0 -} - var File_msg_msg_proto protoreflect.FileDescriptor var file_msg_msg_proto_rawDesc = []byte{ @@ -3108,212 +2612,125 @@ var file_msg_msg_proto_rawDesc = []byte{ 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0xe1, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x12, - 0x16, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, - 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x45, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6c, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x08, 0x63, - 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x43, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x08, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x6f, - 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x4e, 0x75, - 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, - 0x73, 0x4e, 0x75, 0x6d, 0x22, 0x8c, 0x01, 0x0a, 0x0c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, - 0x73, 0x67, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x65, 0x6e, 0x64, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, - 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, - 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, - 0x79, 0x70, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x73, 0x70, 0x22, 0xcf, 0x05, 0x0a, 0x07, 0x43, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, - 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x73, 0x67, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x73, 0x67, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, - 0x73, 0x67, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, - 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, - 0x63, 0x76, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x22, - 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x76, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x63, 0x76, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x74, - 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x73, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x44, 0x12, 0x26, - 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x69, - 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x46, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x46, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x12, 0x1c, 0x0a, 0x09, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x6d, 0x73, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, - 0x73, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, - 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, - 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x54, 0x69, 0x6d, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x65, 0x78, 0x18, 0x12, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x65, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, - 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x46, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x12, 0x2a, 0x0a, 0x10, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x32, 0xd0, 0x0f, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x50, - 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x20, 0x2e, 0x4f, 0x70, - 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, - 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, - 0x77, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x70, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, - 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, - 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x38, 0x01, 0x32, 0xa8, 0x0e, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x50, 0x0a, 0x09, 0x47, 0x65, + 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x20, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x47, 0x65, 0x74, + 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x47, + 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x70, 0x0a, 0x15, + 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, + 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x68, 0x0a, 0x11, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x12, 0x28, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, - 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x29, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x58, 0x0a, 0x0d, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x22, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, - 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4c, 0x0a, 0x09, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x12, - 0x1c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x70, 0x0a, 0x15, - 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x68, + 0x0a, 0x11, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x53, + 0x65, 0x71, 0x73, 0x12, 0x28, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x29, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, + 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, + 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, + 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, + 0x71, 0x1a, 0x1d, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x70, 0x0a, 0x15, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x65, + 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, + 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5e, - 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, - 0x67, 0x12, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, - 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, - 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4f, - 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x12, 0x1f, 0x2e, 0x4f, - 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x73, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, - 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, - 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x64, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, - 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x12, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, - 0x71, 0x1a, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, - 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, 0x10, 0x53, 0x65, - 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, - 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, - 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, - 0x10, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, - 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x4c, 0x0a, 0x09, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, + 0x73, 0x70, 0x12, 0x5e, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, + 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, + 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x25, 0x2e, 0x4f, 0x70, + 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x4f, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, + 0x12, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x1a, 0x20, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x73, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, + 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5b, - 0x0a, 0x0e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, - 0x12, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, 0x52, 0x65, - 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, - 0x73, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x73, 0x0a, 0x16, 0x4d, - 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, - 0x73, 0x52, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, - 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, - 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x7c, 0x0a, 0x19, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x12, 0x2e, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2f, 0x2e, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, + 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, + 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, + 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x64, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x12, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x91, - 0x01, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, - 0x53, 0x65, 0x71, 0x12, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, + 0x61, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, + 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, + 0x0a, 0x10, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, + 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x61, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, + 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, + 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x4c, 0x0a, 0x09, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, + 0x67, 0x12, 0x1e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, + 0x71, 0x1a, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x5b, 0x0a, 0x0e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, + 0x52, 0x65, 0x61, 0x64, 0x12, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, + 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, + 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x73, 0x0a, 0x16, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, + 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, + 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x7c, 0x0a, 0x19, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, + 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, + 0x71, 0x12, 0x2e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, + 0x71, 0x1a, 0x2f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x91, 0x01, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, - 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x36, 0x2e, 0x4f, 0x70, 0x65, - 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, - 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x61, - 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x58, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5b, 0x0a, 0x0e, - 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, + 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, + 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, + 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x36, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x44, - 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x73, 0x67, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, 0x53, + 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x58, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, + 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, + 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x5b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x12, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, + 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, + 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x44, 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, + 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3328,7 +2745,7 @@ func file_msg_msg_proto_rawDescGZIP() []byte { return file_msg_msg_proto_rawDescData } -var file_msg_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 53) +var file_msg_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 48) var file_msg_msg_proto_goTypes = []interface{}{ (*MsgDataToMQ)(nil), // 0: OpenIMServer.msg.MsgDataToMQ (*MsgDataToDB)(nil), // 1: OpenIMServer.msg.MsgDataToDB @@ -3375,90 +2792,79 @@ var file_msg_msg_proto_goTypes = []interface{}{ (*GetActiveGroupReq)(nil), // 42: OpenIMServer.msg.GetActiveGroupReq (*ActiveGroup)(nil), // 43: OpenIMServer.msg.ActiveGroup (*GetActiveGroupResp)(nil), // 44: OpenIMServer.msg.GetActiveGroupResp - (*SearchMessageReq)(nil), // 45: OpenIMServer.msg.SearchMessageReq - (*SearchMessageResp)(nil), // 46: OpenIMServer.msg.SearchMessageResp - (*ManageMsgReq)(nil), // 47: OpenIMServer.msg.manageMsgReq - (*ManageMsgResp)(nil), // 48: OpenIMServer.msg.manageMsgResp - (*ChatLog)(nil), // 49: OpenIMServer.msg.ChatLog - nil, // 50: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry - nil, // 51: OpenIMServer.msg.GetActiveUserResp.DateCountEntry - nil, // 52: OpenIMServer.msg.GetActiveGroupResp.DateCountEntry - (*sdkws.MsgData)(nil), // 53: OpenIMServer.sdkws.MsgData - (*sdkws.RequestPagination)(nil), // 54: OpenIMServer.sdkws.RequestPagination - (*sdkws.UserInfo)(nil), // 55: OpenIMServer.sdkws.UserInfo - (*sdkws.GroupInfo)(nil), // 56: OpenIMServer.sdkws.GroupInfo - (*sdkws.GetMaxSeqReq)(nil), // 57: OpenIMServer.sdkws.GetMaxSeqReq - (*sdkws.PullMessageBySeqsReq)(nil), // 58: OpenIMServer.sdkws.PullMessageBySeqsReq - (*sdkws.GetMaxSeqResp)(nil), // 59: OpenIMServer.sdkws.GetMaxSeqResp - (*sdkws.PullMessageBySeqsResp)(nil), // 60: OpenIMServer.sdkws.PullMessageBySeqsResp + nil, // 45: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry + nil, // 46: OpenIMServer.msg.GetActiveUserResp.DateCountEntry + nil, // 47: OpenIMServer.msg.GetActiveGroupResp.DateCountEntry + (*sdkws.MsgData)(nil), // 48: OpenIMServer.sdkws.MsgData + (*sdkws.RequestPagination)(nil), // 49: OpenIMServer.sdkws.RequestPagination + (*sdkws.UserInfo)(nil), // 50: OpenIMServer.sdkws.UserInfo + (*sdkws.GroupInfo)(nil), // 51: OpenIMServer.sdkws.GroupInfo + (*sdkws.GetMaxSeqReq)(nil), // 52: OpenIMServer.sdkws.GetMaxSeqReq + (*sdkws.PullMessageBySeqsReq)(nil), // 53: OpenIMServer.sdkws.PullMessageBySeqsReq + (*sdkws.GetMaxSeqResp)(nil), // 54: OpenIMServer.sdkws.GetMaxSeqResp + (*sdkws.PullMessageBySeqsResp)(nil), // 55: OpenIMServer.sdkws.PullMessageBySeqsResp } var file_msg_msg_proto_depIdxs = []int32{ - 53, // 0: OpenIMServer.msg.MsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData - 53, // 1: OpenIMServer.msg.MsgDataToDB.msgData:type_name -> OpenIMServer.sdkws.MsgData - 53, // 2: OpenIMServer.msg.PushMsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData - 53, // 3: OpenIMServer.msg.MsgDataToMongoByMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData - 53, // 4: OpenIMServer.msg.SendMsgReq.msgData:type_name -> OpenIMServer.sdkws.MsgData - 53, // 5: OpenIMServer.msg.MsgDataToModifyByMQ.messages:type_name -> OpenIMServer.sdkws.MsgData + 48, // 0: OpenIMServer.msg.MsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData + 48, // 1: OpenIMServer.msg.MsgDataToDB.msgData:type_name -> OpenIMServer.sdkws.MsgData + 48, // 2: OpenIMServer.msg.PushMsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData + 48, // 3: OpenIMServer.msg.MsgDataToMongoByMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData + 48, // 4: OpenIMServer.msg.SendMsgReq.msgData:type_name -> OpenIMServer.sdkws.MsgData + 48, // 5: OpenIMServer.msg.MsgDataToModifyByMQ.messages:type_name -> OpenIMServer.sdkws.MsgData 23, // 6: OpenIMServer.msg.ClearConversationsMsgReq.deleteSyncOpt:type_name -> OpenIMServer.msg.DeleteSyncOpt 23, // 7: OpenIMServer.msg.UserClearAllMsgReq.deleteSyncOpt:type_name -> OpenIMServer.msg.DeleteSyncOpt 23, // 8: OpenIMServer.msg.DeleteMsgsReq.deleteSyncOpt:type_name -> OpenIMServer.msg.DeleteSyncOpt - 50, // 9: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.seqs:type_name -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry - 54, // 10: OpenIMServer.msg.GetActiveUserReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination - 55, // 11: OpenIMServer.msg.ActiveUser.user:type_name -> OpenIMServer.sdkws.UserInfo - 51, // 12: OpenIMServer.msg.GetActiveUserResp.dateCount:type_name -> OpenIMServer.msg.GetActiveUserResp.DateCountEntry + 45, // 9: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.seqs:type_name -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry + 49, // 10: OpenIMServer.msg.GetActiveUserReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination + 50, // 11: OpenIMServer.msg.ActiveUser.user:type_name -> OpenIMServer.sdkws.UserInfo + 46, // 12: OpenIMServer.msg.GetActiveUserResp.dateCount:type_name -> OpenIMServer.msg.GetActiveUserResp.DateCountEntry 40, // 13: OpenIMServer.msg.GetActiveUserResp.users:type_name -> OpenIMServer.msg.ActiveUser - 54, // 14: OpenIMServer.msg.GetActiveGroupReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination - 56, // 15: OpenIMServer.msg.ActiveGroup.group:type_name -> OpenIMServer.sdkws.GroupInfo - 52, // 16: OpenIMServer.msg.GetActiveGroupResp.dateCount:type_name -> OpenIMServer.msg.GetActiveGroupResp.DateCountEntry + 49, // 14: OpenIMServer.msg.GetActiveGroupReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination + 51, // 15: OpenIMServer.msg.ActiveGroup.group:type_name -> OpenIMServer.sdkws.GroupInfo + 47, // 16: OpenIMServer.msg.GetActiveGroupResp.dateCount:type_name -> OpenIMServer.msg.GetActiveGroupResp.DateCountEntry 43, // 17: OpenIMServer.msg.GetActiveGroupResp.groups:type_name -> OpenIMServer.msg.ActiveGroup - 54, // 18: OpenIMServer.msg.SearchMessageReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination - 49, // 19: OpenIMServer.msg.SearchMessageResp.chatLogs:type_name -> OpenIMServer.msg.ChatLog - 37, // 20: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry.value:type_name -> OpenIMServer.msg.Seqs - 57, // 21: OpenIMServer.msg.msg.GetMaxSeq:input_type -> OpenIMServer.sdkws.GetMaxSeqReq - 34, // 22: OpenIMServer.msg.msg.GetConversationMaxSeq:input_type -> OpenIMServer.msg.GetConversationMaxSeqReq - 58, // 23: OpenIMServer.msg.msg.PullMessageBySeqs:input_type -> OpenIMServer.sdkws.PullMessageBySeqsReq - 45, // 24: OpenIMServer.msg.msg.SearchMessage:input_type -> OpenIMServer.msg.SearchMessageReq - 47, // 25: OpenIMServer.msg.msg.ManageMsg:input_type -> OpenIMServer.msg.manageMsgReq - 6, // 26: OpenIMServer.msg.msg.SendMsg:input_type -> OpenIMServer.msg.SendMsgReq - 24, // 27: OpenIMServer.msg.msg.ClearConversationsMsg:input_type -> OpenIMServer.msg.ClearConversationsMsgReq - 26, // 28: OpenIMServer.msg.msg.UserClearAllMsg:input_type -> OpenIMServer.msg.UserClearAllMsgReq - 28, // 29: OpenIMServer.msg.msg.DeleteMsgs:input_type -> OpenIMServer.msg.DeleteMsgsReq - 32, // 30: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:input_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqReq - 30, // 31: OpenIMServer.msg.msg.DeleteMsgPhysical:input_type -> OpenIMServer.msg.DeleteMsgPhysicalReq - 8, // 32: OpenIMServer.msg.msg.SetSendMsgStatus:input_type -> OpenIMServer.msg.SetSendMsgStatusReq - 10, // 33: OpenIMServer.msg.msg.GetSendMsgStatus:input_type -> OpenIMServer.msg.GetSendMsgStatusReq - 15, // 34: OpenIMServer.msg.msg.RevokeMsg:input_type -> OpenIMServer.msg.RevokeMsgReq - 17, // 35: OpenIMServer.msg.msg.MarkMsgsAsRead:input_type -> OpenIMServer.msg.MarkMsgsAsReadReq - 19, // 36: OpenIMServer.msg.msg.MarkConversationAsRead:input_type -> OpenIMServer.msg.MarkConversationAsReadReq - 21, // 37: OpenIMServer.msg.msg.SetConversationHasReadSeq:input_type -> OpenIMServer.msg.SetConversationHasReadSeqReq - 36, // 38: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:input_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqReq - 39, // 39: OpenIMServer.msg.msg.GetActiveUser:input_type -> OpenIMServer.msg.GetActiveUserReq - 42, // 40: OpenIMServer.msg.msg.GetActiveGroup:input_type -> OpenIMServer.msg.GetActiveGroupReq - 59, // 41: OpenIMServer.msg.msg.GetMaxSeq:output_type -> OpenIMServer.sdkws.GetMaxSeqResp - 35, // 42: OpenIMServer.msg.msg.GetConversationMaxSeq:output_type -> OpenIMServer.msg.GetConversationMaxSeqResp - 60, // 43: OpenIMServer.msg.msg.PullMessageBySeqs:output_type -> OpenIMServer.sdkws.PullMessageBySeqsResp - 46, // 44: OpenIMServer.msg.msg.SearchMessage:output_type -> OpenIMServer.msg.SearchMessageResp - 48, // 45: OpenIMServer.msg.msg.ManageMsg:output_type -> OpenIMServer.msg.manageMsgResp - 7, // 46: OpenIMServer.msg.msg.SendMsg:output_type -> OpenIMServer.msg.SendMsgResp - 25, // 47: OpenIMServer.msg.msg.ClearConversationsMsg:output_type -> OpenIMServer.msg.ClearConversationsMsgResp - 27, // 48: OpenIMServer.msg.msg.UserClearAllMsg:output_type -> OpenIMServer.msg.UserClearAllMsgResp - 29, // 49: OpenIMServer.msg.msg.DeleteMsgs:output_type -> OpenIMServer.msg.DeleteMsgsResp - 33, // 50: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:output_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqResp - 31, // 51: OpenIMServer.msg.msg.DeleteMsgPhysical:output_type -> OpenIMServer.msg.DeleteMsgPhysicalResp - 9, // 52: OpenIMServer.msg.msg.SetSendMsgStatus:output_type -> OpenIMServer.msg.SetSendMsgStatusResp - 11, // 53: OpenIMServer.msg.msg.GetSendMsgStatus:output_type -> OpenIMServer.msg.GetSendMsgStatusResp - 16, // 54: OpenIMServer.msg.msg.RevokeMsg:output_type -> OpenIMServer.msg.RevokeMsgResp - 18, // 55: OpenIMServer.msg.msg.MarkMsgsAsRead:output_type -> OpenIMServer.msg.MarkMsgsAsReadResp - 20, // 56: OpenIMServer.msg.msg.MarkConversationAsRead:output_type -> OpenIMServer.msg.MarkConversationAsReadResp - 22, // 57: OpenIMServer.msg.msg.SetConversationHasReadSeq:output_type -> OpenIMServer.msg.SetConversationHasReadSeqResp - 38, // 58: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:output_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp - 41, // 59: OpenIMServer.msg.msg.GetActiveUser:output_type -> OpenIMServer.msg.GetActiveUserResp - 44, // 60: OpenIMServer.msg.msg.GetActiveGroup:output_type -> OpenIMServer.msg.GetActiveGroupResp - 41, // [41:61] is the sub-list for method output_type - 21, // [21:41] is the sub-list for method input_type - 21, // [21:21] is the sub-list for extension type_name - 21, // [21:21] is the sub-list for extension extendee - 0, // [0:21] is the sub-list for field type_name + 37, // 18: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry.value:type_name -> OpenIMServer.msg.Seqs + 52, // 19: OpenIMServer.msg.msg.GetMaxSeq:input_type -> OpenIMServer.sdkws.GetMaxSeqReq + 34, // 20: OpenIMServer.msg.msg.GetConversationMaxSeq:input_type -> OpenIMServer.msg.GetConversationMaxSeqReq + 53, // 21: OpenIMServer.msg.msg.PullMessageBySeqs:input_type -> OpenIMServer.sdkws.PullMessageBySeqsReq + 6, // 22: OpenIMServer.msg.msg.SendMsg:input_type -> OpenIMServer.msg.SendMsgReq + 24, // 23: OpenIMServer.msg.msg.ClearConversationsMsg:input_type -> OpenIMServer.msg.ClearConversationsMsgReq + 26, // 24: OpenIMServer.msg.msg.UserClearAllMsg:input_type -> OpenIMServer.msg.UserClearAllMsgReq + 28, // 25: OpenIMServer.msg.msg.DeleteMsgs:input_type -> OpenIMServer.msg.DeleteMsgsReq + 32, // 26: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:input_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqReq + 30, // 27: OpenIMServer.msg.msg.DeleteMsgPhysical:input_type -> OpenIMServer.msg.DeleteMsgPhysicalReq + 8, // 28: OpenIMServer.msg.msg.SetSendMsgStatus:input_type -> OpenIMServer.msg.SetSendMsgStatusReq + 10, // 29: OpenIMServer.msg.msg.GetSendMsgStatus:input_type -> OpenIMServer.msg.GetSendMsgStatusReq + 15, // 30: OpenIMServer.msg.msg.RevokeMsg:input_type -> OpenIMServer.msg.RevokeMsgReq + 17, // 31: OpenIMServer.msg.msg.MarkMsgsAsRead:input_type -> OpenIMServer.msg.MarkMsgsAsReadReq + 19, // 32: OpenIMServer.msg.msg.MarkConversationAsRead:input_type -> OpenIMServer.msg.MarkConversationAsReadReq + 21, // 33: OpenIMServer.msg.msg.SetConversationHasReadSeq:input_type -> OpenIMServer.msg.SetConversationHasReadSeqReq + 36, // 34: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:input_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqReq + 39, // 35: OpenIMServer.msg.msg.GetActiveUser:input_type -> OpenIMServer.msg.GetActiveUserReq + 42, // 36: OpenIMServer.msg.msg.GetActiveGroup:input_type -> OpenIMServer.msg.GetActiveGroupReq + 54, // 37: OpenIMServer.msg.msg.GetMaxSeq:output_type -> OpenIMServer.sdkws.GetMaxSeqResp + 35, // 38: OpenIMServer.msg.msg.GetConversationMaxSeq:output_type -> OpenIMServer.msg.GetConversationMaxSeqResp + 55, // 39: OpenIMServer.msg.msg.PullMessageBySeqs:output_type -> OpenIMServer.sdkws.PullMessageBySeqsResp + 7, // 40: OpenIMServer.msg.msg.SendMsg:output_type -> OpenIMServer.msg.SendMsgResp + 25, // 41: OpenIMServer.msg.msg.ClearConversationsMsg:output_type -> OpenIMServer.msg.ClearConversationsMsgResp + 27, // 42: OpenIMServer.msg.msg.UserClearAllMsg:output_type -> OpenIMServer.msg.UserClearAllMsgResp + 29, // 43: OpenIMServer.msg.msg.DeleteMsgs:output_type -> OpenIMServer.msg.DeleteMsgsResp + 33, // 44: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:output_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqResp + 31, // 45: OpenIMServer.msg.msg.DeleteMsgPhysical:output_type -> OpenIMServer.msg.DeleteMsgPhysicalResp + 9, // 46: OpenIMServer.msg.msg.SetSendMsgStatus:output_type -> OpenIMServer.msg.SetSendMsgStatusResp + 11, // 47: OpenIMServer.msg.msg.GetSendMsgStatus:output_type -> OpenIMServer.msg.GetSendMsgStatusResp + 16, // 48: OpenIMServer.msg.msg.RevokeMsg:output_type -> OpenIMServer.msg.RevokeMsgResp + 18, // 49: OpenIMServer.msg.msg.MarkMsgsAsRead:output_type -> OpenIMServer.msg.MarkMsgsAsReadResp + 20, // 50: OpenIMServer.msg.msg.MarkConversationAsRead:output_type -> OpenIMServer.msg.MarkConversationAsReadResp + 22, // 51: OpenIMServer.msg.msg.SetConversationHasReadSeq:output_type -> OpenIMServer.msg.SetConversationHasReadSeqResp + 38, // 52: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:output_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp + 41, // 53: OpenIMServer.msg.msg.GetActiveUser:output_type -> OpenIMServer.msg.GetActiveUserResp + 44, // 54: OpenIMServer.msg.msg.GetActiveGroup:output_type -> OpenIMServer.msg.GetActiveGroupResp + 37, // [37:55] is the sub-list for method output_type + 19, // [19:37] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_msg_msg_proto_init() } @@ -4007,66 +3413,6 @@ func file_msg_msg_proto_init() { return nil } } - file_msg_msg_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchMessageReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_msg_msg_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SearchMessageResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_msg_msg_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ManageMsgReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_msg_msg_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ManageMsgResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_msg_msg_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ChatLog); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -4074,7 +3420,7 @@ func file_msg_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_msg_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 53, + NumMessages: 48, NumExtensions: 0, NumServices: 1, }, @@ -4105,8 +3451,6 @@ type MsgClient interface { GetConversationMaxSeq(ctx context.Context, in *GetConversationMaxSeqReq, opts ...grpc.CallOption) (*GetConversationMaxSeqResp, error) // 拉取历史消息(包括用户的,以及指定群组的) PullMessageBySeqs(ctx context.Context, in *sdkws.PullMessageBySeqsReq, opts ...grpc.CallOption) (*sdkws.PullMessageBySeqsResp, error) - SearchMessage(ctx context.Context, in *SearchMessageReq, opts ...grpc.CallOption) (*SearchMessageResp, error) - ManageMsg(ctx context.Context, in *ManageMsgReq, opts ...grpc.CallOption) (*ManageMsgResp, error) // 发送消息 SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) // 全量清空指定会话消息 重置min seq 比最大seq大1 @@ -4168,24 +3512,6 @@ func (c *msgClient) PullMessageBySeqs(ctx context.Context, in *sdkws.PullMessage return out, nil } -func (c *msgClient) SearchMessage(ctx context.Context, in *SearchMessageReq, opts ...grpc.CallOption) (*SearchMessageResp, error) { - out := new(SearchMessageResp) - err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/SearchMessage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ManageMsg(ctx context.Context, in *ManageMsgReq, opts ...grpc.CallOption) (*ManageMsgResp, error) { - out := new(ManageMsgResp) - err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/ManageMsg", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *msgClient) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) { out := new(SendMsgResp) err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/SendMsg", in, out, opts...) @@ -4328,8 +3654,6 @@ type MsgServer interface { GetConversationMaxSeq(context.Context, *GetConversationMaxSeqReq) (*GetConversationMaxSeqResp, error) // 拉取历史消息(包括用户的,以及指定群组的) PullMessageBySeqs(context.Context, *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) - SearchMessage(context.Context, *SearchMessageReq) (*SearchMessageResp, error) - ManageMsg(context.Context, *ManageMsgReq) (*ManageMsgResp, error) // 发送消息 SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) // 全量清空指定会话消息 重置min seq 比最大seq大1 @@ -4369,12 +3693,6 @@ func (*UnimplementedMsgServer) GetConversationMaxSeq(context.Context, *GetConver func (*UnimplementedMsgServer) PullMessageBySeqs(context.Context, *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) { return nil, status.Errorf(codes.Unimplemented, "method PullMessageBySeqs not implemented") } -func (*UnimplementedMsgServer) SearchMessage(context.Context, *SearchMessageReq) (*SearchMessageResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method SearchMessage not implemented") -} -func (*UnimplementedMsgServer) ManageMsg(context.Context, *ManageMsgReq) (*ManageMsgResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ManageMsg not implemented") -} func (*UnimplementedMsgServer) SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) { return nil, status.Errorf(codes.Unimplemented, "method SendMsg not implemented") } @@ -4479,42 +3797,6 @@ func _Msg_PullMessageBySeqs_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Msg_SearchMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SearchMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SearchMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/OpenIMServer.msg.msg/SearchMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SearchMessage(ctx, req.(*SearchMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ManageMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ManageMsgReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ManageMsg(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/OpenIMServer.msg.msg/ManageMsg", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ManageMsg(ctx, req.(*ManageMsgReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Msg_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SendMsgReq) if err := dec(in); err != nil { @@ -4801,14 +4083,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "PullMessageBySeqs", Handler: _Msg_PullMessageBySeqs_Handler, }, - { - MethodName: "SearchMessage", - Handler: _Msg_SearchMessage_Handler, - }, - { - MethodName: "ManageMsg", - Handler: _Msg_ManageMsg_Handler, - }, { MethodName: "SendMsg", Handler: _Msg_SendMsg_Handler, diff --git a/pkg/proto/msggateway/msggateway.pb.go b/pkg/proto/msggateway/msggateway.pb.go index d922d98b4..6d3aa576a 100644 --- a/pkg/proto/msggateway/msggateway.pb.go +++ b/pkg/proto/msggateway/msggateway.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,14 +8,16 @@ package msggateway import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( diff --git a/pkg/proto/push/push.pb.go b/pkg/proto/push/push.pb.go index 1dc9d2ab9..f9ef4a08a 100644 --- a/pkg/proto/push/push.pb.go +++ b/pkg/proto/push/push.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,14 +8,16 @@ package push import ( context "context" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( diff --git a/pkg/proto/sdkws/sdkws.pb.go b/pkg/proto/sdkws/sdkws.pb.go index b45d46d4c..f2038ee5a 100644 --- a/pkg/proto/sdkws/sdkws.pb.go +++ b/pkg/proto/sdkws/sdkws.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -21,11 +7,13 @@ package sdkws import ( - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" ) const ( diff --git a/pkg/proto/statistics/statistics.pb.go b/pkg/proto/statistics/statistics.pb.go index 5660758f9..092f67b52 100644 --- a/pkg/proto/statistics/statistics.pb.go +++ b/pkg/proto/statistics/statistics.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -21,9 +7,10 @@ package statistics import ( + reflect "reflect" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" ) const ( diff --git a/pkg/proto/third/third.pb.go b/pkg/proto/third/third.pb.go index 155b5f7cc..1ba6c3a05 100644 --- a/pkg/proto/third/third.pb.go +++ b/pkg/proto/third/third.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,13 +8,14 @@ package third import ( context "context" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) const ( diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index 5046505db..c96acb4a4 100644 --- a/pkg/proto/user/user.pb.go +++ b/pkg/proto/user/user.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -22,15 +8,17 @@ package user import ( context "context" - conversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" + + conversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" ) const ( diff --git a/pkg/proto/wrapperspb/wrapperspb.pb.go b/pkg/proto/wrapperspb/wrapperspb.pb.go index 9678bb2a0..2bb8b39db 100644 --- a/pkg/proto/wrapperspb/wrapperspb.pb.go +++ b/pkg/proto/wrapperspb/wrapperspb.pb.go @@ -1,17 +1,3 @@ -// Copyright © 2023 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. - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -21,10 +7,11 @@ package wrapperspb import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go index b913d1512..617446852 100644 --- a/pkg/rpcclient/conversation.go +++ b/pkg/rpcclient/conversation.go @@ -4,12 +4,11 @@ import ( "context" "fmt" - "google.golang.org/grpc" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" + "google.golang.org/grpc" ) type Conversation struct { @@ -33,10 +32,7 @@ func NewConversationRpcClient(discov discoveryregistry.SvcDiscoveryRegistry) Con return ConversationRpcClient(*NewConversation(discov)) } -func (c *ConversationRpcClient) GetSingleConversationRecvMsgOpt( - ctx context.Context, - userID, conversationID string, -) (int32, error) { +func (c *ConversationRpcClient) GetSingleConversationRecvMsgOpt(ctx context.Context, userID, conversationID string) (int32, error) { var req pbConversation.GetConversationReq req.OwnerUserID = userID req.ConversationID = conversationID @@ -48,51 +44,21 @@ func (c *ConversationRpcClient) GetSingleConversationRecvMsgOpt( } func (c *ConversationRpcClient) SingleChatFirstCreateConversation(ctx context.Context, recvID, sendID string) error { - _, err := c.Client.CreateSingleChatConversations( - ctx, - &pbConversation.CreateSingleChatConversationsReq{RecvID: recvID, SendID: sendID}, - ) + _, err := c.Client.CreateSingleChatConversations(ctx, &pbConversation.CreateSingleChatConversationsReq{RecvID: recvID, SendID: sendID}) return err } -func (c *ConversationRpcClient) GroupChatFirstCreateConversation( - ctx context.Context, - groupID string, - userIDs []string, -) error { - _, err := c.Client.CreateGroupChatConversations( - ctx, - &pbConversation.CreateGroupChatConversationsReq{UserIDs: userIDs, GroupID: groupID}, - ) +func (c *ConversationRpcClient) GroupChatFirstCreateConversation(ctx context.Context, groupID string, userIDs []string) error { + _, err := c.Client.CreateGroupChatConversations(ctx, &pbConversation.CreateGroupChatConversationsReq{UserIDs: userIDs, GroupID: groupID}) return err } -func (c *ConversationRpcClient) SetConversationMaxSeq( - ctx context.Context, - ownerUserIDs []string, - conversationID string, - maxSeq int64, -) error { - _, err := c.Client.SetConversationMaxSeq( - ctx, - &pbConversation.SetConversationMaxSeqReq{ - OwnerUserID: ownerUserIDs, - ConversationID: conversationID, - MaxSeq: maxSeq, - }, - ) +func (c *ConversationRpcClient) SetConversationMaxSeq(ctx context.Context, ownerUserIDs []string, conversationID string, maxSeq int64) error { + _, err := c.Client.SetConversationMaxSeq(ctx, &pbConversation.SetConversationMaxSeqReq{OwnerUserID: ownerUserIDs, ConversationID: conversationID, MaxSeq: maxSeq}) return err } - -func (c *ConversationRpcClient) SetConversations( - ctx context.Context, - userIDs []string, - conversation *pbConversation.ConversationReq, -) error { - _, err := c.Client.SetConversations( - ctx, - &pbConversation.SetConversationsReq{UserIDs: userIDs, Conversation: conversation}, - ) +func (c *ConversationRpcClient) SetConversations(ctx context.Context, userIDs []string, conversation *pbConversation.ConversationReq) error { + _, err := c.Client.SetConversations(ctx, &pbConversation.SetConversationsReq{UserIDs: userIDs, Conversation: conversation}) return err } @@ -104,28 +70,16 @@ func (c *ConversationRpcClient) GetConversationIDs(ctx context.Context, ownerUse return resp.ConversationIDs, nil } -func (c *ConversationRpcClient) GetConversation( - ctx context.Context, - ownerUserID, conversationID string, -) (*pbConversation.Conversation, error) { - resp, err := c.Client.GetConversation( - ctx, - &pbConversation.GetConversationReq{OwnerUserID: ownerUserID, ConversationID: conversationID}, - ) +func (c *ConversationRpcClient) GetConversation(ctx context.Context, ownerUserID, conversationID string) (*pbConversation.Conversation, error) { + resp, err := c.Client.GetConversation(ctx, &pbConversation.GetConversationReq{OwnerUserID: ownerUserID, ConversationID: conversationID}) if err != nil { return nil, err } return resp.Conversation, nil } -func (c *ConversationRpcClient) GetConversationsByConversationID( - ctx context.Context, - conversationIDs []string, -) ([]*pbConversation.Conversation, error) { - resp, err := c.Client.GetConversationsByConversationID( - ctx, - &pbConversation.GetConversationsByConversationIDReq{ConversationIDs: conversationIDs}, - ) +func (c *ConversationRpcClient) GetConversationsByConversationID(ctx context.Context, conversationIDs []string) ([]*pbConversation.Conversation, error) { + resp, err := c.Client.GetConversationsByConversationID(ctx, &pbConversation.GetConversationsByConversationIDReq{ConversationIDs: conversationIDs}) if err != nil { return nil, err } @@ -135,15 +89,8 @@ func (c *ConversationRpcClient) GetConversationsByConversationID( return resp.Conversations, nil } -func (c *ConversationRpcClient) GetConversations( - ctx context.Context, - ownerUserID string, - conversationIDs []string, -) ([]*pbConversation.Conversation, error) { - resp, err := c.Client.GetConversations( - ctx, - &pbConversation.GetConversationsReq{OwnerUserID: ownerUserID, ConversationIDs: conversationIDs}, - ) +func (c *ConversationRpcClient) GetConversations(ctx context.Context, ownerUserID string, conversationIDs []string) ([]*pbConversation.Conversation, error) { + resp, err := c.Client.GetConversations(ctx, &pbConversation.GetConversationsReq{OwnerUserID: ownerUserID, ConversationIDs: conversationIDs}) if err != nil { return nil, err } diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index df7e24194..ca02ecc90 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -3,10 +3,6 @@ package rpcclient import ( "context" "encoding/json" - "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user" - - "google.golang.org/grpc" - "google.golang.org/protobuf/proto" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" @@ -15,6 +11,8 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/msg" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" + "google.golang.org/grpc" + "google.golang.org/protobuf/proto" // "google.golang.org/protobuf/proto" ) @@ -138,10 +136,7 @@ func (m *MessageRpcClient) GetMaxSeq(ctx context.Context, req *sdkws.GetMaxSeqRe return resp, err } -func (m *MessageRpcClient) PullMessageBySeqList( - ctx context.Context, - req *sdkws.PullMessageBySeqsReq, -) (*sdkws.PullMessageBySeqsResp, error) { +func (m *MessageRpcClient) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) { resp, err := m.Client.PullMessageBySeqs(ctx, req) return resp, err } @@ -163,9 +158,7 @@ type NotificationSender struct { type NotificationSenderOptions func(*NotificationSender) -func WithLocalSendMsg( - sendMsg func(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error), -) NotificationSenderOptions { +func WithLocalSendMsg(sendMsg func(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error)) NotificationSenderOptions { return func(s *NotificationSender) { s.sendMsg = sendMsg } @@ -184,10 +177,7 @@ func WithUserRpcClient(userRpcClient *UserRpcClient) NotificationSenderOptions { } func NewNotificationSender(opts ...NotificationSenderOptions) *NotificationSender { - notificationSender := &NotificationSender{ - contentTypeConf: newContentTypeConf(), - sessionTypeConf: newSessionTypeConf(), - } + notificationSender := &NotificationSender{contentTypeConf: newContentTypeConf(), sessionTypeConf: newSessionTypeConf()} for _, opt := range opts { opt(notificationSender) } @@ -206,29 +196,11 @@ func WithRpcGetUserName() NotificationOptions { } } -func (s *NotificationSender) NotificationWithSesstionType( - ctx context.Context, - sendID, recvID string, - contentType, sesstionType int32, - m proto.Message, - opts ...NotificationOptions, -) (err error) { +func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, sendID, recvID string, contentType, sesstionType int32, m proto.Message, opts ...NotificationOptions) (err error) { n := sdkws.NotificationElem{Detail: utils.StructToJsonString(m)} content, err := json.Marshal(&n) if err != nil { - log.ZError( - ctx, - "MsgClient Notification json.Marshal failed", - err, - "sendID", - sendID, - "recvID", - recvID, - "contentType", - contentType, - "msg", - m, - ) + log.ZError(ctx, "MsgClient Notification json.Marshal failed", err, "sendID", sendID, "recvID", recvID, "contentType", contentType, "msg", m) return err } notificationOpt := ¬ificationOpt{} @@ -275,25 +247,6 @@ func (s *NotificationSender) NotificationWithSesstionType( return err } -func (s *NotificationSender) Notification( - ctx context.Context, - sendID, recvID string, - contentType int32, - m proto.Message, - opts ...NotificationOptions, -) error { +func (s *NotificationSender) Notification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message, opts ...NotificationOptions) error { return s.NotificationWithSesstionType(ctx, sendID, recvID, contentType, s.sessionTypeConf[contentType], m, opts...) } - -func (m *Message) GetAllUserID(ctx context.Context, req *user.GetAllUserIDReq) (*user.GetAllUserIDResp, error) { - conn, err := m.discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName) - if err != nil { - panic(err) - } - client := user.NewUserClient(conn) - resp, err := client.GetAllUserID(ctx, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/pkg/rpcclient/notification/group.go b/pkg/rpcclient/notification/group.go index 98af29b03..3efe76802 100644 --- a/pkg/rpcclient/notification/group.go +++ b/pkg/rpcclient/notification/group.go @@ -16,19 +16,11 @@ import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" ) -func NewGroupNotificationSender( - db controller.GroupDatabase, - msgRpcClient *rpcclient.MessageRpcClient, - userRpcClient *rpcclient.UserRpcClient, - fn func(ctx context.Context, userIDs []string) ([]CommonUser, error), -) *GroupNotificationSender { +func NewGroupNotificationSender(db controller.GroupDatabase, msgRpcClient *rpcclient.MessageRpcClient, userRpcClient *rpcclient.UserRpcClient, fn func(ctx context.Context, userIDs []string) ([]CommonUser, error)) *GroupNotificationSender { return &GroupNotificationSender{ - NotificationSender: rpcclient.NewNotificationSender( - rpcclient.WithRpcClient(msgRpcClient), - rpcclient.WithUserRpcClient(userRpcClient), - ), - getUsersInfo: fn, - db: db, + NotificationSender: rpcclient.NewNotificationSender(rpcclient.WithRpcClient(msgRpcClient), rpcclient.WithUserRpcClient(userRpcClient)), + getUsersInfo: fn, + db: db, } } @@ -88,11 +80,7 @@ func (g *GroupNotificationSender) getGroupInfo(ctx context.Context, groupID stri }, nil } -func (g *GroupNotificationSender) getGroupMembers( - ctx context.Context, - groupID string, - userIDs []string, -) ([]*sdkws.GroupMemberFullInfo, error) { +func (g *GroupNotificationSender) getGroupMembers(ctx context.Context, groupID string, userIDs []string) ([]*sdkws.GroupMemberFullInfo, error) { members, err := g.db.FindGroupMember(ctx, []string{groupID}, userIDs, nil) if err != nil { return nil, err @@ -107,9 +95,7 @@ func (g *GroupNotificationSender) getGroupMembers( for _, member := range members { user, ok := users[member.UserID] if !ok { - return nil, errs.ErrUserIDNotFound.Wrap( - fmt.Sprintf("group %s member %s not in user", member.GroupID, member.UserID), - ) + return nil, errs.ErrUserIDNotFound.Wrap(fmt.Sprintf("group %s member %s not in user", member.GroupID, member.UserID)) } if member.Nickname == "" { member.Nickname = user.Nickname @@ -131,11 +117,7 @@ func (g *GroupNotificationSender) getGroupMembers( return res, nil } -func (g *GroupNotificationSender) getGroupMemberMap( - ctx context.Context, - groupID string, - userIDs []string, -) (map[string]*sdkws.GroupMemberFullInfo, error) { +func (g *GroupNotificationSender) getGroupMemberMap(ctx context.Context, groupID string, userIDs []string) (map[string]*sdkws.GroupMemberFullInfo, error) { members, err := g.getGroupMembers(ctx, groupID, userIDs) if err != nil { return nil, err @@ -147,11 +129,7 @@ func (g *GroupNotificationSender) getGroupMemberMap( return m, nil } -func (g *GroupNotificationSender) getGroupMember( - ctx context.Context, - groupID string, - userID string, -) (*sdkws.GroupMemberFullInfo, error) { +func (g *GroupNotificationSender) getGroupMember(ctx context.Context, groupID string, userID string) (*sdkws.GroupMemberFullInfo, error) { members, err := g.getGroupMembers(ctx, groupID, []string{userID}) if err != nil { return nil, err @@ -171,11 +149,7 @@ func (g *GroupNotificationSender) getGroupOwnerAndAdminUserID(ctx context.Contex return utils.Slice(members, fn), nil } -func (g *GroupNotificationSender) groupDB2PB( - group *relation.GroupModel, - ownerUserID string, - memberCount uint32, -) *sdkws.GroupInfo { +func (g *GroupNotificationSender) groupDB2PB(group *relation.GroupModel, ownerUserID string, memberCount uint32) *sdkws.GroupInfo { return &sdkws.GroupInfo{ GroupID: group.GroupID, GroupName: group.GroupName, @@ -197,10 +171,7 @@ func (g *GroupNotificationSender) groupDB2PB( } } -func (g *GroupNotificationSender) groupMemberDB2PB( - member *relation.GroupMemberModel, - appMangerLevel int32, -) *sdkws.GroupMemberFullInfo { +func (g *GroupNotificationSender) groupMemberDB2PB(member *relation.GroupMemberModel, appMangerLevel int32) *sdkws.GroupMemberFullInfo { return &sdkws.GroupMemberFullInfo{ GroupID: member.GroupID, UserID: member.UserID, @@ -217,10 +188,7 @@ func (g *GroupNotificationSender) groupMemberDB2PB( } } -func (g *GroupNotificationSender) getUsersInfoMap( - ctx context.Context, - userIDs []string, -) (map[string]*sdkws.UserInfo, error) { +func (g *GroupNotificationSender) getUsersInfoMap(ctx context.Context, userIDs []string) (map[string]*sdkws.UserInfo, error) { users, err := g.getUsersInfo(ctx, userIDs) if err != nil { return nil, err @@ -232,11 +200,7 @@ func (g *GroupNotificationSender) getUsersInfoMap( return result, nil } -func (g *GroupNotificationSender) fillOpUser( - ctx context.Context, - opUser **sdkws.GroupMemberFullInfo, - groupID string, -) error { +func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) error { if opUser == nil { return errs.ErrInternalServer.Wrap("**sdkws.GroupMemberFullInfo is nil") } @@ -275,70 +239,35 @@ func (g *GroupNotificationSender) fillOpUser( return nil } -func (g *GroupNotificationSender) GroupCreatedNotification( - ctx context.Context, - tips *sdkws.GroupCreatedTips, -) (err error) { +func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, tips *sdkws.GroupCreatedTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupCreatedNotification, tips) } -func (g *GroupNotificationSender) GroupInfoSetNotification( - ctx context.Context, - tips *sdkws.GroupInfoSetTips, -) (err error) { +func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, tips *sdkws.GroupInfoSetTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - tips.Group.GroupID, - constant.GroupInfoSetNotification, - tips, - rpcclient.WithRpcGetUserName(), - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNotification, tips, rpcclient.WithRpcGetUserName()) } -func (g *GroupNotificationSender) GroupInfoSetNameNotification( - ctx context.Context, - tips *sdkws.GroupInfoSetNameTips, -) (err error) { +func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Context, tips *sdkws.GroupInfoSetNameTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - tips.Group.GroupID, - constant.GroupInfoSetNameNotification, - tips, - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetNameNotification, tips) } -func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification( - ctx context.Context, - tips *sdkws.GroupInfoSetAnnouncementTips, -) (err error) { +func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx context.Context, tips *sdkws.GroupInfoSetAnnouncementTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - tips.Group.GroupID, - constant.GroupInfoSetAnnouncementNotification, - tips, - rpcclient.WithRpcGetUserName(), - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupInfoSetAnnouncementNotification, tips, rpcclient.WithRpcGetUserName()) } -func (g *GroupNotificationSender) JoinGroupApplicationNotification( - ctx context.Context, - req *pbGroup.JoinGroupReq, -) (err error) { +func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { return err @@ -362,10 +291,7 @@ func (g *GroupNotificationSender) JoinGroupApplicationNotification( return nil } -func (g *GroupNotificationSender) MemberQuitNotification( - ctx context.Context, - member *sdkws.GroupMemberFullInfo, -) (err error) { +func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, member *sdkws.GroupMemberFullInfo) (err error) { defer log.ZDebug(ctx, "return") defer func() { if err != nil { @@ -380,10 +306,7 @@ func (g *GroupNotificationSender) MemberQuitNotification( return g.Notification(ctx, mcontext.GetOpUserID(ctx), member.GroupID, constant.MemberQuitNotification, tips) } -func (g *GroupNotificationSender) GroupApplicationAcceptedNotification( - ctx context.Context, - req *pbGroup.GroupApplicationResponseReq, -) (err error) { +func (g *GroupNotificationSender) GroupApplicationAcceptedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) { defer log.ZDebug(ctx, "return") defer func() { if err != nil { @@ -403,13 +326,7 @@ func (g *GroupNotificationSender) GroupApplicationAcceptedNotification( return err } for _, userID := range append(userIDs, mcontext.GetOpUserID(ctx)) { - err = g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - userID, - constant.GroupApplicationAcceptedNotification, - tips, - ) + err = g.Notification(ctx, mcontext.GetOpUserID(ctx), userID, constant.GroupApplicationAcceptedNotification, tips) if err != nil { log.ZError(ctx, "failed", err) } @@ -417,10 +334,7 @@ func (g *GroupNotificationSender) GroupApplicationAcceptedNotification( return nil } -func (g *GroupNotificationSender) GroupApplicationRejectedNotification( - ctx context.Context, - req *pbGroup.GroupApplicationResponseReq, -) (err error) { +func (g *GroupNotificationSender) GroupApplicationRejectedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { return err @@ -434,13 +348,7 @@ func (g *GroupNotificationSender) GroupApplicationRejectedNotification( return err } for _, userID := range append(userIDs, mcontext.GetOpUserID(ctx)) { - err = g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - userID, - constant.GroupApplicationRejectedNotification, - tips, - ) + err = g.Notification(ctx, mcontext.GetOpUserID(ctx), userID, constant.GroupApplicationRejectedNotification, tips) if err != nil { log.ZError(ctx, "failed", err) } @@ -448,10 +356,7 @@ func (g *GroupNotificationSender) GroupApplicationRejectedNotification( return nil } -func (g *GroupNotificationSender) GroupOwnerTransferredNotification( - ctx context.Context, - req *pbGroup.TransferGroupOwnerReq, -) (err error) { +func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { return err @@ -461,38 +366,21 @@ func (g *GroupNotificationSender) GroupOwnerTransferredNotification( if err != nil { return err } - tips := &sdkws.GroupOwnerTransferredTips{ - Group: group, - OpUser: member[opUserID], - NewGroupOwner: member[req.NewOwnerUserID], - } + tips := &sdkws.GroupOwnerTransferredTips{Group: group, OpUser: member[opUserID], NewGroupOwner: member[req.NewOwnerUserID]} if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - group.GroupID, - constant.GroupOwnerTransferredNotification, - tips, - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupOwnerTransferredNotification, tips) } -func (g *GroupNotificationSender) MemberKickedNotification( - ctx context.Context, - tips *sdkws.MemberKickedTips, -) (err error) { +func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context, tips *sdkws.MemberKickedTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.MemberKickedNotification, tips) } -func (g *GroupNotificationSender) MemberInvitedNotification( - ctx context.Context, - groupID, reason string, - invitedUserIDList []string, -) (err error) { +func (g *GroupNotificationSender) MemberInvitedNotification(ctx context.Context, groupID, reason string, invitedUserIDList []string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { return err @@ -511,10 +399,7 @@ func (g *GroupNotificationSender) MemberInvitedNotification( return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberInvitedNotification, tips) } -func (g *GroupNotificationSender) MemberEnterNotification( - ctx context.Context, - req *pbGroup.GroupApplicationResponseReq, -) (err error) { +func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) { group, err := g.getGroupInfo(ctx, req.GroupID) if err != nil { return err @@ -527,21 +412,14 @@ func (g *GroupNotificationSender) MemberEnterNotification( return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberEnterNotification, tips) } -func (g *GroupNotificationSender) GroupDismissedNotification( - ctx context.Context, - tips *sdkws.GroupDismissedTips, -) (err error) { +func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context, tips *sdkws.GroupDismissedTips) (err error) { if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupDismissedNotification, tips) } -func (g *GroupNotificationSender) GroupMemberMutedNotification( - ctx context.Context, - groupID, groupMemberUserID string, - mutedSeconds uint32, -) (err error) { +func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Context, groupID, groupMemberUserID string, mutedSeconds uint32) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { return err @@ -558,10 +436,7 @@ func (g *GroupNotificationSender) GroupMemberMutedNotification( return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberMutedNotification, tips) } -func (g *GroupNotificationSender) GroupMemberCancelMutedNotification( - ctx context.Context, - groupID, groupMemberUserID string, -) (err error) { +func (g *GroupNotificationSender) GroupMemberCancelMutedNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { return err @@ -570,21 +445,11 @@ func (g *GroupNotificationSender) GroupMemberCancelMutedNotification( if err != nil { return err } - tips := &sdkws.GroupMemberCancelMutedTips{ - Group: group, - OpUser: user[mcontext.GetOpUserID(ctx)], - MutedUser: user[groupMemberUserID], - } + tips := &sdkws.GroupMemberCancelMutedTips{Group: group, OpUser: user[mcontext.GetOpUserID(ctx)], MutedUser: user[groupMemberUserID]} if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - group.GroupID, - constant.GroupMemberCancelMutedNotification, - tips, - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberCancelMutedNotification, tips) } func (g *GroupNotificationSender) GroupMutedNotification(ctx context.Context, groupID string) (err error) { @@ -625,10 +490,7 @@ func (g *GroupNotificationSender) GroupCancelMutedNotification(ctx context.Conte return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupCancelMutedNotification, tips) } -func (g *GroupNotificationSender) GroupMemberInfoSetNotification( - ctx context.Context, - groupID, groupMemberUserID string, -) (err error) { +func (g *GroupNotificationSender) GroupMemberInfoSetNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { return err @@ -637,21 +499,14 @@ func (g *GroupNotificationSender) GroupMemberInfoSetNotification( if err != nil { return err } - tips := &sdkws.GroupMemberInfoSetTips{ - Group: group, - OpUser: user[mcontext.GetOpUserID(ctx)], - ChangedUser: user[groupMemberUserID], - } + tips := &sdkws.GroupMemberInfoSetTips{Group: group, OpUser: user[mcontext.GetOpUserID(ctx)], ChangedUser: user[groupMemberUserID]} if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberInfoSetNotification, tips) } -func (g *GroupNotificationSender) GroupMemberSetToAdminNotification( - ctx context.Context, - groupID, groupMemberUserID string, -) (err error) { +func (g *GroupNotificationSender) GroupMemberSetToAdminNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { return err @@ -660,27 +515,14 @@ func (g *GroupNotificationSender) GroupMemberSetToAdminNotification( if err != nil { return err } - tips := &sdkws.GroupMemberInfoSetTips{ - Group: group, - OpUser: user[mcontext.GetOpUserID(ctx)], - ChangedUser: user[groupMemberUserID], - } + tips := &sdkws.GroupMemberInfoSetTips{Group: group, OpUser: user[mcontext.GetOpUserID(ctx)], ChangedUser: user[groupMemberUserID]} if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - group.GroupID, - constant.GroupMemberSetToAdminNotification, - tips, - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToAdminNotification, tips) } -func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification( - ctx context.Context, - groupID, groupMemberUserID string, -) (err error) { +func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) { group, err := g.getGroupInfo(ctx, groupID) if err != nil { return err @@ -689,28 +531,14 @@ func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification( if err != nil { return err } - tips := &sdkws.GroupMemberInfoSetTips{ - Group: group, - OpUser: user[mcontext.GetOpUserID(ctx)], - ChangedUser: user[groupMemberUserID], - } + tips := &sdkws.GroupMemberInfoSetTips{Group: group, OpUser: user[mcontext.GetOpUserID(ctx)], ChangedUser: user[groupMemberUserID]} if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { return err } - return g.Notification( - ctx, - mcontext.GetOpUserID(ctx), - group.GroupID, - constant.GroupMemberSetToOrdinaryUserNotification, - tips, - ) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToOrdinaryUserNotification, tips) } -func (g *GroupNotificationSender) MemberEnterDirectlyNotification( - ctx context.Context, - groupID string, - entrantUserID string, -) (err error) { +func (g *GroupNotificationSender) MemberEnterDirectlyNotification(ctx context.Context, groupID string, entrantUserID string) (err error) { defer log.ZDebug(ctx, "return") defer func() { if err != nil { diff --git a/pkg/rpcclient/notification/msg.go b/pkg/rpcclient/notification/msg.go index 8cd7b019e..97724f727 100644 --- a/pkg/rpcclient/notification/msg.go +++ b/pkg/rpcclient/notification/msg.go @@ -16,11 +16,7 @@ func NewMsgNotificationSender(opts ...rpcclient.NotificationSenderOptions) *MsgN return &MsgNotificationSender{rpcclient.NewNotificationSender(opts...)} } -func (m *MsgNotificationSender) UserDeleteMsgsNotification( - ctx context.Context, - userID, conversationID string, - seqs []int64, -) error { +func (m *MsgNotificationSender) UserDeleteMsgsNotification(ctx context.Context, userID, conversationID string, seqs []int64) error { tips := sdkws.DeleteMsgsTips{ UserID: userID, ConversationID: conversationID, @@ -29,14 +25,7 @@ func (m *MsgNotificationSender) UserDeleteMsgsNotification( return m.Notification(ctx, userID, userID, constant.MsgDeleteNotification, &tips) } -func (m *MsgNotificationSender) MarkAsReadNotification( - ctx context.Context, - conversationID string, - sesstionType int32, - sendID, recvID string, - seqs []int64, - hasReadSeq int64, -) error { +func (m *MsgNotificationSender) MarkAsReadNotification(ctx context.Context, conversationID string, sesstionType int32, sendID, recvID string, seqs []int64, hasReadSeq int64) error { tips := &sdkws.MarkAsReadTips{ MarkAsReadUserID: sendID, ConversationID: conversationID, diff --git a/pkg/rpcclient/third.go b/pkg/rpcclient/third.go index 578586ca3..4f57cbd69 100644 --- a/pkg/rpcclient/third.go +++ b/pkg/rpcclient/third.go @@ -16,9 +16,6 @@ package rpcclient import ( "context" - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" - "net/url" "google.golang.org/grpc" @@ -28,10 +25,9 @@ import ( ) type Third struct { - conn grpc.ClientConnInterface - Client third.ThirdClient - discov discoveryregistry.SvcDiscoveryRegistry - MinioClient *minio.Client + conn grpc.ClientConnInterface + Client third.ThirdClient + discov discoveryregistry.SvcDiscoveryRegistry } func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third { @@ -40,30 +36,5 @@ func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third { panic(err) } client := third.NewThirdClient(conn) - minioClient, err := minioInit() - return &Third{discov: discov, Client: client, conn: conn, MinioClient: minioClient} -} - -func minioInit() (*minio.Client, error) { - minioClient := &minio.Client{} - var initUrl string - initUrl = config.Config.Object.Minio.Endpoint - minioUrl, err := url.Parse(initUrl) - if err != nil { - return nil, err - } - opts := &minio.Options{ - Creds: credentials.NewStaticV4(config.Config.Object.Minio.AccessKeyID, config.Config.Object.Minio.SecretAccessKey, ""), - //Region: config.Config.Credential.Minio.Location, - } - if minioUrl.Scheme == "http" { - opts.Secure = false - } else if minioUrl.Scheme == "https" { - opts.Secure = true - } - minioClient, err = minio.New(minioUrl.Host, opts) - if err != nil { - return nil, err - } - return minioClient, nil + return &Third{discov: discov, Client: client, conn: conn} } From fd3c19d6a5e0aafb250af8b01f414a3997dd2430 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Thu, 13 Jul 2023 15:45:03 +0800 Subject: [PATCH 10/20] feat: add test file Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .dockerignore | 31 +++++++++++++++ .github/workflows/build-docker-image.yml | 36 +++++++++++++++++ .github/workflows/openim-ci.yml | 21 +--------- Dockerfile | 50 +++++++++++++----------- docker-compose.yaml | 2 +- scripts/build_all_service.sh | 18 +++------ 6 files changed, 101 insertions(+), 57 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/build-docker-image.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..9faeff616 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,31 @@ +# Ignore files and directories starting with a dot + +# Ignore specific files +.dockerignore + +# Ignore build artifacts +_output/ +logs/ + +# Ignore non-essential documentation +README.md +README-zh_CN.md +CONTRIBUTING.md +CHANGELOG/ +# LICENSE + +# Ignore testing and linting configuration +.golangci.yml + +# Ignore deployment-related files +docker-compose.yaml +deployments/ + +# Ignore assets +assets/ + +# Ignore components +components/ + +# Ignore tools and scripts +.github/ diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 000000000..553ae5d10 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,36 @@ +name: OpenIM Build Docker Images +on: + push: + tags: + - v* +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + bin: + - ssserver + - sslocal + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker metadata + id: metadata + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository_owner }}/openim-${{ matrix.bin }} + - name: Build and release Docker images + uses: docker/build-push-action@v3 + with: + platforms: linux/386,linux/amd64,linux/arm64/v8 + target: ${{ matrix.bin }} + tags: ${{ steps.metadata.outputs.tags }} + push: true \ No newline at end of file diff --git a/.github/workflows/openim-ci.yml b/.github/workflows/openim-ci.yml index 73b30e42b..6460a43b1 100644 --- a/.github/workflows/openim-ci.yml +++ b/.github/workflows/openim-ci.yml @@ -83,7 +83,7 @@ jobs: - name: Build source code for host platform run: | - make multiarch + make build echo "Build source code for host platform successfully" # - name: Collect Test Coverage File @@ -132,22 +132,3 @@ jobs: # - name: Test docker image # run: | # docker build -t openim:ci-build . - -# goreleaser-test: -# runs-on: ubuntu-20.04 -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# with: -# fetch-depth: 0 - -# - name: Set up Go -# uses: actions/setup-go@v3 -# with: -# go-version: ${{ env.GO_VERSION }} - -# - name: Run GoReleaser -# uses: goreleaser/goreleaser-action@v4 -# with: -# version: latest -# args: release --clean --skip-publish --snapshot diff --git a/Dockerfile b/Dockerfile index 579c0c1d6..09cb0b3b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,43 @@ +# Build Stage FROM golang as build -# go mod Installation source, container environment variable addition will override the default variable value -ENV GO111MODULE=on -ENV GOPROXY=https://goproxy.cn,direct +# Set go mod installation source and proxy +ARG GO111MODULE=on +ARG GOPROXY=https://goproxy.cn,direct +ENV GO111MODULE=$GO111MODULE +ENV GOPROXY=$GOPROXY # Set up the working directory WORKDIR /Open-IM-Server -# add all files to the container -COPY . . -WORKDIR /Open-IM-Server/scripts -RUN chmod +x *.sh - -RUN /bin/sh -c ./build_all_service.sh +# Copy all files to the container +ADD . . -#Blank image Multi-Stage Build -FROM ubuntu +RUN /bin/sh -c "make build" -RUN rm -rf /var/lib/apt/lists/* -RUN apt-get update && apt-get install apt-transport-https && apt-get install procps\ -&&apt-get install net-tools -#Non-interactive operation -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get install -y vim curl tzdata gawk -#Time zone adjusted to East eighth District -RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata +# Production Stage +FROM alpine +RUN apk --no-cache add tzdata -#set directory to map logs,config file,scripts file. -VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/scripts","/Open-IM-Server/db/sdk"] +# Set directory to map logs, config files, scripts, and SDK +VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"] -#Copy scripts files and binary files to the blank image +# Copy scripts and binary files to the production image COPY --from=build /Open-IM-Server/scripts /Open-IM-Server/scripts -COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64 +COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/arm64 /Open-IM-Server/_output/bin/platforms/linux/arm64 WORKDIR /Open-IM-Server/scripts CMD ["./docker_start_all.sh"] + +PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le +.PHONY: docker-buildx +docker-buildx: test ## Build and push docker image for the manager for cross-platform support + # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile + sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross + - $(CONTAINER_TOOL) buildx create --name project-v3-builder + $(CONTAINER_TOOL) buildx use project-v3-builder + - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . + - $(CONTAINER_TOOL) buildx rm project-v3-builder + rm Dockerfile.cross \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index cea3b1480..842b05ae5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -100,7 +100,7 @@ services: openim_server: - image: ghcr.io/openimsdk/openim-server:v3.0.0-alpha.0 + image: ghcr.io/openimsdk/openim-server:v3.0.0-alpha.1 container_name: openim-server volumes: - ./logs:/Open-IM-Server/logs diff --git a/scripts/build_all_service.sh b/scripts/build_all_service.sh index 3fd56b420..30c671d48 100755 --- a/scripts/build_all_service.sh +++ b/scripts/build_all_service.sh @@ -37,10 +37,12 @@ echo -e "${BOLD_PREFIX}_________________________________________________________ bin_dir="$BIN_DIR" logs_dir="$OPENIM_ROOT/logs" sdk_db_dir="$OPENIM_ROOT/db/sdk/" + +echo "==> bin_dir=$bin_dir" +echo "==> logs_dir=$logs_dir" +echo "==> sdk_db_dir=$sdk_db_dir" + # Automatically created when there is no bin, logs folder -if [ ! -d $bin_dir ]; then - mkdir -p $bin_dir -fi if [ ! -d $logs_dir ]; then mkdir -p $logs_dir fi @@ -48,16 +50,6 @@ if [ ! -d $sdk_db_dir ]; then mkdir -p $sdk_db_dir fi -#Include shell font styles and some basic information -OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. - -echo "PWD=================>$PWD" - -#Include shell font styles and some basic information -source ./style_info.sh -source ./path_info.sh -source ./function.sh - cd $OPENIM_ROOT # Execute 'make build' From 6ecf253ef626a2a8ada443071c4c2d08c4c92b17 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Thu, 13 Jul 2023 17:07:42 +0800 Subject: [PATCH 11/20] feat: add copy Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .gitignore | 1 - Dockerfile | 11 -------- cmd/openim-msgtransfer/main.go | 14 ++++++++++ internal/api/third.go | 14 ++++++++++ internal/msgtransfer/init.go | 14 ++++++++++ internal/push/push_to_client.go | 14 ++++++++++ internal/rpc/conversation/conversaion.go | 14 ++++++++++ internal/rpc/group/group.go | 14 ++++++++++ internal/rpc/group/statistics.go | 14 ++++++++++ internal/rpc/msg/server.go | 14 ++++++++++ internal/rpc/msg/statistics.go | 14 ++++++++++ internal/rpc/third/s3.go | 14 ++++++++++ internal/rpc/third/third.go | 14 ++++++++++ internal/rpc/third/tool.go | 14 ++++++++++ internal/rpc/user/user.go | 14 ++++++++++ internal/tools/conversation.go | 14 ++++++++++ internal/tools/msg.go | 14 ++++++++++ pkg/apiresp/format.go | 14 ++++++++++ pkg/apistruct/msg.go | 14 ++++++++++ pkg/common/cmd/rpc.go | 14 ++++++++++ pkg/common/db/controller/conversation.go | 14 ++++++++++ pkg/common/db/controller/msg.go | 14 ++++++++++ pkg/common/db/controller/s3.go | 14 ++++++++++ pkg/common/db/relation/conversation_model.go | 14 ++++++++++ pkg/common/db/relation/group_model.go | 14 ++++++++++ pkg/common/db/relation/object_model.go | 14 ++++++++++ pkg/common/db/s3/cont/consts.go | 14 ++++++++++ pkg/common/db/s3/cont/controller.go | 14 ++++++++++ pkg/common/db/s3/cont/error.go | 14 ++++++++++ pkg/common/db/s3/cont/id.go | 14 ++++++++++ pkg/common/db/s3/cont/structs.go | 14 ++++++++++ pkg/common/db/s3/cos/cos.go | 14 ++++++++++ pkg/common/db/s3/minio/minio.go | 14 ++++++++++ pkg/common/db/s3/oss/oss.go | 14 ++++++++++ pkg/common/db/s3/oss/sign.go | 14 ++++++++++ pkg/common/db/s3/oss/sort.go | 14 ++++++++++ pkg/common/db/s3/s3.go | 14 ++++++++++ pkg/common/db/table/relation/conversation.go | 14 ++++++++++ pkg/common/db/table/relation/object.go | 14 ++++++++++ pkg/common/log/sql_logger.go | 14 ++++++++++ pkg/discoveryregistry/zookeeper/discover.go | 14 ++++++++++ pkg/rpcclient/conversation.go | 14 ++++++++++ pkg/rpcclient/msg.go | 14 ++++++++++ pkg/rpcclient/notification/group.go | 14 ++++++++++ pkg/rpcclient/notification/msg.go | 14 ++++++++++ scripts/build_all_service.sh | 11 ++++++-- scripts/make-rules/copyright.mk | 4 +-- scripts/make-rules/image.mk | 28 ++++++++++++++++++++ test/common.sh | 1 + 49 files changed, 642 insertions(+), 16 deletions(-) create mode 100644 test/common.sh diff --git a/.gitignore b/.gitignore index d8c6b0286..6edf18a05 100644 --- a/.gitignore +++ b/.gitignore @@ -353,7 +353,6 @@ cscope.po.out *testsdir *testsfile *testsfiles -*test *testdir *testfile *testfiles diff --git a/Dockerfile b/Dockerfile index 09cb0b3b4..230b9d6d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,14 +30,3 @@ COPY --from=build /Open-IM-Server/_output/bin/platforms/linux/arm64 /Open-IM-Ser WORKDIR /Open-IM-Server/scripts CMD ["./docker_start_all.sh"] - -PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le -.PHONY: docker-buildx -docker-buildx: test ## Build and push docker image for the manager for cross-platform support - # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile - sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - - $(CONTAINER_TOOL) buildx create --name project-v3-builder - $(CONTAINER_TOOL) buildx use project-v3-builder - - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . - - $(CONTAINER_TOOL) buildx rm project-v3-builder - rm Dockerfile.cross \ No newline at end of file diff --git a/cmd/openim-msgtransfer/main.go b/cmd/openim-msgtransfer/main.go index 7f8d1ce80..aef347793 100644 --- a/cmd/openim-msgtransfer/main.go +++ b/cmd/openim-msgtransfer/main.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 main import ( diff --git a/internal/api/third.go b/internal/api/third.go index 19beeeb11..3f28aca89 100644 --- a/internal/api/third.go +++ b/internal/api/third.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 api import ( diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index 1f166d743..17b350247 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 msgtransfer import ( diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 607d862e1..f12b4b4c8 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 push import ( diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 1f45d0224..5372d4220 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 conversation import ( diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index ec5d0bdb5..161e8b8f8 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 group import ( diff --git a/internal/rpc/group/statistics.go b/internal/rpc/group/statistics.go index c6664b4df..9b83a5ead 100644 --- a/internal/rpc/group/statistics.go +++ b/internal/rpc/group/statistics.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 group import ( diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 17aac5040..3289a4b47 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 msg import ( diff --git a/internal/rpc/msg/statistics.go b/internal/rpc/msg/statistics.go index 872ec8f18..309534507 100644 --- a/internal/rpc/msg/statistics.go +++ b/internal/rpc/msg/statistics.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 msg import ( diff --git a/internal/rpc/third/s3.go b/internal/rpc/third/s3.go index 4cbbd3d7d..984fca94f 100644 --- a/internal/rpc/third/s3.go +++ b/internal/rpc/third/s3.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 third import ( diff --git a/internal/rpc/third/third.go b/internal/rpc/third/third.go index 7c487b1d2..99ddcb342 100644 --- a/internal/rpc/third/third.go +++ b/internal/rpc/third/third.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 third import ( diff --git a/internal/rpc/third/tool.go b/internal/rpc/third/tool.go index 84017ae1f..247f3e21d 100644 --- a/internal/rpc/third/tool.go +++ b/internal/rpc/third/tool.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 third import ( diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 4619db4ce..9b1e691e5 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 user import ( diff --git a/internal/tools/conversation.go b/internal/tools/conversation.go index 1cad58248..8efa77be8 100644 --- a/internal/tools/conversation.go +++ b/internal/tools/conversation.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 tools import ( diff --git a/internal/tools/msg.go b/internal/tools/msg.go index 7247d32eb..18e7fb584 100644 --- a/internal/tools/msg.go +++ b/internal/tools/msg.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 tools import ( diff --git a/pkg/apiresp/format.go b/pkg/apiresp/format.go index 34fb85464..b53f31cbd 100644 --- a/pkg/apiresp/format.go +++ b/pkg/apiresp/format.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 apiresp type ApiFormat interface { diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index a07616ff2..ebbdc9650 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 apistruct type DelMsgReq struct { diff --git a/pkg/common/cmd/rpc.go b/pkg/common/cmd/rpc.go index c9ac80b44..239858764 100644 --- a/pkg/common/cmd/rpc.go +++ b/pkg/common/cmd/rpc.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cmd import ( diff --git a/pkg/common/db/controller/conversation.go b/pkg/common/db/controller/conversation.go index 7908d163a..659d250c6 100644 --- a/pkg/common/db/controller/conversation.go +++ b/pkg/common/db/controller/conversation.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 controller import ( diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index f23e7580c..30a8fc265 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 controller import ( diff --git a/pkg/common/db/controller/s3.go b/pkg/common/db/controller/s3.go index b3cc9dbb4..ecc438ef2 100644 --- a/pkg/common/db/controller/s3.go +++ b/pkg/common/db/controller/s3.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 controller import ( diff --git a/pkg/common/db/relation/conversation_model.go b/pkg/common/db/relation/conversation_model.go index f4a282af0..10b82ef7c 100644 --- a/pkg/common/db/relation/conversation_model.go +++ b/pkg/common/db/relation/conversation_model.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 relation import ( diff --git a/pkg/common/db/relation/group_model.go b/pkg/common/db/relation/group_model.go index f3e1aec2f..8afc97bef 100644 --- a/pkg/common/db/relation/group_model.go +++ b/pkg/common/db/relation/group_model.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 relation import ( diff --git a/pkg/common/db/relation/object_model.go b/pkg/common/db/relation/object_model.go index bd2d22c3f..928c72fbe 100644 --- a/pkg/common/db/relation/object_model.go +++ b/pkg/common/db/relation/object_model.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 relation import ( diff --git a/pkg/common/db/s3/cont/consts.go b/pkg/common/db/s3/cont/consts.go index 144370a2d..1a0467ce5 100644 --- a/pkg/common/db/s3/cont/consts.go +++ b/pkg/common/db/s3/cont/consts.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cont const ( diff --git a/pkg/common/db/s3/cont/controller.go b/pkg/common/db/s3/cont/controller.go index ba834a739..0ab700e21 100644 --- a/pkg/common/db/s3/cont/controller.go +++ b/pkg/common/db/s3/cont/controller.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cont import ( diff --git a/pkg/common/db/s3/cont/error.go b/pkg/common/db/s3/cont/error.go index afd1d0eba..af09779ee 100644 --- a/pkg/common/db/s3/cont/error.go +++ b/pkg/common/db/s3/cont/error.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cont import ( diff --git a/pkg/common/db/s3/cont/id.go b/pkg/common/db/s3/cont/id.go index 67acfae37..47f37d4aa 100644 --- a/pkg/common/db/s3/cont/id.go +++ b/pkg/common/db/s3/cont/id.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cont import ( diff --git a/pkg/common/db/s3/cont/structs.go b/pkg/common/db/s3/cont/structs.go index 160dfba70..1ebbfcaed 100644 --- a/pkg/common/db/s3/cont/structs.go +++ b/pkg/common/db/s3/cont/structs.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cont import "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/s3" diff --git a/pkg/common/db/s3/cos/cos.go b/pkg/common/db/s3/cos/cos.go index 4b1b4aa4d..c3a2b104c 100644 --- a/pkg/common/db/s3/cos/cos.go +++ b/pkg/common/db/s3/cos/cos.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 cos import ( diff --git a/pkg/common/db/s3/minio/minio.go b/pkg/common/db/s3/minio/minio.go index 367cbe8a8..b7d05908e 100644 --- a/pkg/common/db/s3/minio/minio.go +++ b/pkg/common/db/s3/minio/minio.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 minio import ( diff --git a/pkg/common/db/s3/oss/oss.go b/pkg/common/db/s3/oss/oss.go index f2b50da50..1b5745fe1 100644 --- a/pkg/common/db/s3/oss/oss.go +++ b/pkg/common/db/s3/oss/oss.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 oss import ( diff --git a/pkg/common/db/s3/oss/sign.go b/pkg/common/db/s3/oss/sign.go index 82618d287..a272a64c5 100644 --- a/pkg/common/db/s3/oss/sign.go +++ b/pkg/common/db/s3/oss/sign.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 oss import ( diff --git a/pkg/common/db/s3/oss/sort.go b/pkg/common/db/s3/oss/sort.go index 40c9a5af1..667984ffb 100644 --- a/pkg/common/db/s3/oss/sort.go +++ b/pkg/common/db/s3/oss/sort.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 oss import ( diff --git a/pkg/common/db/s3/s3.go b/pkg/common/db/s3/s3.go index 4f1571b1e..55adc313c 100644 --- a/pkg/common/db/s3/s3.go +++ b/pkg/common/db/s3/s3.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 s3 import ( diff --git a/pkg/common/db/table/relation/conversation.go b/pkg/common/db/table/relation/conversation.go index 6fd260583..3e095238f 100644 --- a/pkg/common/db/table/relation/conversation.go +++ b/pkg/common/db/table/relation/conversation.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 relation import ( diff --git a/pkg/common/db/table/relation/object.go b/pkg/common/db/table/relation/object.go index eb58c308d..0ed4130a6 100644 --- a/pkg/common/db/table/relation/object.go +++ b/pkg/common/db/table/relation/object.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 relation import ( diff --git a/pkg/common/log/sql_logger.go b/pkg/common/log/sql_logger.go index 9e9bb1be6..ae6cafb34 100644 --- a/pkg/common/log/sql_logger.go +++ b/pkg/common/log/sql_logger.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 log import ( diff --git a/pkg/discoveryregistry/zookeeper/discover.go b/pkg/discoveryregistry/zookeeper/discover.go index a9848ee32..089d34afe 100644 --- a/pkg/discoveryregistry/zookeeper/discover.go +++ b/pkg/discoveryregistry/zookeeper/discover.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 zookeeper import ( diff --git a/pkg/rpcclient/conversation.go b/pkg/rpcclient/conversation.go index 617446852..cc9bc5358 100644 --- a/pkg/rpcclient/conversation.go +++ b/pkg/rpcclient/conversation.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 rpcclient import ( diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index ca02ecc90..09e44884f 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 rpcclient import ( diff --git a/pkg/rpcclient/notification/group.go b/pkg/rpcclient/notification/group.go index 3efe76802..3f312c241 100644 --- a/pkg/rpcclient/notification/group.go +++ b/pkg/rpcclient/notification/group.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 notification import ( diff --git a/pkg/rpcclient/notification/msg.go b/pkg/rpcclient/notification/msg.go index 97724f727..c475291d2 100644 --- a/pkg/rpcclient/notification/msg.go +++ b/pkg/rpcclient/notification/msg.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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 notification import ( diff --git a/scripts/build_all_service.sh b/scripts/build_all_service.sh index 30c671d48..fd6ad6dcd 100755 --- a/scripts/build_all_service.sh +++ b/scripts/build_all_service.sh @@ -52,8 +52,15 @@ fi cd $OPENIM_ROOT -# Execute 'make build' -make build +# CPU core number +cpu_count=$(lscpu | grep -e '^CPU(s):' | awk '{print $2}') +echo -e "${GREEN_PREFIX}======> cpu_count=$cpu_count${COLOR_SUFFIX}" + +# Count the number of concurrent compilations (half the number of cpus) +compile_count=$((cpu_count / 2)) + +# Execute 'make build' run the make command for concurrent compilation +make -j$compile_count build if [ $? -ne 0 ]; then echo "make build Error, script exits" diff --git a/scripts/make-rules/copyright.mk b/scripts/make-rules/copyright.mk index d1c243caf..319e46945 100644 --- a/scripts/make-rules/copyright.mk +++ b/scripts/make-rules/copyright.mk @@ -23,14 +23,14 @@ LICENSE_TEMPLATE ?= $(ROOT_DIR)/scripts/LICENSE/LICENSE_TEMPLATES .PHONY: copyright.verify copyright.verify: tools.verify.addlicense @echo "===========> Validate boilerplate headers for assign files starting in the $(ROOT_DIR) directory" - @$(TOOLS_DIR)/addlicense -v -check -ignore **/test/** -f $(LICENSE_TEMPLATE) $(CODE_DIRS) + @$(TOOLS_DIR)/addlicense -v -check -ignore **/test/** -ignore **pb** -f $(LICENSE_TEMPLATE) $(CODE_DIRS) @echo "===========> End of boilerplate headers check..." ## copyright.add: Add the boilerplate headers for all files .PHONY: copyright.add copyright.add: tools.verify.addlicense @echo "===========> Adding $(LICENSE_TEMPLATE) the boilerplate headers for all files" - @$(TOOLS_DIR)/addlicense -y $(shell date +"%Y") -v -c "OpenIM." -f $(LICENSE_TEMPLATE) $(CODE_DIRS) + @$(TOOLS_DIR)/addlicense -y $(shell date +"%Y") -ignore **pb** -v -c "OpenIM." -f $(LICENSE_TEMPLATE) $(CODE_DIRS) @echo "===========> End the copyright is added..." # Addlicense Flags: diff --git a/scripts/make-rules/image.mk b/scripts/make-rules/image.mk index e70583c34..326507d83 100644 --- a/scripts/make-rules/image.mk +++ b/scripts/make-rules/image.mk @@ -20,6 +20,34 @@ # docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/: # +# # If you wish built the manager image targeting other platforms you can use the --platform flag. +# # (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it. +# # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ +# .PHONY: docker-build +# docker-build: test ## Build docker image with the manager. +# docker build -t ${IMG} . + +# .PHONY: docker-push +# docker-push: ## Push docker image with the manager. +# docker push ${IMG} + +# # PLATFORMS defines the target platforms for the manager image be build to provide support to multiple +# # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: +# # - able to use docker buildx . More info: https://docs.docker.com/build/buildx/ +# # - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/ +# # - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=> then the export will fail) +# # To properly provided solutions that supports more than one platform you should use this option. +# PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le +# .PHONY: docker-buildx +# docker-buildx: test ## Build and push docker image for the manager for cross-platform support +# # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile +# sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross +# - docker buildx create --name project-v3-builder +# docker buildx use project-v3-builder +# - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . +# - docker buildx rm project-v3-builder +# rm Dockerfile.cross + DOCKER := docker DOCKER_SUPPORTED_API_VERSION ?= 1.32|1.40|1.41 diff --git a/test/common.sh b/test/common.sh new file mode 100644 index 000000000..f1f641af1 --- /dev/null +++ b/test/common.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash From 81bcd86304a1cea9b56db4ae7566336c3dcbe378 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Thu, 13 Jul 2023 17:10:48 +0800 Subject: [PATCH 12/20] fix: minio auto make bucket --- pkg/common/db/s3/minio/minio.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/common/db/s3/minio/minio.go b/pkg/common/db/s3/minio/minio.go index 367cbe8a8..851464ce7 100644 --- a/pkg/common/db/s3/minio/minio.go +++ b/pkg/common/db/s3/minio/minio.go @@ -40,6 +40,15 @@ func NewMinio() (s3.Interface, error) { if err != nil { return nil, err } + exists, err := client.BucketExists(context.Background(), conf.Bucket) + if err != nil { + return nil, err + } + if !exists { + if err := client.MakeBucket(context.Background(), conf.Bucket, minio.MakeBucketOptions{}); err != nil { + return nil, err + } + } return &Minio{ bucket: conf.Bucket, bucketURL: conf.Endpoint + "/" + conf.Bucket + "/", From 772cb859fab14b5c9804f4c50c257e299f4932ba Mon Sep 17 00:00:00 2001 From: plutoyty <2631223275@qq.com> Date: Thu, 13 Jul 2023 17:18:14 +0800 Subject: [PATCH 13/20] url to uri --- pkg/common/db/unrelation/mongo.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/common/db/unrelation/mongo.go b/pkg/common/db/unrelation/mongo.go index b2a99891e..9ce9929c5 100644 --- a/pkg/common/db/unrelation/mongo.go +++ b/pkg/common/db/unrelation/mongo.go @@ -42,9 +42,9 @@ type Mongo struct { // NewMongo Initialize MongoDB connection func NewMongo() (*Mongo, error) { specialerror.AddReplace(mongo.ErrNoDocuments, errs.ErrRecordNotFound) - url := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" + uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" if config.Config.Mongo.Uri != "" { - url = config.Config.Mongo.Uri + uri = config.Config.Mongo.Uri } else { mongodbHosts := "" for i, v := range config.Config.Mongo.Address { @@ -55,22 +55,22 @@ func NewMongo() (*Mongo, error) { } } if config.Config.Mongo.Password != "" && config.Config.Mongo.Username != "" { - url = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", + uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin", config.Config.Mongo.Username, config.Config.Mongo.Password, mongodbHosts, config.Config.Mongo.Database, config.Config.Mongo.MaxPoolSize) } else { - url = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&authSource=admin", + uri = fmt.Sprintf("mongodb://%s/%s/?maxPoolSize=%d&authSource=admin", mongodbHosts, config.Config.Mongo.Database, config.Config.Mongo.MaxPoolSize) } } - fmt.Println("mongo:", url) + fmt.Println("mongo:", uri) var mongoClient *mongo.Client var err error = nil for i := 0; i <= maxRetry; i++ { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() - mongoClient, err = mongo.Connect(ctx, options.Client().ApplyURI(url)) + mongoClient, err = mongo.Connect(ctx, options.Client().ApplyURI(uri)) if err == nil { return &Mongo{db: mongoClient}, nil } From 99dc701ff60966a92bf2bc948b5ba6332386c240 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Thu, 13 Jul 2023 17:37:51 +0800 Subject: [PATCH 14/20] feat: script and make build Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- pkg/apistruct/auth.go | 3 +- pkg/apistruct/conversation.go | 9 +-- pkg/apistruct/friend.go | 17 ++-- pkg/apistruct/group.go | 47 ++++------- pkg/apistruct/manage.go | 7 +- pkg/apistruct/msg.go | 12 +-- pkg/apistruct/third.go | 13 ++- pkg/callbackstruct/msg_gateway.go | 2 +- pkg/common/constant/constant.go | 94 +++++++++++----------- pkg/common/constant/platform_id_to_name.go | 15 ++-- pkg/common/mcontext/ctx.go | 9 ++- pkg/errs/code.go | 56 ++++++------- pkg/errs/predefine.go | 8 +- scripts/msg_gateway_start.sh | 2 +- scripts/msg_transfer_start.sh | 4 +- scripts/start_rpc_service.sh | 4 +- 16 files changed, 142 insertions(+), 160 deletions(-) diff --git a/pkg/apistruct/auth.go b/pkg/apistruct/auth.go index 119cbac77..a1538347d 100644 --- a/pkg/apistruct/auth.go +++ b/pkg/apistruct/auth.go @@ -47,8 +47,7 @@ type ForceLogoutReq struct { OperationID string `json:"operationID" binding:"required"` } -type ForceLogoutResp struct { -} +type ForceLogoutResp struct{} type ParseTokenReq struct { OperationID string `json:"operationID" binding:"required"` diff --git a/pkg/apistruct/conversation.go b/pkg/apistruct/conversation.go index c58daa634..efac9a563 100644 --- a/pkg/apistruct/conversation.go +++ b/pkg/apistruct/conversation.go @@ -68,16 +68,14 @@ type SetConversationReq struct { OperationID string `json:"operationID" binding:"required"` } -type SetConversationResp struct { -} +type SetConversationResp struct{} type ModifyConversationFieldReq struct { Conversation FieldType int32 `json:"fieldType" binding:"required"` UserIDList []string `json:"userIDList" binding:"required"` OperationID string `json:"operationID" binding:"required"` } -type ModifyConversationFieldResp struct { -} +type ModifyConversationFieldResp struct{} type BatchSetConversationsReq struct { Conversations []Conversation `json:"conversations" binding:"required"` @@ -130,5 +128,4 @@ type SetRecvMsgOptReq struct { NotificationType int32 `json:"notificationType"` } -type SetRecvMsgOptResp struct { -} +type SetRecvMsgOptResp struct{} diff --git a/pkg/apistruct/friend.go b/pkg/apistruct/friend.go index 3b1ab919d..5aac9494e 100644 --- a/pkg/apistruct/friend.go +++ b/pkg/apistruct/friend.go @@ -185,8 +185,7 @@ type AddBlacklistReq struct { ToUserID string `json:"toUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } -type AddBlacklistResp struct { -} +type AddBlacklistResp struct{} type ImportFriendReq struct { FriendUserIDList []string `json:"friendUserIDList" binding:"required"` @@ -212,15 +211,13 @@ type AddFriendResponseReq struct { HandleResult int32 `json:"flag" binding:"required,oneof=-1 0 1"` HandleMsg string `json:"handleMsg"` } -type AddFriendResponseResp struct { -} +type AddFriendResponseResp struct{} type DeleteFriendReq struct { ToUserID string `json:"toUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } -type DeleteFriendResp struct { -} +type DeleteFriendResp struct{} type GetBlackListReq struct { FromUserID string `json:"fromUserID" binding:"required"` @@ -234,15 +231,13 @@ type SetFriendRemarkReq struct { FromUserID string `json:"fromUserID" binding:"required"` Remark string `json:"remark"` } -type SetFriendRemarkResp struct { -} +type SetFriendRemarkResp struct{} type RemoveBlacklistReq struct { ToUserID string `json:"toUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } -type RemoveBlacklistResp struct { -} +type RemoveBlacklistResp struct{} type IsFriendReq struct { ToUserID string `json:"toUserID" binding:"required"` @@ -266,7 +261,7 @@ type GetFriendListResp struct { AddSource int32 `json:"addSource"` OperatorUserID string `json:"operatorUserID"` Ex string `json:"ex"` - //FriendUser *UserInfo // TODO + // FriendUser *UserInfo // TODO } type GetFriendApplyListReq struct { diff --git a/pkg/apistruct/group.go b/pkg/apistruct/group.go index 45be76cf9..a3a379164 100644 --- a/pkg/apistruct/group.go +++ b/pkg/apistruct/group.go @@ -25,8 +25,7 @@ type KickGroupMemberReq struct { OperationID string `json:"operationID" binding:"required"` } type KickGroupMemberResp struct { - - //UserIDResultList []*UserIDResult `json:"data"` + // UserIDResultList []*UserIDResult `json:"data"` } type GetGroupMembersInfoReq struct { @@ -46,8 +45,7 @@ type InviteUserToGroupReq struct { OperationID string `json:"operationID" binding:"required"` } type InviteUserToGroupResp struct { - - //UserIDResultList []*UserIDResult `json:"data"` + // UserIDResultList []*UserIDResult `json:"data"` } type GetJoinedGroupListReq struct { @@ -114,8 +112,9 @@ type CreateGroupResp struct { type GetGroupApplicationListReq struct { OperationID string `json:"operationID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请 + FromUserID string `json:"fromUserID" binding:"required"` // 作为管理员或群主收到的 进群申请 } + type GetGroupApplicationListResp struct { GroupRequestList []*sdkws.GroupRequest `json:"-"` Data []map[string]interface{} `json:"data" swaggerignore:"true"` @@ -163,12 +162,11 @@ type GetGroupInfoResp struct { type ApplicationGroupResponseReq struct { OperationID string `json:"operationID" binding:"required"` GroupID string `json:"groupID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` //application from FromUserID + FromUserID string `json:"fromUserID" binding:"required"` // application from FromUserID HandledMsg string `json:"handledMsg"` HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` } -type ApplicationGroupResponseResp struct { -} +type ApplicationGroupResponseResp struct{} type JoinGroupReq struct { GroupID string `json:"groupID" binding:"required"` @@ -178,15 +176,13 @@ type JoinGroupReq struct { InviterUserID string `json:"inviterUserID"` } -type JoinGroupResp struct { -} +type JoinGroupResp struct{} type QuitGroupReq struct { GroupID string `json:"groupID" binding:"required"` OperationID string `json:"operationID" binding:"required"` } -type QuitGroupResp struct { -} +type QuitGroupResp struct{} type SetGroupInfoReq struct { GroupID string `json:"groupID" binding:"required"` @@ -201,8 +197,7 @@ type SetGroupInfoReq struct { ApplyMemberFriend *int32 `json:"applyMemberFriend"` } -type SetGroupInfoResp struct { -} +type SetGroupInfoResp struct{} type TransferGroupOwnerReq struct { GroupID string `json:"groupID" binding:"required"` @@ -210,15 +205,13 @@ type TransferGroupOwnerReq struct { NewOwnerUserID string `json:"newOwnerUserID" binding:"required"` OperationID string `json:"operationID" binding:"required"` } -type TransferGroupOwnerResp struct { -} +type TransferGroupOwnerResp struct{} type DismissGroupReq struct { GroupID string `json:"groupID" binding:"required"` OperationID string `json:"operationID" binding:"required"` } -type DismissGroupResp struct { -} +type DismissGroupResp struct{} type MuteGroupMemberReq struct { OperationID string `json:"operationID" binding:"required"` @@ -226,30 +219,26 @@ type MuteGroupMemberReq struct { UserID string `json:"userID" binding:"required"` MutedSeconds uint32 `json:"mutedSeconds" binding:"required"` } -type MuteGroupMemberResp struct { -} +type MuteGroupMemberResp struct{} type CancelMuteGroupMemberReq struct { OperationID string `json:"operationID" binding:"required"` GroupID string `json:"groupID" binding:"required"` UserID string `json:"userID" binding:"required"` } -type CancelMuteGroupMemberResp struct { -} +type CancelMuteGroupMemberResp struct{} type MuteGroupReq struct { OperationID string `json:"operationID" binding:"required"` GroupID string `json:"groupID" binding:"required"` } -type MuteGroupResp struct { -} +type MuteGroupResp struct{} type CancelMuteGroupReq struct { OperationID string `json:"operationID" binding:"required"` GroupID string `json:"groupID" binding:"required"` } -type CancelMuteGroupResp struct { -} +type CancelMuteGroupResp struct{} type SetGroupMemberNicknameReq struct { OperationID string `json:"operationID" binding:"required"` @@ -258,8 +247,7 @@ type SetGroupMemberNicknameReq struct { Nickname string `json:"nickname"` } -type SetGroupMemberNicknameResp struct { -} +type SetGroupMemberNicknameResp struct{} type SetGroupMemberInfoReq struct { OperationID string `json:"operationID" binding:"required"` @@ -271,8 +259,7 @@ type SetGroupMemberInfoReq struct { Ex *string `json:"ex"` } -type SetGroupMemberInfoResp struct { -} +type SetGroupMemberInfoResp struct{} type GetGroupAbstractInfoReq struct { OperationID string `json:"operationID"` diff --git a/pkg/apistruct/manage.go b/pkg/apistruct/manage.go index 455b2fe4c..042f61aa0 100644 --- a/pkg/apistruct/manage.go +++ b/pkg/apistruct/manage.go @@ -36,15 +36,14 @@ type GetUsersOnlineStatusReq struct { UserIDList []string `json:"userIDList" binding:"required,lte=200"` } type GetUsersOnlineStatusResp struct { - - //SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"` + // SuccessResult []*msggateway.GetUsersOnlineStatusResp_SuccessResult `json:"data"` } + type AccountCheckReq struct { OperationID string `json:"operationID" binding:"required"` CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` } -type AccountCheckResp struct { -} +type AccountCheckResp struct{} type ManagementSendMsg struct { SendID string `json:"sendID" binding:"required"` diff --git a/pkg/apistruct/msg.go b/pkg/apistruct/msg.go index ebbdc9650..35351315a 100644 --- a/pkg/apistruct/msg.go +++ b/pkg/apistruct/msg.go @@ -20,16 +20,14 @@ type DelMsgReq struct { OperationID string `json:"operationID,omitempty" binding:"required"` } -type DelMsgResp struct { -} +type DelMsgResp struct{} type CleanUpMsgReq struct { UserID string `json:"userID" binding:"required"` OperationID string `json:"operationID" binding:"required"` } -type CleanUpMsgResp struct { -} +type CleanUpMsgResp struct{} type DelSuperGroupMsgReq struct { UserID string `json:"userID" binding:"required"` @@ -39,8 +37,7 @@ type DelSuperGroupMsgReq struct { OperationID string `json:"operationID" binding:"required"` } -type DelSuperGroupMsgResp struct { -} +type DelSuperGroupMsgResp struct{} type MsgDeleteNotificationElem struct { GroupID string `json:"groupID"` @@ -55,8 +52,7 @@ type SetMsgMinSeqReq struct { OperationID string `json:"operationID" binding:"required"` } -type SetMsgMinSeqResp struct { -} +type SetMsgMinSeqResp struct{} type PictureBaseInfo struct { UUID string `mapstructure:"uuid"` diff --git a/pkg/apistruct/third.go b/pkg/apistruct/third.go index 76ff89f62..ce4719e1f 100644 --- a/pkg/apistruct/third.go +++ b/pkg/apistruct/third.go @@ -58,8 +58,7 @@ type UploadUpdateAppReq struct { UpdateLog string `form:"updateLog" binding:"required"` } -type UploadUpdateAppResp struct { -} +type UploadUpdateAppResp struct{} type GetDownloadURLReq struct { OperationID string `json:"operationID" binding:"required"` @@ -111,21 +110,19 @@ type GetRTCInvitationInfoStartAppResp struct { } /** - * FCM第三方上报Token + * FCM第三方上报Token. */ type FcmUpdateTokenReq struct { OperationID string `json:"operationID" binding:"required"` - Platform int `json:"platform" binding:"required,min=1,max=2"` //only for ios + android + Platform int `json:"platform" binding:"required,min=1,max=2"` // only for ios + android FcmToken string `json:"fcmToken" binding:"required"` } -type FcmUpdateTokenResp struct { -} +type FcmUpdateTokenResp struct{} type SetAppBadgeReq struct { OperationID string `json:"operationID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` AppUnreadCount int32 `json:"appUnreadCount"` } -type SetAppBadgeResp struct { -} +type SetAppBadgeResp struct{} diff --git a/pkg/callbackstruct/msg_gateway.go b/pkg/callbackstruct/msg_gateway.go index a70f724ce..ef98c4058 100644 --- a/pkg/callbackstruct/msg_gateway.go +++ b/pkg/callbackstruct/msg_gateway.go @@ -16,7 +16,7 @@ package callbackstruct type CallbackUserOnlineReq struct { UserStatusCallbackReq - //Token string `json:"token"` + // Token string `json:"token"` Seq int64 `json:"seq"` IsAppBackground bool `json:"isAppBackground"` ConnID string `json:"connID"` diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index 2e5432b48..c9652984f 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -17,7 +17,7 @@ package constant const ( ///ContentType - //UserRelated + //UserRelated. ContentTypeBegin = 100 Text = 101 Picture = 102 @@ -45,23 +45,23 @@ const ( SignalMsg = 202 CustomNotification = 203 - //SysRelated + //SysRelated. NotificationBegin = 1000 - FriendApplicationApprovedNotification = 1201 //add_friend_response - FriendApplicationRejectedNotification = 1202 //add_friend_response - FriendApplicationNotification = 1203 //add_friend + FriendApplicationApprovedNotification = 1201 // add_friend_response + FriendApplicationRejectedNotification = 1202 // add_friend_response + FriendApplicationNotification = 1203 // add_friend FriendAddedNotification = 1204 - FriendDeletedNotification = 1205 //delete_friend - FriendRemarkSetNotification = 1206 //set_friend_remark? - BlackAddedNotification = 1207 //add_black - BlackDeletedNotification = 1208 //remove_black + FriendDeletedNotification = 1205 // delete_friend + FriendRemarkSetNotification = 1206 // set_friend_remark? + BlackAddedNotification = 1207 // add_black + BlackDeletedNotification = 1208 // remove_black FriendInfoUpdatedNotification = 1209 ConversationChangeNotification = 1300 // change conversation opt UserNotificationBegin = 1301 - UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204 + UserInfoUpdatedNotification = 1303 // SetSelfInfoTip = 204 UserNotificationEnd = 1399 OANotification = 1400 @@ -113,37 +113,37 @@ const ( NotificationEnd = 5000 - //status + //status. MsgNormal = 1 MsgDeleted = 4 - //MsgFrom + //MsgFrom. UserMsgType = 100 SysMsgType = 200 - //SessionType + //SessionType. SingleChatType = 1 GroupChatType = 2 SuperGroupChatType = 3 NotificationChatType = 4 - //token + //token. NormalToken = 0 InValidToken = 1 KickedToken = 2 ExpiredToken = 3 - //MultiTerminalLogin + //MultiTerminalLogin. DefalutNotKick = 0 - //Full-end login, but the same end is mutually exclusive + //Full-end login, but the same end is mutually exclusive. AllLoginButSameTermKick = 1 - //Only one of the endpoints can log in + //Only one of the endpoints can log in. SingleTerminalLogin = 2 - //The web side can be online at the same time, and the other side can only log in at one end + //The web side can be online at the same time, and the other side can only log in at one end. WebAndOther = 3 // The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at - // the same time + // the same time. PcMobileAndWeb = 4 - //The PC terminal can be online at the same time,but other terminal only one of the endpoints can login + //The PC terminal can be online at the same time,but other terminal only one of the endpoints can login. PCAndOther = 5 OnlineStatus = "online" @@ -151,12 +151,12 @@ const ( Registered = "registered" UnRegistered = "unregistered" - //MsgReceiveOpt + //MsgReceiveOpt. ReceiveMessage = 0 NotReceiveMessage = 1 ReceiveNotNotifyMessage = 2 - //OptionsKey + //OptionsKey. IsHistory = "history" IsPersistent = "persistent" IsOfflinePush = "offlinePush" @@ -170,13 +170,13 @@ const ( IsNotNotification = "isNotNotification" IsSendMsg = "isSendMsg" - //GroupStatus + //GroupStatus. GroupOk = 0 GroupBanChat = 1 GroupStatusDismissed = 2 GroupStatusMuted = 3 - //GroupType + //GroupType. NormalGroup = 0 SuperGroup = 1 WorkingGroup = 2 @@ -184,19 +184,19 @@ const ( GroupBaned = 3 GroupBanPrivateChat = 4 - //UserJoinGroupSource + //UserJoinGroupSource. JoinByAdmin = 1 JoinByInvitation = 2 JoinBySearch = 3 JoinByQRCode = 4 - //Minio + //Minio. MinioDurationTimes = 3600 - //Aws + //Aws. AwsDurationTimes = 3600 - //callbackCommand + //callbackCommand. CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand" CallbackAfterSendSingleMsgCommand = "callbackAfterSendSingleMsgCommand" CallbackBeforeSendGroupMsgCommand = "callbackBeforeSendGroupMsgCommand" @@ -217,19 +217,19 @@ const ( CallbackGetMessageListReactionExtensionsCommand = "callbackGetMessageListReactionExtensionsCommand" CallbackAddMessageListReactionExtensionsCommand = "callbackAddMessageListReactionExtensionsCommand" - //callback actionCode + //callback actionCode. ActionAllow = 0 ActionForbidden = 1 - //callback callbackHandleCode + //callback callbackHandleCode. CallbackHandleSuccess = 0 CallbackHandleFailed = 1 - // minioUpload + // minioUpload. OtherType = 1 VideoType = 2 ImageType = 3 - // sendMsgStaus + // sendMsgStaus. MsgStatusNotExist = 0 MsgIsSending = 1 MsgSendSuccessed = 2 @@ -299,25 +299,27 @@ const ( Female = 2 ) -const OperationID = "operationID" -const OpUserID = "opUserID" -const ConnID = "connID" -const OpUserPlatform = "platform" -const Token = "token" -const RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数 -const CheckKey = "CheckKey" -const TriggerID = "triggerID" -const RemoteAddr = "remoteAddr" +const ( + OperationID = "operationID" + OpUserID = "opUserID" + ConnID = "connID" + OpUserPlatform = "platform" + Token = "token" + RpcCustomHeader = "customHeader" // rpc中间件自定义ctx参数 + CheckKey = "CheckKey" + TriggerID = "triggerID" + RemoteAddr = "remoteAddr" +) const ( - BecomeFriendByImport = 1 //管理员导入 - BecomeFriendByApply = 2 //申请添加 + BecomeFriendByImport = 1 // 管理员导入 + BecomeFriendByApply = 2 // 申请添加 ) const ( ApplyNeedVerificationInviteDirectly = 0 // 申请需要同意 邀请直接进 - AllNeedVerification = 1 //所有人进群需要验证,除了群主管理员邀请进群 - Directly = 2 //直接进群 + AllNeedVerification = 1 // 所有人进群需要验证,除了群主管理员邀请进群 + Directly = 2 // 直接进群 ) const ( @@ -345,7 +347,7 @@ const LogFileName = "OpenIM.log" const LocalHost = "0.0.0.0" -// flag parse +// flag parse. const ( FlagPort = "port" FlagWsPort = "ws_port" diff --git a/pkg/common/constant/platform_id_to_name.go b/pkg/common/constant/platform_id_to_name.go index 31b1fcdd9..169e1e758 100644 --- a/pkg/common/constant/platform_id_to_name.go +++ b/pkg/common/constant/platform_id_to_name.go @@ -15,10 +15,9 @@ package constant // fixme 1<--->IOS 2<--->Android 3<--->Windows -//fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux - +// fixme 4<--->OSX 5<--->Web 6<--->MiniWeb 7<--->Linux const ( - //Platform ID + //Platform ID. IOSPlatformID = 1 AndroidPlatformID = 2 WindowsPlatformID = 3 @@ -30,7 +29,7 @@ const ( IPadPlatformID = 9 AdminPlatformID = 10 - //Platform string match to Platform ID + //Platform string match to Platform ID. IOSPlatformStr = "IOS" AndroidPlatformStr = "Android" WindowsPlatformStr = "Windows" @@ -42,7 +41,7 @@ const ( IPadPlatformStr = "IPad" AdminPlatformStr = "Admin" - //terminal types + //terminal types. TerminalPC = "PC" TerminalMobile = "Mobile" ) @@ -59,6 +58,7 @@ var PlatformID2Name = map[int]string{ IPadPlatformID: IPadPlatformStr, AdminPlatformID: AdminPlatformStr, } + var PlatformName2ID = map[string]int{ IOSPlatformStr: IOSPlatformID, AndroidPlatformStr: AndroidPlatformID, @@ -71,6 +71,7 @@ var PlatformName2ID = map[string]int{ IPadPlatformStr: IPadPlatformID, AdminPlatformStr: AdminPlatformID, } + var PlatformName2class = map[string]string{ IOSPlatformStr: TerminalMobile, AndroidPlatformStr: TerminalMobile, @@ -80,6 +81,7 @@ var PlatformName2class = map[string]string{ OSXPlatformStr: TerminalPC, LinuxPlatformStr: TerminalPC, } + var PlatformID2class = map[int]string{ IOSPlatformID: TerminalMobile, AndroidPlatformID: TerminalMobile, @@ -93,12 +95,15 @@ var PlatformID2class = map[int]string{ func PlatformIDToName(num int) string { return PlatformID2Name[num] } + func PlatformNameToID(name string) int { return PlatformName2ID[name] } + func PlatformNameToClass(name string) string { return PlatformName2class[name] } + func PlatformIDToClass(num int) string { return PlatformID2class[num] } diff --git a/pkg/common/mcontext/ctx.go b/pkg/common/mcontext/ctx.go index bbca660b9..79234e2e0 100644 --- a/pkg/common/mcontext/ctx.go +++ b/pkg/common/mcontext/ctx.go @@ -26,12 +26,15 @@ var mapper = []string{constant.OperationID, constant.OpUserID, constant.OpUserPl func WithOpUserIDContext(ctx context.Context, opUserID string) context.Context { return context.WithValue(ctx, constant.OpUserID, opUserID) } + func WithOpUserPlatformContext(ctx context.Context, platform string) context.Context { return context.WithValue(ctx, constant.OpUserPlatform, platform) } + func WithTriggerIDContext(ctx context.Context, triggerID string) context.Context { return context.WithValue(ctx, constant.TriggerID, triggerID) } + func NewCtx(operationID string) context.Context { c := context.Background() ctx := context.WithValue(c, constant.OperationID, operationID) @@ -59,6 +62,7 @@ func GetOperationID(ctx context.Context) string { } return "" } + func GetOpUserID(ctx context.Context) string { if ctx.Value(constant.OpUserID) != "" { s, ok := ctx.Value(constant.OpUserID).(string) @@ -68,6 +72,7 @@ func GetOpUserID(ctx context.Context) string { } return "" } + func GetConnID(ctx context.Context) string { if ctx.Value(constant.ConnID) != "" { s, ok := ctx.Value(constant.ConnID).(string) @@ -87,6 +92,7 @@ func GetTriggerID(ctx context.Context) string { } return "" } + func GetOpUserPlatform(ctx context.Context) string { if ctx.Value(constant.OpUserPlatform) != "" { s, ok := ctx.Value(constant.OpUserPlatform).(string) @@ -96,6 +102,7 @@ func GetOpUserPlatform(ctx context.Context) string { } return "" } + func GetRemoteAddr(ctx context.Context) string { if ctx.Value(constant.RemoteAddr) != "" { s, ok := ctx.Value(constant.RemoteAddr).(string) @@ -142,8 +149,6 @@ func WithMustInfoCtx(values []string) context.Context { ctx := context.Background() for i, v := range values { ctx = context.WithValue(ctx, mapper[i], v) - } return ctx - } diff --git a/pkg/errs/code.go b/pkg/errs/code.go index 3cd66611d..4b7193824 100644 --- a/pkg/errs/code.go +++ b/pkg/errs/code.go @@ -14,7 +14,7 @@ package errs -// UnknownCode 没有解析到code或解析的code=0 +// UnknownCode 没有解析到code或解析的code=0. const UnknownCode = 1000 const ( @@ -34,47 +34,47 @@ const ( InvitationError = 10014 ) -// 通用错误码 +// 通用错误码. const ( - NoError = 0 //无错误 - DatabaseError = 90002 //redis/mysql等db错误 - NetworkError = 90004 //网络错误 - DataError = 90007 //数据错误 + NoError = 0 // 无错误 + DatabaseError = 90002 // redis/mysql等db错误 + NetworkError = 90004 // 网络错误 + DataError = 90007 // 数据错误 CallbackError = 80000 - //通用错误码 + //通用错误码. ServerInternalError = 500 //服务器内部错误 ArgsError = 1001 //输入参数错误 NoPermissionError = 1002 //权限不足 DuplicateKeyError = 1003 - RecordNotFoundError = 1004 //记录不存在 + RecordNotFoundError = 1004 // 记录不存在 - // 账号错误码 - UserIDNotFoundError = 1101 //UserID不存在 或未注册 - RegisteredAlreadyError = 1102 //用户已经注册过了 + // 账号错误码. + UserIDNotFoundError = 1101 // UserID不存在 或未注册 + RegisteredAlreadyError = 1102 // 用户已经注册过了 - // 群组错误码 - GroupIDNotFoundError = 1201 //GroupID不存在 - GroupIDExisted = 1202 //GroupID已存在 - NotInGroupYetError = 1203 //不在群组中 - DismissedAlreadyError = 1204 //群组已经解散 + // 群组错误码. + GroupIDNotFoundError = 1201 // GroupID不存在 + GroupIDExisted = 1202 // GroupID已存在 + NotInGroupYetError = 1203 // 不在群组中 + DismissedAlreadyError = 1204 // 群组已经解散 GroupTypeNotSupport = 1205 GroupRequestHandled = 1206 - // 关系链错误码 - CanNotAddYourselfError = 1301 //不能添加自己为好友 - BlockedByPeer = 1302 //被对方拉黑 - NotPeersFriend = 1303 //不是对方的好友 - RelationshipAlreadyError = 1304 //已经是好友关系 + // 关系链错误码. + CanNotAddYourselfError = 1301 // 不能添加自己为好友 + BlockedByPeer = 1302 // 被对方拉黑 + NotPeersFriend = 1303 // 不是对方的好友 + RelationshipAlreadyError = 1304 // 已经是好友关系 - // 消息错误码 + // 消息错误码. MessageHasReadDisable = 1401 - MutedInGroup = 1402 //群成员被禁言 - MutedGroup = 1403 //群被禁言 - MsgAlreadyRevoke = 1404 //消息已撤回 + MutedInGroup = 1402 // 群成员被禁言 + MutedGroup = 1403 // 群被禁言 + MsgAlreadyRevoke = 1404 // 消息已撤回 - // token错误码 + // token错误码. TokenExpiredError = 1501 TokenInvalidError = 1502 TokenMalformedError = 1503 @@ -83,10 +83,10 @@ const ( TokenKickedError = 1506 TokenNotExistError = 1507 - // 长连接网关错误码 + // 长连接网关错误码. ConnOverMaxNumLimit = 1601 ConnArgsErr = 1602 - // S3错误码 + // S3错误码. FileUploadedExpiredError = 1701 // 上传过期 ) diff --git a/pkg/errs/predefine.go b/pkg/errs/predefine.go index 16525420c..f11349891 100644 --- a/pkg/errs/predefine.go +++ b/pkg/errs/predefine.go @@ -38,11 +38,11 @@ var ( ErrData = NewCodeError(DataError, "DataError") ErrTokenExpired = NewCodeError(TokenExpiredError, "TokenExpiredError") ErrTokenInvalid = NewCodeError(TokenInvalidError, "TokenInvalidError") // - ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") //格式错误 - ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") //还未生效 - ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") //未知错误 + ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") // 格式错误 + ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") // 还未生效 + ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") // 未知错误 ErrTokenKicked = NewCodeError(TokenKickedError, "TokenKickedError") - ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") //在redis中不存在 + ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") // 在redis中不存在 ErrDuplicateKey = NewCodeError(DuplicateKeyError, "DuplicateKeyError") ErrMessageHasReadDisable = NewCodeError(MessageHasReadDisable, "MessageHasReadDisable") diff --git a/scripts/msg_gateway_start.sh b/scripts/msg_gateway_start.sh index 70267c85b..cc6f0b5dd 100755 --- a/scripts/msg_gateway_start.sh +++ b/scripts/msg_gateway_start.sh @@ -61,7 +61,7 @@ sleep 1 cd ${msg_gateway_binary_root} for ((i = 0; i < ${#ws_ports[@]}; i++)); do echo "==========================start msg_gateway server===========================">>$OPENIM_ROOT/logs/openIM.log - nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} --configFolderPath ${log_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 & + nohup ./${openim_msggateway} --port ${rpc_ports[$i]} --ws_port ${ws_ports[$i]} --prometheus_port ${prome_ports[$i]} --config_folder_path ${configfile_path} >>$OPENIM_ROOT/logs/openIM.log 2>&1 & done #Check launched service process diff --git a/scripts/msg_transfer_start.sh b/scripts/msg_transfer_start.sh index cfc0efd30..2e03b4b1a 100755 --- a/scripts/msg_transfer_start.sh +++ b/scripts/msg_transfer_start.sh @@ -55,9 +55,9 @@ sleep 1 cd ${msg_transfer_binary_root} for ((i = 0; i < ${msg_transfer_service_num}; i++)); do prome_port=${prome_ports[$i]} - cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} --configFolderPath ${log_path}" + cmd="nohup ./${openim_msgtransfer} --config_folder_path ${configfile_path} " if [ $prome_port != "" ]; then - cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} --configFolderPath ${log_path}" + cmd="$cmd --prometheus_port $prome_port --config_folder_path ${configfile_path} " fi echo "==========================start msg_transfer server===========================">>$OPENIM_ROOT/logs/openIM.log $cmd >>$OPENIM_ROOT/logs/openIM.log 2>&1 & diff --git a/scripts/start_rpc_service.sh b/scripts/start_rpc_service.sh index 09b7f69c5..f1624c34e 100755 --- a/scripts/start_rpc_service.sh +++ b/scripts/start_rpc_service.sh @@ -100,9 +100,9 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do for ((j = 0; j < ${#service_ports[*]}; j++)); do #Start the service in the background if [ -z "${prome_ports[$j]}" ]; then - cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}" + cmd="./${service_filename[$i]} --port ${service_ports[$j]} --config_folder_path ${configfile_path} " else - cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} --configFolderPath ${log_path}" + cmd="./${service_filename[$i]} --port ${service_ports[$j]} --prometheus_port ${prome_ports[$j]} --config_folder_path ${configfile_path} " fi if [ $i -eq 0 -o $i -eq 1 ]; then cmd="./${service_filename[$i]} --port ${service_ports[$j]}" From be7d785f1d84e15cddba25afe5408bdf0bbec37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98hanzhixiao=E2=80=99?= <‘709674996@qq.com’> Date: Thu, 13 Jul 2023 18:17:27 +0800 Subject: [PATCH 15/20] fix conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ‘hanzhixiao’ <‘709674996@qq.com’> --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6edf18a05..e870d0a42 100644 --- a/.gitignore +++ b/.gitignore @@ -163,7 +163,6 @@ go.work # User-specific stuff .idea/ -.idea .idea/**/workspace.xml .idea/**/tasks.xml .idea/**/usage.statistics.xml From 02e6b7ec18c3b1056dae6ee9ca1426616baba1ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98hanzhixiao=E2=80=99?= <‘709674996@qq.com’> Date: Thu, 13 Jul 2023 18:20:03 +0800 Subject: [PATCH 16/20] fix conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ‘hanzhixiao’ <‘709674996@qq.com’> --- internal/msgtransfer/init.go | 5 +- internal/tools/msg.go | 8 +- pkg/common/db/controller/msg.go | 25 +- pkg/common/db/relation/group_model.go | 12 +- pkg/proto/auth/auth.pb.go | 19 +- pkg/proto/conversation/conversation.pb.go | 22 +- pkg/proto/errinfo/errinfo.pb.go | 19 +- pkg/proto/friend/friend.pb.go | 22 +- pkg/proto/group/group.pb.go | 24 +- pkg/proto/msg/msg.pb.go | 1084 +++++++++++++++++---- pkg/proto/msggateway/msggateway.pb.go | 22 +- pkg/proto/push/push.pb.go | 22 +- pkg/proto/sdkws/sdkws.pb.go | 22 +- pkg/proto/statistics/statistics.pb.go | 17 +- pkg/proto/third/third.pb.go | 19 +- pkg/proto/user/user.pb.go | 24 +- pkg/proto/wrapperspb/wrapperspb.pb.go | 19 +- pkg/rpcclient/msg.go | 14 + pkg/rpcclient/third.go | 37 +- 19 files changed, 1191 insertions(+), 245 deletions(-) diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index 17b350247..0a52dea96 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -72,8 +72,9 @@ func StartTransfer(prometheusPort int) error { client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) msgModel := cache.NewMsgCacheModel(rdb) msgDocModel := unrelation.NewMsgMongoDriver(mongo.GetDatabase()) - chatLogDatabase := controller.NewChatLogDatabase(relation.NewChatLogGorm(db)) - msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, msgModel) + msgMysModel := relation.NewChatLogGorm(db) + chatLogDatabase := controller.NewChatLogDatabase(msgMysModel) + msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, msgModel, msgMysModel) conversationRpcClient := rpcclient.NewConversationRpcClient(client) groupRpcClient := rpcclient.NewGroupRpcClient(client) msgTransfer := NewMsgTransfer(chatLogDatabase, msgDatabase, &conversationRpcClient, &groupRpcClient) diff --git a/internal/tools/msg.go b/internal/tools/msg.go index 18e7fb584..40539c757 100644 --- a/internal/tools/msg.go +++ b/internal/tools/msg.go @@ -79,8 +79,12 @@ func InitMsgTool() (*MsgTool, error) { } discov.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) userDB := relation.NewUserGorm(db) - msgDatabase := controller.InitCommonMsgDatabase(rdb, mongo.GetDatabase()) - userDatabase := controller.NewUserDatabase(userDB, cache.NewUserCacheRedis(rdb, relation.NewUserGorm(db), cache.GetDefaultOpt()), tx.NewGorm(db)) + msgDatabase := controller.InitCommonMsgDatabase(rdb, mongo.GetDatabase(), db) + userDatabase := controller.NewUserDatabase( + userDB, + cache.NewUserCacheRedis(rdb, relation.NewUserGorm(db), cache.GetDefaultOpt()), + tx.NewGorm(db), + ) groupDatabase := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase()) conversationDatabase := controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(rdb, cache.GetDefaultOpt(), relation.NewConversationGorm(db)), tx.NewGorm(db)) msgRpcClient := rpcclient.NewMessageRpcClient(discov) diff --git a/pkg/common/db/controller/msg.go b/pkg/common/db/controller/msg.go index 30a8fc265..2e5699db3 100644 --- a/pkg/common/db/controller/msg.go +++ b/pkg/common/db/controller/msg.go @@ -15,6 +15,9 @@ package controller import ( + relation2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/relation" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" + "gorm.io/gorm" "time" "github.com/redis/go-redis/v9" @@ -92,6 +95,7 @@ type CommonMsgDatabase interface { GetConversationMinMaxSeqInMongoAndCache(ctx context.Context, conversationID string) (minSeqMongo, maxSeqMongo, minSeqCache, maxSeqCache int64, err error) SetSendMsgStatus(ctx context.Context, id string, status int32) error GetSendMsgStatus(ctx context.Context, id string) (int32, error) + SearchMessage(ctx context.Context, req *pbMsg.SearchMessageReq) (msgData []*sdkws.MsgData, err error) // to mq MsgToMQ(ctx context.Context, key string, msg2mq *sdkws.MsgData) error @@ -103,8 +107,9 @@ type CommonMsgDatabase interface { RangeGroupSendCount(ctx context.Context, start time.Time, end time.Time, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, groups []*unRelationTb.GroupCount, dateCount map[string]int64, err error) } -func NewCommonMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheModel cache.MsgModel) CommonMsgDatabase { +func NewCommonMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheModel cache.MsgModel, msgMyqModel relation.ChatLogModelInterface) CommonMsgDatabase { return &commonMsgDatabase{ + msgMyq: msgMyqModel, msgDocDatabase: msgDocModel, cache: cacheModel, producer: kafka.NewKafkaProducer(config.Config.Kafka.Addr, config.Config.Kafka.LatestMsgToRedis.Topic), @@ -113,16 +118,18 @@ func NewCommonMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheMo } } -func InitCommonMsgDatabase(rdb redis.UniversalClient, database *mongo.Database) CommonMsgDatabase { +func InitCommonMsgDatabase(rdb redis.UniversalClient, database *mongo.Database, dbGrom *gorm.DB) CommonMsgDatabase { cacheModel := cache.NewMsgCacheModel(rdb) msgDocModel := unrelation.NewMsgMongoDriver(database) - CommonMsgDatabase := NewCommonMsgDatabase(msgDocModel, cacheModel) + msgMyqModel := relation2.NewChatLogGorm(dbGrom) + CommonMsgDatabase := NewCommonMsgDatabase(msgDocModel, cacheModel, msgMyqModel) return CommonMsgDatabase } type commonMsgDatabase struct { msgDocDatabase unRelationTb.MsgDocModelInterface msg unRelationTb.MsgDocModel + msgMyq relation.ChatLogModelInterface cache cache.MsgModel producer *kafka.Producer producerToMongo *kafka.Producer @@ -884,3 +891,15 @@ func (db *commonMsgDatabase) RangeUserSendCount(ctx context.Context, start time. func (db *commonMsgDatabase) RangeGroupSendCount(ctx context.Context, start time.Time, end time.Time, ase bool, pageNumber int32, showNumber int32) (msgCount int64, userCount int64, groups []*unRelationTb.GroupCount, dateCount map[string]int64, err error) { return db.msgDocDatabase.RangeGroupSendCount(ctx, start, end, ase, pageNumber, showNumber) } + +func (db *commonMsgDatabase) SearchMessage(ctx context.Context, req *pbMsg.SearchMessageReq) (msgData []*sdkws.MsgData, err error) { + var totalMsgs []*sdkws.MsgData + msgs, err := db.msgDocDatabase.SearchMessage(ctx, req) + if err != nil { + return nil, err + } + for _, msg := range msgs { + totalMsgs = append(totalMsgs, convert.MsgDB2Pb(msg.Msg)) + } + return totalMsgs, nil +} diff --git a/pkg/common/db/relation/group_model.go b/pkg/common/db/relation/group_model.go index 8afc97bef..767f7db84 100644 --- a/pkg/common/db/relation/group_model.go +++ b/pkg/common/db/relation/group_model.go @@ -16,12 +16,15 @@ package relation import ( "context" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" + "time" + + "gorm.io/gorm" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/ormutil" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/errs" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils" - "gorm.io/gorm" - "time" ) var _ relation.GroupModelInterface = (*GroupGorm)(nil) @@ -60,9 +63,10 @@ func (g *GroupGorm) Take(ctx context.Context, groupID string) (group *relation.G } func (g *GroupGorm) Search(ctx context.Context, keyword string, pageNumber, showNumber int32) (total uint32, groups []*relation.GroupModel, err error) { - return ormutil.GormSearch[relation.GroupModel](g.DB, []string{"name"}, keyword, pageNumber, showNumber) + db := g.DB + db = db.WithContext(ctx).Where("status!=?", constant.GroupStatusDismissed) + return ormutil.GormSearch[relation.GroupModel](db, []string{"name"}, keyword, pageNumber, showNumber) } - func (g *GroupGorm) GetGroupIDsByGroupType(ctx context.Context, groupType int) (groupIDs []string, err error) { return groupIDs, utils.Wrap(g.DB.Model(&relation.GroupModel{}).Where("group_type = ? ", groupType).Pluck("group_id", &groupIDs).Error, "") } diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index 095998cc6..2d1e0493c 100644 --- a/pkg/proto/auth/auth.pb.go +++ b/pkg/proto/auth/auth.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,14 +22,13 @@ package auth import ( context "context" - reflect "reflect" - sync "sync" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/conversation/conversation.pb.go b/pkg/proto/conversation/conversation.pb.go index 7ec352420..cf5de48a7 100644 --- a/pkg/proto/conversation/conversation.pb.go +++ b/pkg/proto/conversation/conversation.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,16 +22,14 @@ package conversation import ( context "context" - reflect "reflect" - sync "sync" - + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/errinfo/errinfo.pb.go b/pkg/proto/errinfo/errinfo.pb.go index ae10fe976..44f906d86 100644 --- a/pkg/proto/errinfo/errinfo.pb.go +++ b/pkg/proto/errinfo/errinfo.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -7,11 +21,10 @@ package errinfo import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index c49a13999..5745fcd3c 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,16 +22,14 @@ package friend import ( context "context" - reflect "reflect" - sync "sync" - + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index 9541496e2..f4230c794 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,17 +22,15 @@ package group import ( context "context" - reflect "reflect" - sync "sync" - + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/msg/msg.pb.go b/pkg/proto/msg/msg.pb.go index 2686704cc..d11d46de3 100644 --- a/pkg/proto/msg/msg.pb.go +++ b/pkg/proto/msg/msg.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -2359,6 +2373,488 @@ func (x *GetActiveGroupResp) GetGroups() []*ActiveGroup { return nil } +type SearchMessageReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SendID string `protobuf:"bytes,1,opt,name=sendID,proto3" json:"sendID"` //发送者ID + RecvID string `protobuf:"bytes,2,opt,name=recvID,proto3" json:"recvID"` //接收者ID + MsgType int32 `protobuf:"varint,3,opt,name=msgType,proto3" json:"msgType"` + SendTime string `protobuf:"bytes,4,opt,name=sendTime,proto3" json:"sendTime"` + SessionType int32 `protobuf:"varint,5,opt,name=sessionType,proto3" json:"sessionType"` + Pagination *sdkws.RequestPagination `protobuf:"bytes,6,opt,name=pagination,proto3" json:"pagination"` +} + +func (x *SearchMessageReq) Reset() { + *x = SearchMessageReq{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_msg_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchMessageReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchMessageReq) ProtoMessage() {} + +func (x *SearchMessageReq) ProtoReflect() protoreflect.Message { + mi := &file_msg_msg_proto_msgTypes[45] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchMessageReq.ProtoReflect.Descriptor instead. +func (*SearchMessageReq) Descriptor() ([]byte, []int) { + return file_msg_msg_proto_rawDescGZIP(), []int{45} +} + +func (x *SearchMessageReq) GetSendID() string { + if x != nil { + return x.SendID + } + return "" +} + +func (x *SearchMessageReq) GetRecvID() string { + if x != nil { + return x.RecvID + } + return "" +} + +func (x *SearchMessageReq) GetMsgType() int32 { + if x != nil { + return x.MsgType + } + return 0 +} + +func (x *SearchMessageReq) GetSendTime() string { + if x != nil { + return x.SendTime + } + return "" +} + +func (x *SearchMessageReq) GetSessionType() int32 { + if x != nil { + return x.SessionType + } + return 0 +} + +func (x *SearchMessageReq) GetPagination() *sdkws.RequestPagination { + if x != nil { + return x.Pagination + } + return nil +} + +type SearchMessageResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChatLogs []*ChatLog `protobuf:"bytes,1,rep,name=chatLogs,proto3" json:"chatLogs"` + ChatLogsNum int32 `protobuf:"varint,2,opt,name=chatLogsNum,proto3" json:"chatLogsNum"` +} + +func (x *SearchMessageResp) Reset() { + *x = SearchMessageResp{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_msg_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchMessageResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchMessageResp) ProtoMessage() {} + +func (x *SearchMessageResp) ProtoReflect() protoreflect.Message { + mi := &file_msg_msg_proto_msgTypes[46] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchMessageResp.ProtoReflect.Descriptor instead. +func (*SearchMessageResp) Descriptor() ([]byte, []int) { + return file_msg_msg_proto_rawDescGZIP(), []int{46} +} + +func (x *SearchMessageResp) GetChatLogs() []*ChatLog { + if x != nil { + return x.ChatLogs + } + return nil +} + +func (x *SearchMessageResp) GetChatLogsNum() int32 { + if x != nil { + return x.ChatLogsNum + } + return 0 +} + +type ManageMsgReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RecvID string `protobuf:"bytes,1,opt,name=recvID,proto3" json:"recvID"` + SendID string `protobuf:"bytes,2,opt,name=sendID,proto3" json:"sendID"` + GroupID string `protobuf:"bytes,3,opt,name=groupID,proto3" json:"groupID"` + Seq int64 `protobuf:"varint,4,opt,name=seq,proto3" json:"seq"` + SessionType int32 `protobuf:"varint,5,opt,name=sessionType,proto3" json:"sessionType"` +} + +func (x *ManageMsgReq) Reset() { + *x = ManageMsgReq{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_msg_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ManageMsgReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ManageMsgReq) ProtoMessage() {} + +func (x *ManageMsgReq) ProtoReflect() protoreflect.Message { + mi := &file_msg_msg_proto_msgTypes[47] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ManageMsgReq.ProtoReflect.Descriptor instead. +func (*ManageMsgReq) Descriptor() ([]byte, []int) { + return file_msg_msg_proto_rawDescGZIP(), []int{47} +} + +func (x *ManageMsgReq) GetRecvID() string { + if x != nil { + return x.RecvID + } + return "" +} + +func (x *ManageMsgReq) GetSendID() string { + if x != nil { + return x.SendID + } + return "" +} + +func (x *ManageMsgReq) GetGroupID() string { + if x != nil { + return x.GroupID + } + return "" +} + +func (x *ManageMsgReq) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *ManageMsgReq) GetSessionType() int32 { + if x != nil { + return x.SessionType + } + return 0 +} + +type ManageMsgResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ManageMsgResp) Reset() { + *x = ManageMsgResp{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_msg_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ManageMsgResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ManageMsgResp) ProtoMessage() {} + +func (x *ManageMsgResp) ProtoReflect() protoreflect.Message { + mi := &file_msg_msg_proto_msgTypes[48] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ManageMsgResp.ProtoReflect.Descriptor instead. +func (*ManageMsgResp) Descriptor() ([]byte, []int) { + return file_msg_msg_proto_rawDescGZIP(), []int{48} +} + +type ChatLog struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID,proto3" json:"serverMsgID"` + ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID,proto3" json:"clientMsgID"` + SendID string `protobuf:"bytes,3,opt,name=sendID,proto3" json:"sendID"` + RecvID string `protobuf:"bytes,4,opt,name=recvID,proto3" json:"recvID"` + GroupID string `protobuf:"bytes,5,opt,name=groupID,proto3" json:"groupID"` + RecvNickname string `protobuf:"bytes,6,opt,name=recvNickname,proto3" json:"recvNickname"` + SenderPlatformID int32 `protobuf:"varint,7,opt,name=senderPlatformID,proto3" json:"senderPlatformID"` + SenderNickname string `protobuf:"bytes,8,opt,name=senderNickname,proto3" json:"senderNickname"` + SenderFaceURL string `protobuf:"bytes,9,opt,name=senderFaceURL,proto3" json:"senderFaceURL"` + GroupName string `protobuf:"bytes,10,opt,name=groupName,proto3" json:"groupName"` + SessionType int32 `protobuf:"varint,11,opt,name=sessionType,proto3" json:"sessionType"` + MsgFrom int32 `protobuf:"varint,12,opt,name=msgFrom,proto3" json:"msgFrom"` + ContentType int32 `protobuf:"varint,13,opt,name=contentType,proto3" json:"contentType"` + Content string `protobuf:"bytes,14,opt,name=content,proto3" json:"content"` + Status int32 `protobuf:"varint,15,opt,name=status,proto3" json:"status"` + SendTime int64 `protobuf:"varint,16,opt,name=sendTime,proto3" json:"sendTime"` + CreateTime int64 `protobuf:"varint,17,opt,name=createTime,proto3" json:"createTime"` + Ex string `protobuf:"bytes,18,opt,name=ex,proto3" json:"ex"` + GroupFaceURL string `protobuf:"bytes,19,opt,name=groupFaceURL,proto3" json:"groupFaceURL"` + GroupMemberCount uint32 `protobuf:"varint,20,opt,name=groupMemberCount,proto3" json:"groupMemberCount"` + Seq int64 `protobuf:"varint,21,opt,name=seq,proto3" json:"seq"` + GroupOwner string `protobuf:"bytes,22,opt,name=groupOwner,proto3" json:"groupOwner"` + GroupType int32 `protobuf:"varint,23,opt,name=groupType,proto3" json:"groupType"` +} + +func (x *ChatLog) Reset() { + *x = ChatLog{} + if protoimpl.UnsafeEnabled { + mi := &file_msg_msg_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChatLog) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatLog) ProtoMessage() {} + +func (x *ChatLog) ProtoReflect() protoreflect.Message { + mi := &file_msg_msg_proto_msgTypes[49] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatLog.ProtoReflect.Descriptor instead. +func (*ChatLog) Descriptor() ([]byte, []int) { + return file_msg_msg_proto_rawDescGZIP(), []int{49} +} + +func (x *ChatLog) GetServerMsgID() string { + if x != nil { + return x.ServerMsgID + } + return "" +} + +func (x *ChatLog) GetClientMsgID() string { + if x != nil { + return x.ClientMsgID + } + return "" +} + +func (x *ChatLog) GetSendID() string { + if x != nil { + return x.SendID + } + return "" +} + +func (x *ChatLog) GetRecvID() string { + if x != nil { + return x.RecvID + } + return "" +} + +func (x *ChatLog) GetGroupID() string { + if x != nil { + return x.GroupID + } + return "" +} + +func (x *ChatLog) GetRecvNickname() string { + if x != nil { + return x.RecvNickname + } + return "" +} + +func (x *ChatLog) GetSenderPlatformID() int32 { + if x != nil { + return x.SenderPlatformID + } + return 0 +} + +func (x *ChatLog) GetSenderNickname() string { + if x != nil { + return x.SenderNickname + } + return "" +} + +func (x *ChatLog) GetSenderFaceURL() string { + if x != nil { + return x.SenderFaceURL + } + return "" +} + +func (x *ChatLog) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +func (x *ChatLog) GetSessionType() int32 { + if x != nil { + return x.SessionType + } + return 0 +} + +func (x *ChatLog) GetMsgFrom() int32 { + if x != nil { + return x.MsgFrom + } + return 0 +} + +func (x *ChatLog) GetContentType() int32 { + if x != nil { + return x.ContentType + } + return 0 +} + +func (x *ChatLog) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *ChatLog) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *ChatLog) GetSendTime() int64 { + if x != nil { + return x.SendTime + } + return 0 +} + +func (x *ChatLog) GetCreateTime() int64 { + if x != nil { + return x.CreateTime + } + return 0 +} + +func (x *ChatLog) GetEx() string { + if x != nil { + return x.Ex + } + return "" +} + +func (x *ChatLog) GetGroupFaceURL() string { + if x != nil { + return x.GroupFaceURL + } + return "" +} + +func (x *ChatLog) GetGroupMemberCount() uint32 { + if x != nil { + return x.GroupMemberCount + } + return 0 +} + +func (x *ChatLog) GetSeq() int64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *ChatLog) GetGroupOwner() string { + if x != nil { + return x.GroupOwner + } + return "" +} + +func (x *ChatLog) GetGroupType() int32 { + if x != nil { + return x.GroupType + } + return 0 +} + var File_msg_msg_proto protoreflect.FileDescriptor var file_msg_msg_proto_rawDesc = []byte{ @@ -2612,125 +3108,212 @@ var file_msg_msg_proto_rawDesc = []byte{ 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x32, 0xa8, 0x0e, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x50, 0x0a, 0x09, 0x47, 0x65, - 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x20, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x47, 0x65, 0x74, - 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x47, - 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x70, 0x0a, 0x15, - 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, - 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x38, 0x01, 0x22, 0xe1, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, + 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x12, + 0x16, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, + 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x45, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6c, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x08, 0x63, + 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x43, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x52, 0x08, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x6f, + 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x4e, 0x75, + 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, + 0x73, 0x4e, 0x75, 0x6d, 0x22, 0x8c, 0x01, 0x0a, 0x0c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, + 0x73, 0x67, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, + 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, + 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x22, 0xcf, 0x05, 0x0a, 0x07, 0x43, 0x68, 0x61, 0x74, 0x4c, 0x6f, 0x67, + 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x73, 0x67, + 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x73, 0x67, 0x49, + 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, + 0x73, 0x67, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, + 0x72, 0x65, 0x63, 0x76, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, + 0x63, 0x76, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x22, + 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x76, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x63, 0x76, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x74, + 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x73, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x44, 0x12, 0x26, + 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x69, + 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x46, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x46, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x12, 0x1c, 0x0a, 0x09, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0b, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x73, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, + 0x73, 0x67, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, + 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, + 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x65, 0x78, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x65, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x46, + 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x46, 0x61, 0x63, 0x65, 0x55, 0x52, 0x4c, 0x12, 0x2a, 0x0a, 0x10, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x14, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x15, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x03, 0x73, 0x65, 0x71, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x67, 0x72, 0x6f, + 0x75, 0x70, 0x54, 0x79, 0x70, 0x65, 0x32, 0xd0, 0x0f, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x50, + 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x20, 0x2e, 0x4f, 0x70, + 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, + 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, + 0x77, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x70, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, + 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, - 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x68, - 0x0a, 0x11, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x53, - 0x65, 0x71, 0x73, 0x12, 0x28, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x29, 0x2e, - 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, - 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, - 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, - 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x71, 0x1a, 0x1d, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x70, 0x0a, 0x15, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x65, - 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, - 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x73, 0x70, 0x12, 0x68, 0x0a, 0x11, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x12, 0x28, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, + 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, + 0x71, 0x1a, 0x29, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x73, 0x64, 0x6b, 0x77, 0x73, 0x2e, 0x50, 0x75, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x42, 0x79, 0x53, 0x65, 0x71, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x58, 0x0a, 0x0d, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x22, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4c, 0x0a, 0x09, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x07, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x12, + 0x1c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, + 0x73, 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x70, 0x0a, 0x15, + 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x2a, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x5e, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, - 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x12, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, - 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x25, 0x2e, 0x4f, 0x70, - 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x4f, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, - 0x12, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, 0x65, - 0x71, 0x1a, 0x20, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x73, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, - 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x12, 0x2b, 0x2e, + 0x71, 0x1a, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5e, + 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, + 0x67, 0x12, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, + 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, + 0x6c, 0x65, 0x61, 0x72, 0x41, 0x6c, 0x6c, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4f, + 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x12, 0x1f, 0x2e, 0x4f, + 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, - 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, - 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, - 0x79, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x64, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x12, 0x26, 0x2e, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x73, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, + 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, + 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x42, 0x79, 0x53, 0x65, 0x71, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x64, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, + 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x12, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, + 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, + 0x71, 0x1a, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, + 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, 0x10, 0x53, 0x65, + 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, + 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, + 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, + 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, 0x0a, + 0x10, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, + 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x4c, 0x0a, 0x09, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x12, 0x1e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, - 0x61, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x27, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, - 0x73, 0x67, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x61, - 0x0a, 0x10, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, - 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x61, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x25, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, - 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x26, 0x2e, 0x4f, - 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x47, 0x65, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x4c, 0x0a, 0x09, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, - 0x67, 0x12, 0x1e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x71, 0x1a, 0x1f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x5b, 0x0a, 0x0e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, - 0x52, 0x65, 0x61, 0x64, 0x12, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, - 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, - 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x73, 0x0a, 0x16, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, - 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, - 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, - 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x7c, 0x0a, 0x19, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, - 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, - 0x71, 0x12, 0x2e, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, - 0x71, 0x1a, 0x2f, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x91, 0x01, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5b, + 0x0a, 0x0e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, + 0x12, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, + 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, 0x73, 0x41, 0x73, 0x52, 0x65, + 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x4d, 0x73, 0x67, + 0x73, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x73, 0x0a, 0x16, 0x4d, + 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, + 0x73, 0x52, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, + 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x1a, 0x2c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, + 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x7c, 0x0a, 0x19, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x12, 0x2e, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x2f, 0x2e, + 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x53, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x91, + 0x01, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, + 0x53, 0x65, 0x71, 0x12, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, - 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x12, 0x35, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, - 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, - 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x36, - 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x48, 0x61, 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, 0x53, - 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x58, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, - 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, - 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x5b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x12, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, + 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, 0x71, 0x1a, 0x36, 0x2e, 0x4f, 0x70, 0x65, + 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, + 0x74, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x61, + 0x73, 0x52, 0x65, 0x61, 0x64, 0x41, 0x6e, 0x64, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x71, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x58, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x23, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, - 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, - 0x49, 0x4d, 0x53, 0x44, 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, - 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x76, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5b, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, + 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x6d, 0x73, + 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x4d, 0x53, 0x44, + 0x4b, 0x2f, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, 0x2d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x73, 0x67, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2745,7 +3328,7 @@ func file_msg_msg_proto_rawDescGZIP() []byte { return file_msg_msg_proto_rawDescData } -var file_msg_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 48) +var file_msg_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 53) var file_msg_msg_proto_goTypes = []interface{}{ (*MsgDataToMQ)(nil), // 0: OpenIMServer.msg.MsgDataToMQ (*MsgDataToDB)(nil), // 1: OpenIMServer.msg.MsgDataToDB @@ -2792,79 +3375,90 @@ var file_msg_msg_proto_goTypes = []interface{}{ (*GetActiveGroupReq)(nil), // 42: OpenIMServer.msg.GetActiveGroupReq (*ActiveGroup)(nil), // 43: OpenIMServer.msg.ActiveGroup (*GetActiveGroupResp)(nil), // 44: OpenIMServer.msg.GetActiveGroupResp - nil, // 45: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry - nil, // 46: OpenIMServer.msg.GetActiveUserResp.DateCountEntry - nil, // 47: OpenIMServer.msg.GetActiveGroupResp.DateCountEntry - (*sdkws.MsgData)(nil), // 48: OpenIMServer.sdkws.MsgData - (*sdkws.RequestPagination)(nil), // 49: OpenIMServer.sdkws.RequestPagination - (*sdkws.UserInfo)(nil), // 50: OpenIMServer.sdkws.UserInfo - (*sdkws.GroupInfo)(nil), // 51: OpenIMServer.sdkws.GroupInfo - (*sdkws.GetMaxSeqReq)(nil), // 52: OpenIMServer.sdkws.GetMaxSeqReq - (*sdkws.PullMessageBySeqsReq)(nil), // 53: OpenIMServer.sdkws.PullMessageBySeqsReq - (*sdkws.GetMaxSeqResp)(nil), // 54: OpenIMServer.sdkws.GetMaxSeqResp - (*sdkws.PullMessageBySeqsResp)(nil), // 55: OpenIMServer.sdkws.PullMessageBySeqsResp + (*SearchMessageReq)(nil), // 45: OpenIMServer.msg.SearchMessageReq + (*SearchMessageResp)(nil), // 46: OpenIMServer.msg.SearchMessageResp + (*ManageMsgReq)(nil), // 47: OpenIMServer.msg.manageMsgReq + (*ManageMsgResp)(nil), // 48: OpenIMServer.msg.manageMsgResp + (*ChatLog)(nil), // 49: OpenIMServer.msg.ChatLog + nil, // 50: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry + nil, // 51: OpenIMServer.msg.GetActiveUserResp.DateCountEntry + nil, // 52: OpenIMServer.msg.GetActiveGroupResp.DateCountEntry + (*sdkws.MsgData)(nil), // 53: OpenIMServer.sdkws.MsgData + (*sdkws.RequestPagination)(nil), // 54: OpenIMServer.sdkws.RequestPagination + (*sdkws.UserInfo)(nil), // 55: OpenIMServer.sdkws.UserInfo + (*sdkws.GroupInfo)(nil), // 56: OpenIMServer.sdkws.GroupInfo + (*sdkws.GetMaxSeqReq)(nil), // 57: OpenIMServer.sdkws.GetMaxSeqReq + (*sdkws.PullMessageBySeqsReq)(nil), // 58: OpenIMServer.sdkws.PullMessageBySeqsReq + (*sdkws.GetMaxSeqResp)(nil), // 59: OpenIMServer.sdkws.GetMaxSeqResp + (*sdkws.PullMessageBySeqsResp)(nil), // 60: OpenIMServer.sdkws.PullMessageBySeqsResp } var file_msg_msg_proto_depIdxs = []int32{ - 48, // 0: OpenIMServer.msg.MsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData - 48, // 1: OpenIMServer.msg.MsgDataToDB.msgData:type_name -> OpenIMServer.sdkws.MsgData - 48, // 2: OpenIMServer.msg.PushMsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData - 48, // 3: OpenIMServer.msg.MsgDataToMongoByMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData - 48, // 4: OpenIMServer.msg.SendMsgReq.msgData:type_name -> OpenIMServer.sdkws.MsgData - 48, // 5: OpenIMServer.msg.MsgDataToModifyByMQ.messages:type_name -> OpenIMServer.sdkws.MsgData + 53, // 0: OpenIMServer.msg.MsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData + 53, // 1: OpenIMServer.msg.MsgDataToDB.msgData:type_name -> OpenIMServer.sdkws.MsgData + 53, // 2: OpenIMServer.msg.PushMsgDataToMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData + 53, // 3: OpenIMServer.msg.MsgDataToMongoByMQ.msgData:type_name -> OpenIMServer.sdkws.MsgData + 53, // 4: OpenIMServer.msg.SendMsgReq.msgData:type_name -> OpenIMServer.sdkws.MsgData + 53, // 5: OpenIMServer.msg.MsgDataToModifyByMQ.messages:type_name -> OpenIMServer.sdkws.MsgData 23, // 6: OpenIMServer.msg.ClearConversationsMsgReq.deleteSyncOpt:type_name -> OpenIMServer.msg.DeleteSyncOpt 23, // 7: OpenIMServer.msg.UserClearAllMsgReq.deleteSyncOpt:type_name -> OpenIMServer.msg.DeleteSyncOpt 23, // 8: OpenIMServer.msg.DeleteMsgsReq.deleteSyncOpt:type_name -> OpenIMServer.msg.DeleteSyncOpt - 45, // 9: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.seqs:type_name -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry - 49, // 10: OpenIMServer.msg.GetActiveUserReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination - 50, // 11: OpenIMServer.msg.ActiveUser.user:type_name -> OpenIMServer.sdkws.UserInfo - 46, // 12: OpenIMServer.msg.GetActiveUserResp.dateCount:type_name -> OpenIMServer.msg.GetActiveUserResp.DateCountEntry + 50, // 9: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.seqs:type_name -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry + 54, // 10: OpenIMServer.msg.GetActiveUserReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination + 55, // 11: OpenIMServer.msg.ActiveUser.user:type_name -> OpenIMServer.sdkws.UserInfo + 51, // 12: OpenIMServer.msg.GetActiveUserResp.dateCount:type_name -> OpenIMServer.msg.GetActiveUserResp.DateCountEntry 40, // 13: OpenIMServer.msg.GetActiveUserResp.users:type_name -> OpenIMServer.msg.ActiveUser - 49, // 14: OpenIMServer.msg.GetActiveGroupReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination - 51, // 15: OpenIMServer.msg.ActiveGroup.group:type_name -> OpenIMServer.sdkws.GroupInfo - 47, // 16: OpenIMServer.msg.GetActiveGroupResp.dateCount:type_name -> OpenIMServer.msg.GetActiveGroupResp.DateCountEntry + 54, // 14: OpenIMServer.msg.GetActiveGroupReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination + 56, // 15: OpenIMServer.msg.ActiveGroup.group:type_name -> OpenIMServer.sdkws.GroupInfo + 52, // 16: OpenIMServer.msg.GetActiveGroupResp.dateCount:type_name -> OpenIMServer.msg.GetActiveGroupResp.DateCountEntry 43, // 17: OpenIMServer.msg.GetActiveGroupResp.groups:type_name -> OpenIMServer.msg.ActiveGroup - 37, // 18: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry.value:type_name -> OpenIMServer.msg.Seqs - 52, // 19: OpenIMServer.msg.msg.GetMaxSeq:input_type -> OpenIMServer.sdkws.GetMaxSeqReq - 34, // 20: OpenIMServer.msg.msg.GetConversationMaxSeq:input_type -> OpenIMServer.msg.GetConversationMaxSeqReq - 53, // 21: OpenIMServer.msg.msg.PullMessageBySeqs:input_type -> OpenIMServer.sdkws.PullMessageBySeqsReq - 6, // 22: OpenIMServer.msg.msg.SendMsg:input_type -> OpenIMServer.msg.SendMsgReq - 24, // 23: OpenIMServer.msg.msg.ClearConversationsMsg:input_type -> OpenIMServer.msg.ClearConversationsMsgReq - 26, // 24: OpenIMServer.msg.msg.UserClearAllMsg:input_type -> OpenIMServer.msg.UserClearAllMsgReq - 28, // 25: OpenIMServer.msg.msg.DeleteMsgs:input_type -> OpenIMServer.msg.DeleteMsgsReq - 32, // 26: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:input_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqReq - 30, // 27: OpenIMServer.msg.msg.DeleteMsgPhysical:input_type -> OpenIMServer.msg.DeleteMsgPhysicalReq - 8, // 28: OpenIMServer.msg.msg.SetSendMsgStatus:input_type -> OpenIMServer.msg.SetSendMsgStatusReq - 10, // 29: OpenIMServer.msg.msg.GetSendMsgStatus:input_type -> OpenIMServer.msg.GetSendMsgStatusReq - 15, // 30: OpenIMServer.msg.msg.RevokeMsg:input_type -> OpenIMServer.msg.RevokeMsgReq - 17, // 31: OpenIMServer.msg.msg.MarkMsgsAsRead:input_type -> OpenIMServer.msg.MarkMsgsAsReadReq - 19, // 32: OpenIMServer.msg.msg.MarkConversationAsRead:input_type -> OpenIMServer.msg.MarkConversationAsReadReq - 21, // 33: OpenIMServer.msg.msg.SetConversationHasReadSeq:input_type -> OpenIMServer.msg.SetConversationHasReadSeqReq - 36, // 34: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:input_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqReq - 39, // 35: OpenIMServer.msg.msg.GetActiveUser:input_type -> OpenIMServer.msg.GetActiveUserReq - 42, // 36: OpenIMServer.msg.msg.GetActiveGroup:input_type -> OpenIMServer.msg.GetActiveGroupReq - 54, // 37: OpenIMServer.msg.msg.GetMaxSeq:output_type -> OpenIMServer.sdkws.GetMaxSeqResp - 35, // 38: OpenIMServer.msg.msg.GetConversationMaxSeq:output_type -> OpenIMServer.msg.GetConversationMaxSeqResp - 55, // 39: OpenIMServer.msg.msg.PullMessageBySeqs:output_type -> OpenIMServer.sdkws.PullMessageBySeqsResp - 7, // 40: OpenIMServer.msg.msg.SendMsg:output_type -> OpenIMServer.msg.SendMsgResp - 25, // 41: OpenIMServer.msg.msg.ClearConversationsMsg:output_type -> OpenIMServer.msg.ClearConversationsMsgResp - 27, // 42: OpenIMServer.msg.msg.UserClearAllMsg:output_type -> OpenIMServer.msg.UserClearAllMsgResp - 29, // 43: OpenIMServer.msg.msg.DeleteMsgs:output_type -> OpenIMServer.msg.DeleteMsgsResp - 33, // 44: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:output_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqResp - 31, // 45: OpenIMServer.msg.msg.DeleteMsgPhysical:output_type -> OpenIMServer.msg.DeleteMsgPhysicalResp - 9, // 46: OpenIMServer.msg.msg.SetSendMsgStatus:output_type -> OpenIMServer.msg.SetSendMsgStatusResp - 11, // 47: OpenIMServer.msg.msg.GetSendMsgStatus:output_type -> OpenIMServer.msg.GetSendMsgStatusResp - 16, // 48: OpenIMServer.msg.msg.RevokeMsg:output_type -> OpenIMServer.msg.RevokeMsgResp - 18, // 49: OpenIMServer.msg.msg.MarkMsgsAsRead:output_type -> OpenIMServer.msg.MarkMsgsAsReadResp - 20, // 50: OpenIMServer.msg.msg.MarkConversationAsRead:output_type -> OpenIMServer.msg.MarkConversationAsReadResp - 22, // 51: OpenIMServer.msg.msg.SetConversationHasReadSeq:output_type -> OpenIMServer.msg.SetConversationHasReadSeqResp - 38, // 52: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:output_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp - 41, // 53: OpenIMServer.msg.msg.GetActiveUser:output_type -> OpenIMServer.msg.GetActiveUserResp - 44, // 54: OpenIMServer.msg.msg.GetActiveGroup:output_type -> OpenIMServer.msg.GetActiveGroupResp - 37, // [37:55] is the sub-list for method output_type - 19, // [19:37] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 54, // 18: OpenIMServer.msg.SearchMessageReq.pagination:type_name -> OpenIMServer.sdkws.RequestPagination + 49, // 19: OpenIMServer.msg.SearchMessageResp.chatLogs:type_name -> OpenIMServer.msg.ChatLog + 37, // 20: OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp.SeqsEntry.value:type_name -> OpenIMServer.msg.Seqs + 57, // 21: OpenIMServer.msg.msg.GetMaxSeq:input_type -> OpenIMServer.sdkws.GetMaxSeqReq + 34, // 22: OpenIMServer.msg.msg.GetConversationMaxSeq:input_type -> OpenIMServer.msg.GetConversationMaxSeqReq + 58, // 23: OpenIMServer.msg.msg.PullMessageBySeqs:input_type -> OpenIMServer.sdkws.PullMessageBySeqsReq + 45, // 24: OpenIMServer.msg.msg.SearchMessage:input_type -> OpenIMServer.msg.SearchMessageReq + 47, // 25: OpenIMServer.msg.msg.ManageMsg:input_type -> OpenIMServer.msg.manageMsgReq + 6, // 26: OpenIMServer.msg.msg.SendMsg:input_type -> OpenIMServer.msg.SendMsgReq + 24, // 27: OpenIMServer.msg.msg.ClearConversationsMsg:input_type -> OpenIMServer.msg.ClearConversationsMsgReq + 26, // 28: OpenIMServer.msg.msg.UserClearAllMsg:input_type -> OpenIMServer.msg.UserClearAllMsgReq + 28, // 29: OpenIMServer.msg.msg.DeleteMsgs:input_type -> OpenIMServer.msg.DeleteMsgsReq + 32, // 30: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:input_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqReq + 30, // 31: OpenIMServer.msg.msg.DeleteMsgPhysical:input_type -> OpenIMServer.msg.DeleteMsgPhysicalReq + 8, // 32: OpenIMServer.msg.msg.SetSendMsgStatus:input_type -> OpenIMServer.msg.SetSendMsgStatusReq + 10, // 33: OpenIMServer.msg.msg.GetSendMsgStatus:input_type -> OpenIMServer.msg.GetSendMsgStatusReq + 15, // 34: OpenIMServer.msg.msg.RevokeMsg:input_type -> OpenIMServer.msg.RevokeMsgReq + 17, // 35: OpenIMServer.msg.msg.MarkMsgsAsRead:input_type -> OpenIMServer.msg.MarkMsgsAsReadReq + 19, // 36: OpenIMServer.msg.msg.MarkConversationAsRead:input_type -> OpenIMServer.msg.MarkConversationAsReadReq + 21, // 37: OpenIMServer.msg.msg.SetConversationHasReadSeq:input_type -> OpenIMServer.msg.SetConversationHasReadSeqReq + 36, // 38: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:input_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqReq + 39, // 39: OpenIMServer.msg.msg.GetActiveUser:input_type -> OpenIMServer.msg.GetActiveUserReq + 42, // 40: OpenIMServer.msg.msg.GetActiveGroup:input_type -> OpenIMServer.msg.GetActiveGroupReq + 59, // 41: OpenIMServer.msg.msg.GetMaxSeq:output_type -> OpenIMServer.sdkws.GetMaxSeqResp + 35, // 42: OpenIMServer.msg.msg.GetConversationMaxSeq:output_type -> OpenIMServer.msg.GetConversationMaxSeqResp + 60, // 43: OpenIMServer.msg.msg.PullMessageBySeqs:output_type -> OpenIMServer.sdkws.PullMessageBySeqsResp + 46, // 44: OpenIMServer.msg.msg.SearchMessage:output_type -> OpenIMServer.msg.SearchMessageResp + 48, // 45: OpenIMServer.msg.msg.ManageMsg:output_type -> OpenIMServer.msg.manageMsgResp + 7, // 46: OpenIMServer.msg.msg.SendMsg:output_type -> OpenIMServer.msg.SendMsgResp + 25, // 47: OpenIMServer.msg.msg.ClearConversationsMsg:output_type -> OpenIMServer.msg.ClearConversationsMsgResp + 27, // 48: OpenIMServer.msg.msg.UserClearAllMsg:output_type -> OpenIMServer.msg.UserClearAllMsgResp + 29, // 49: OpenIMServer.msg.msg.DeleteMsgs:output_type -> OpenIMServer.msg.DeleteMsgsResp + 33, // 50: OpenIMServer.msg.msg.DeleteMsgPhysicalBySeq:output_type -> OpenIMServer.msg.DeleteMsgPhysicalBySeqResp + 31, // 51: OpenIMServer.msg.msg.DeleteMsgPhysical:output_type -> OpenIMServer.msg.DeleteMsgPhysicalResp + 9, // 52: OpenIMServer.msg.msg.SetSendMsgStatus:output_type -> OpenIMServer.msg.SetSendMsgStatusResp + 11, // 53: OpenIMServer.msg.msg.GetSendMsgStatus:output_type -> OpenIMServer.msg.GetSendMsgStatusResp + 16, // 54: OpenIMServer.msg.msg.RevokeMsg:output_type -> OpenIMServer.msg.RevokeMsgResp + 18, // 55: OpenIMServer.msg.msg.MarkMsgsAsRead:output_type -> OpenIMServer.msg.MarkMsgsAsReadResp + 20, // 56: OpenIMServer.msg.msg.MarkConversationAsRead:output_type -> OpenIMServer.msg.MarkConversationAsReadResp + 22, // 57: OpenIMServer.msg.msg.SetConversationHasReadSeq:output_type -> OpenIMServer.msg.SetConversationHasReadSeqResp + 38, // 58: OpenIMServer.msg.msg.GetConversationsHasReadAndMaxSeq:output_type -> OpenIMServer.msg.GetConversationsHasReadAndMaxSeqResp + 41, // 59: OpenIMServer.msg.msg.GetActiveUser:output_type -> OpenIMServer.msg.GetActiveUserResp + 44, // 60: OpenIMServer.msg.msg.GetActiveGroup:output_type -> OpenIMServer.msg.GetActiveGroupResp + 41, // [41:61] is the sub-list for method output_type + 21, // [21:41] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name } func init() { file_msg_msg_proto_init() } @@ -3413,6 +4007,66 @@ func file_msg_msg_proto_init() { return nil } } + file_msg_msg_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchMessageReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_msg_msg_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchMessageResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_msg_msg_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ManageMsgReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_msg_msg_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ManageMsgResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_msg_msg_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChatLog); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3420,7 +4074,7 @@ func file_msg_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_msg_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 48, + NumMessages: 53, NumExtensions: 0, NumServices: 1, }, @@ -3451,6 +4105,8 @@ type MsgClient interface { GetConversationMaxSeq(ctx context.Context, in *GetConversationMaxSeqReq, opts ...grpc.CallOption) (*GetConversationMaxSeqResp, error) // 拉取历史消息(包括用户的,以及指定群组的) PullMessageBySeqs(ctx context.Context, in *sdkws.PullMessageBySeqsReq, opts ...grpc.CallOption) (*sdkws.PullMessageBySeqsResp, error) + SearchMessage(ctx context.Context, in *SearchMessageReq, opts ...grpc.CallOption) (*SearchMessageResp, error) + ManageMsg(ctx context.Context, in *ManageMsgReq, opts ...grpc.CallOption) (*ManageMsgResp, error) // 发送消息 SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) // 全量清空指定会话消息 重置min seq 比最大seq大1 @@ -3512,6 +4168,24 @@ func (c *msgClient) PullMessageBySeqs(ctx context.Context, in *sdkws.PullMessage return out, nil } +func (c *msgClient) SearchMessage(ctx context.Context, in *SearchMessageReq, opts ...grpc.CallOption) (*SearchMessageResp, error) { + out := new(SearchMessageResp) + err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/SearchMessage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ManageMsg(ctx context.Context, in *ManageMsgReq, opts ...grpc.CallOption) (*ManageMsgResp, error) { + out := new(ManageMsgResp) + err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/ManageMsg", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) { out := new(SendMsgResp) err := c.cc.Invoke(ctx, "/OpenIMServer.msg.msg/SendMsg", in, out, opts...) @@ -3654,6 +4328,8 @@ type MsgServer interface { GetConversationMaxSeq(context.Context, *GetConversationMaxSeqReq) (*GetConversationMaxSeqResp, error) // 拉取历史消息(包括用户的,以及指定群组的) PullMessageBySeqs(context.Context, *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) + SearchMessage(context.Context, *SearchMessageReq) (*SearchMessageResp, error) + ManageMsg(context.Context, *ManageMsgReq) (*ManageMsgResp, error) // 发送消息 SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) // 全量清空指定会话消息 重置min seq 比最大seq大1 @@ -3693,6 +4369,12 @@ func (*UnimplementedMsgServer) GetConversationMaxSeq(context.Context, *GetConver func (*UnimplementedMsgServer) PullMessageBySeqs(context.Context, *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) { return nil, status.Errorf(codes.Unimplemented, "method PullMessageBySeqs not implemented") } +func (*UnimplementedMsgServer) SearchMessage(context.Context, *SearchMessageReq) (*SearchMessageResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method SearchMessage not implemented") +} +func (*UnimplementedMsgServer) ManageMsg(context.Context, *ManageMsgReq) (*ManageMsgResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ManageMsg not implemented") +} func (*UnimplementedMsgServer) SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) { return nil, status.Errorf(codes.Unimplemented, "method SendMsg not implemented") } @@ -3797,6 +4479,42 @@ func _Msg_PullMessageBySeqs_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_SearchMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchMessageReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SearchMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/OpenIMServer.msg.msg/SearchMessage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SearchMessage(ctx, req.(*SearchMessageReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ManageMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ManageMsgReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ManageMsg(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/OpenIMServer.msg.msg/ManageMsg", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ManageMsg(ctx, req.(*ManageMsgReq)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SendMsgReq) if err := dec(in); err != nil { @@ -4083,6 +4801,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "PullMessageBySeqs", Handler: _Msg_PullMessageBySeqs_Handler, }, + { + MethodName: "SearchMessage", + Handler: _Msg_SearchMessage_Handler, + }, + { + MethodName: "ManageMsg", + Handler: _Msg_ManageMsg_Handler, + }, { MethodName: "SendMsg", Handler: _Msg_SendMsg_Handler, diff --git a/pkg/proto/msggateway/msggateway.pb.go b/pkg/proto/msggateway/msggateway.pb.go index 6d3aa576a..d922d98b4 100644 --- a/pkg/proto/msggateway/msggateway.pb.go +++ b/pkg/proto/msggateway/msggateway.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,16 +22,14 @@ package msggateway import ( context "context" - reflect "reflect" - sync "sync" - + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/push/push.pb.go b/pkg/proto/push/push.pb.go index f9ef4a08a..1dc9d2ab9 100644 --- a/pkg/proto/push/push.pb.go +++ b/pkg/proto/push/push.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,16 +22,14 @@ package push import ( context "context" - reflect "reflect" - sync "sync" - + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/sdkws/sdkws.pb.go b/pkg/proto/sdkws/sdkws.pb.go index f2038ee5a..b45d46d4c 100644 --- a/pkg/proto/sdkws/sdkws.pb.go +++ b/pkg/proto/sdkws/sdkws.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -7,13 +21,11 @@ package sdkws import ( - reflect "reflect" - sync "sync" - + wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - wrapperspb "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/statistics/statistics.pb.go b/pkg/proto/statistics/statistics.pb.go index 092f67b52..5660758f9 100644 --- a/pkg/proto/statistics/statistics.pb.go +++ b/pkg/proto/statistics/statistics.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -7,10 +21,9 @@ package statistics import ( - reflect "reflect" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" ) const ( diff --git a/pkg/proto/third/third.pb.go b/pkg/proto/third/third.pb.go index 1ba6c3a05..155b5f7cc 100644 --- a/pkg/proto/third/third.pb.go +++ b/pkg/proto/third/third.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,14 +22,13 @@ package third import ( context "context" - reflect "reflect" - sync "sync" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index c96acb4a4..5046505db 100644 --- a/pkg/proto/user/user.pb.go +++ b/pkg/proto/user/user.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -8,17 +22,15 @@ package user import ( context "context" - reflect "reflect" - sync "sync" - + conversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" + sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - - conversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation" - sdkws "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/proto/wrapperspb/wrapperspb.pb.go b/pkg/proto/wrapperspb/wrapperspb.pb.go index 2bb8b39db..9678bb2a0 100644 --- a/pkg/proto/wrapperspb/wrapperspb.pb.go +++ b/pkg/proto/wrapperspb/wrapperspb.pb.go @@ -1,3 +1,17 @@ +// Copyright © 2023 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. + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.29.1 @@ -7,11 +21,10 @@ package wrapperspb import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index 09e44884f..89549681c 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -17,6 +17,7 @@ package rpcclient import ( "context" "encoding/json" + "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" @@ -264,3 +265,16 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s func (s *NotificationSender) Notification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message, opts ...NotificationOptions) error { return s.NotificationWithSesstionType(ctx, sendID, recvID, contentType, s.sessionTypeConf[contentType], m, opts...) } + +func (m *Message) GetAllUserID(ctx context.Context, req *user.GetAllUserIDReq) (*user.GetAllUserIDResp, error) { + conn, err := m.discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName) + if err != nil { + panic(err) + } + client := user.NewUserClient(conn) + resp, err := client.GetAllUserID(ctx, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/pkg/rpcclient/third.go b/pkg/rpcclient/third.go index 4f57cbd69..578586ca3 100644 --- a/pkg/rpcclient/third.go +++ b/pkg/rpcclient/third.go @@ -16,6 +16,9 @@ package rpcclient import ( "context" + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + "net/url" "google.golang.org/grpc" @@ -25,9 +28,10 @@ import ( ) type Third struct { - conn grpc.ClientConnInterface - Client third.ThirdClient - discov discoveryregistry.SvcDiscoveryRegistry + conn grpc.ClientConnInterface + Client third.ThirdClient + discov discoveryregistry.SvcDiscoveryRegistry + MinioClient *minio.Client } func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third { @@ -36,5 +40,30 @@ func NewThird(discov discoveryregistry.SvcDiscoveryRegistry) *Third { panic(err) } client := third.NewThirdClient(conn) - return &Third{discov: discov, Client: client, conn: conn} + minioClient, err := minioInit() + return &Third{discov: discov, Client: client, conn: conn, MinioClient: minioClient} +} + +func minioInit() (*minio.Client, error) { + minioClient := &minio.Client{} + var initUrl string + initUrl = config.Config.Object.Minio.Endpoint + minioUrl, err := url.Parse(initUrl) + if err != nil { + return nil, err + } + opts := &minio.Options{ + Creds: credentials.NewStaticV4(config.Config.Object.Minio.AccessKeyID, config.Config.Object.Minio.SecretAccessKey, ""), + //Region: config.Config.Credential.Minio.Location, + } + if minioUrl.Scheme == "http" { + opts.Secure = false + } else if minioUrl.Scheme == "https" { + opts.Secure = true + } + minioClient, err = minio.New(minioUrl.Host, opts) + if err != nil { + return nil, err + } + return minioClient, nil } From 25eabde3f69535bfb11ce8dd450912f2b0774b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98hanzhixiao=E2=80=99?= <‘709674996@qq.com’> Date: Thu, 13 Jul 2023 17:04:10 +0800 Subject: [PATCH 17/20] fix conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ‘hanzhixiao’ <‘709674996@qq.com’> --- cmd/openim-api/main.go | 1 + config/config.yaml | 6 +++--- internal/rpc/msg/server.go | 3 +++ pkg/common/cmd/rpc.go | 1 + pkg/rpcclient/msg.go | 35 ++++++++++++++++++----------------- pkg/startrpc/start.go | 1 + 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/cmd/openim-api/main.go b/cmd/openim-api/main.go index b80460990..c91445388 100644 --- a/cmd/openim-api/main.go +++ b/cmd/openim-api/main.go @@ -56,6 +56,7 @@ func startPprof() { } func run(port int) error { + port = 10002 if port == 0 { return fmt.Errorf("port is empty") } diff --git a/config/config.yaml b/config/config.yaml index 07d46957e..cbbcf9e18 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -23,9 +23,9 @@ zookeeper: password: #密码 mysql: - address: [ 127.0.0.1:13306 ] #目前仅支持单机 + address: [ 127.0.0.1:3306 ] #目前仅支持单机 username: root #用户名 - password: openIM123 #密码 + password: #密码 database: openIM_v3 #不建议修改 maxOpenConn: 1000 #最大连接数 maxIdleConn: 100 #最大空闲连接数 @@ -42,7 +42,7 @@ mongo: maxPoolSize: 100 redis: - address: [ 127.0.0.1:16379 ] # + address: [ 127.0.0.1:6379 ] # username: #only redis version 6.0+ need username password: openIM123 #密码 diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 3289a4b47..cf50dfb9f 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -81,6 +81,9 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e groupRpcClient := rpcclient.NewGroupRpcClient(client) friendRpcClient := rpcclient.NewFriendRpcClient(client) mysql, err := relation.NewGormDB() + if err != nil { + return err + } msgMysModel := relation.NewChatLogGorm(mysql) msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, cacheModel, msgMysModel) s := &msgServer{ diff --git a/pkg/common/cmd/rpc.go b/pkg/common/cmd/rpc.go index 239858764..0c94b2b78 100644 --- a/pkg/common/cmd/rpc.go +++ b/pkg/common/cmd/rpc.go @@ -45,6 +45,7 @@ func (a *RpcCmd) StartSvr( name string, rpcFn func(discov discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error, ) error { + a.port = 10030 if a.GetPortFlag() == 0 { return errors.New("port is required") } diff --git a/pkg/rpcclient/msg.go b/pkg/rpcclient/msg.go index 89549681c..029e16e47 100644 --- a/pkg/rpcclient/msg.go +++ b/pkg/rpcclient/msg.go @@ -121,9 +121,10 @@ func newSessionTypeConf() map[int32]int32 { } type Message struct { - conn grpc.ClientConnInterface - Client msg.MsgClient - discov discoveryregistry.SvcDiscoveryRegistry + conn grpc.ClientConnInterface + Client msg.MsgClient + discov discoveryregistry.SvcDiscoveryRegistry + userClient user.UserClient } func NewMessage(discov discoveryregistry.SvcDiscoveryRegistry) *Message { @@ -132,7 +133,20 @@ func NewMessage(discov discoveryregistry.SvcDiscoveryRegistry) *Message { panic(err) } client := msg.NewMsgClient(conn) - return &Message{discov: discov, conn: conn, Client: client} + conn, err = discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImUserName) + if err != nil { + panic(err) + } + userClient := user.NewUserClient(conn) + return &Message{discov: discov, conn: conn, Client: client, userClient: userClient} +} + +func (m *Message) GetAllUserID(ctx context.Context, req *user.GetAllUserIDReq) (*user.GetAllUserIDResp, error) { + resp, err := m.userClient.GetAllUserID(ctx, req) + if err != nil { + return nil, err + } + return resp, nil } type MessageRpcClient Message @@ -265,16 +279,3 @@ func (s *NotificationSender) NotificationWithSesstionType(ctx context.Context, s func (s *NotificationSender) Notification(ctx context.Context, sendID, recvID string, contentType int32, m proto.Message, opts ...NotificationOptions) error { return s.NotificationWithSesstionType(ctx, sendID, recvID, contentType, s.sessionTypeConf[contentType], m, opts...) } - -func (m *Message) GetAllUserID(ctx context.Context, req *user.GetAllUserIDReq) (*user.GetAllUserIDResp, error) { - conn, err := m.discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImMsgName) - if err != nil { - panic(err) - } - client := user.NewUserClient(conn) - resp, err := client.GetAllUserID(ctx, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/pkg/startrpc/start.go b/pkg/startrpc/start.go index 3eeaaa3a2..18b92573e 100644 --- a/pkg/startrpc/start.go +++ b/pkg/startrpc/start.go @@ -41,6 +41,7 @@ func Start( rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error, options ...grpc.ServerOption, ) error { + rpcPort = 10030 fmt.Println( "start", rpcRegisterName, From 90d226c2908dea97237619f550818558bf7be1a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98hanzhixiao=E2=80=99?= <‘709674996@qq.com’> Date: Thu, 13 Jul 2023 18:21:42 +0800 Subject: [PATCH 18/20] fix conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ‘hanzhixiao’ <‘709674996@qq.com’> --- pkg/startrpc/start.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/startrpc/start.go b/pkg/startrpc/start.go index 18b92573e..3eeaaa3a2 100644 --- a/pkg/startrpc/start.go +++ b/pkg/startrpc/start.go @@ -41,7 +41,6 @@ func Start( rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error, options ...grpc.ServerOption, ) error { - rpcPort = 10030 fmt.Println( "start", rpcRegisterName, From fda6cd5354f8c8cbde808b94cd38d7e93c9fcb0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98hanzhixiao=E2=80=99?= <‘709674996@qq.com’> Date: Thu, 13 Jul 2023 18:30:18 +0800 Subject: [PATCH 19/20] fix conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ‘hanzhixiao’ <‘709674996@qq.com’> --- config/config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index cbbcf9e18..bf52f845b 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -23,7 +23,7 @@ zookeeper: password: #密码 mysql: - address: [ 127.0.0.1:3306 ] #目前仅支持单机 + address: [ 127.0.0.1:13306 ] #目前仅支持单机 username: root #用户名 password: #密码 database: openIM_v3 #不建议修改 @@ -42,7 +42,7 @@ mongo: maxPoolSize: 100 redis: - address: [ 127.0.0.1:6379 ] # + address: [ 127.0.0.1:16379 ] # username: #only redis version 6.0+ need username password: openIM123 #密码 From 4bd97149c30b805717e1d6018919ed12eddf34dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98hanzhixiao=E2=80=99?= <‘709674996@qq.com’> Date: Thu, 13 Jul 2023 18:37:59 +0800 Subject: [PATCH 20/20] fix conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ‘hanzhixiao’ <‘709674996@qq.com’> --- cmd/openim-api/main.go | 1 - config/config.yaml | 2 +- pkg/common/cmd/rpc.go | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/openim-api/main.go b/cmd/openim-api/main.go index c91445388..b80460990 100644 --- a/cmd/openim-api/main.go +++ b/cmd/openim-api/main.go @@ -56,7 +56,6 @@ func startPprof() { } func run(port int) error { - port = 10002 if port == 0 { return fmt.Errorf("port is empty") } diff --git a/config/config.yaml b/config/config.yaml index bf52f845b..07d46957e 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -25,7 +25,7 @@ zookeeper: mysql: address: [ 127.0.0.1:13306 ] #目前仅支持单机 username: root #用户名 - password: #密码 + password: openIM123 #密码 database: openIM_v3 #不建议修改 maxOpenConn: 1000 #最大连接数 maxIdleConn: 100 #最大空闲连接数 diff --git a/pkg/common/cmd/rpc.go b/pkg/common/cmd/rpc.go index 0c94b2b78..239858764 100644 --- a/pkg/common/cmd/rpc.go +++ b/pkg/common/cmd/rpc.go @@ -45,7 +45,6 @@ func (a *RpcCmd) StartSvr( name string, rpcFn func(discov discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error, ) error { - a.port = 10030 if a.GetPortFlag() == 0 { return errors.New("port is required") }