You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/rpc/msg/server.go

66 lines
1.9 KiB

package msg
4 years ago
import (
2 years ago
"Open_IM/internal/common/check"
2 years ago
"Open_IM/pkg/common/db/controller"
"Open_IM/pkg/common/db/relation"
tablerelation "Open_IM/pkg/common/db/table/relation"
discoveryRegistry "Open_IM/pkg/discoveryregistry"
"github.com/OpenIMSDK/openKeeper"
2 years ago
promePkg "Open_IM/pkg/common/prometheus"
2 years ago
"Open_IM/pkg/proto/msg"
2 years ago
"google.golang.org/grpc"
)
type msgServer struct {
RegisterCenter discoveryRegistry.SvcDiscoveryRegistry
MsgInterface controller.MsgInterface
Group *check.GroupChecker
User *check.UserCheck
Conversation *check.ConversationChecker
3 years ago
}
type deleteMsg struct {
UserID string
OpUserID string
SeqList []uint32
OperationID string
4 years ago
}
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
mysql, err := relation.NewGormDB()
if err != nil {
return err
4 years ago
}
if err := mysql.AutoMigrate(&tablerelation.UserModel{}); err != nil {
return err
}
s := &msgServer{
Conversation: check.NewConversationChecker(client),
User: check.NewUserCheck(client),
Group: check.NewGroupChecker(client),
//MsgInterface: controller.MsgInterface(),
RegisterCenter: client,
}
s.initPrometheus()
msg.RegisterMsgServer(server, s)
return nil
4 years ago
}
func (m *msgServer) initPrometheus() {
promePkg.NewMsgPullFromRedisSuccessCounter()
promePkg.NewMsgPullFromRedisFailedCounter()
promePkg.NewMsgPullFromMongoSuccessCounter()
promePkg.NewMsgPullFromMongoFailedCounter()
promePkg.NewSingleChatMsgRecvSuccessCounter()
promePkg.NewGroupChatMsgRecvSuccessCounter()
promePkg.NewWorkSuperGroupChatMsgRecvSuccessCounter()
promePkg.NewSingleChatMsgProcessSuccessCounter()
promePkg.NewSingleChatMsgProcessFailedCounter()
promePkg.NewGroupChatMsgProcessSuccessCounter()
promePkg.NewGroupChatMsgProcessFailedCounter()
promePkg.NewWorkSuperGroupChatMsgProcessSuccessCounter()
promePkg.NewWorkSuperGroupChatMsgProcessFailedCounter()
2 years ago
}