mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
api rpc third
This commit is contained in:
parent
6150419842
commit
e93425c574
1
cmd/rpc/third/main.go
Normal file
1
cmd/rpc/third/main.go
Normal file
@ -0,0 +1 @@
|
||||
package third
|
@ -3,7 +3,6 @@ package api
|
||||
import (
|
||||
"OpenIM/internal/api/manage"
|
||||
"OpenIM/internal/api/msg"
|
||||
"OpenIM/internal/api/third"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/middleware"
|
||||
@ -106,20 +105,24 @@ func NewGinRouter() *gin.Engine {
|
||||
authRouterGroup.POST("/parse_token", a.ParseToken) //1
|
||||
authRouterGroup.POST("/force_logout", a.ForceLogout) //1
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
////Third service
|
||||
thirdGroup := r.Group("/third")
|
||||
{
|
||||
thirdGroup.POST("/tencent_cloud_storage_credential", third.TencentCloudStorageCredential)
|
||||
thirdGroup.POST("/ali_oss_credential", third.AliOSSCredential)
|
||||
thirdGroup.POST("/minio_storage_credential", third.MinioStorageCredential)
|
||||
thirdGroup.POST("/minio_upload", third.MinioUploadFile)
|
||||
thirdGroup.POST("/upload_update_app", third.UploadUpdateApp)
|
||||
thirdGroup.POST("/get_download_url", third.GetDownloadURL)
|
||||
thirdGroup.POST("/get_rtc_invitation_info", third.GetRTCInvitationInfo)
|
||||
thirdGroup.POST("/get_rtc_invitation_start_app", third.GetRTCInvitationInfoStartApp)
|
||||
thirdGroup.POST("/fcm_update_token", third.FcmUpdateToken)
|
||||
thirdGroup.POST("/aws_storage_credential", third.AwsStorageCredential)
|
||||
thirdGroup.POST("/set_app_badge", third.SetAppBadge)
|
||||
t := NewThird(zk)
|
||||
|
||||
thirdGroup.POST("/get_rtc_invitation_info", t.GetSignalInvitationInfo)
|
||||
thirdGroup.POST("/get_rtc_invitation_start_app", t.GetSignalInvitationInfoStartApp)
|
||||
thirdGroup.POST("/fcm_update_token", t.FcmUpdateToken)
|
||||
thirdGroup.POST("/set_app_badge", t.SetAppBadge)
|
||||
|
||||
thirdGroup.POST("/apply_put", t.ApplyPut)
|
||||
thirdGroup.POST("/get_put", t.GetPut)
|
||||
thirdGroup.POST("/confirm_put", t.ConfirmPut)
|
||||
}
|
||||
////Message
|
||||
chatGroup := r.Group("/msg")
|
||||
|
56
internal/api/third.go
Normal file
56
internal/api/third.go
Normal file
@ -0,0 +1,56 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"OpenIM/internal/api/a2r"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/proto/third"
|
||||
"context"
|
||||
"github.com/OpenIMSDK/openKeeper"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var _ context.Context // 解决goland编辑器bug
|
||||
|
||||
func NewThird(zk *openKeeper.ZkClient) *Third {
|
||||
return &Third{zk: zk}
|
||||
}
|
||||
|
||||
type Third struct {
|
||||
zk *openKeeper.ZkClient
|
||||
}
|
||||
|
||||
func (o *Third) client() (third.ThirdClient, error) {
|
||||
conn, err := o.zk.GetConn(config.Config.RpcRegisterName.OpenImThirdName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return third.NewThirdClient(conn), nil
|
||||
}
|
||||
|
||||
func (o *Third) ApplyPut(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.ApplyPut, o.client, c)
|
||||
}
|
||||
|
||||
func (o *Third) GetPut(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.GetPut, o.client, c)
|
||||
}
|
||||
|
||||
func (o *Third) ConfirmPut(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.ConfirmPut, o.client, c)
|
||||
}
|
||||
|
||||
func (o *Third) GetSignalInvitationInfo(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.GetSignalInvitationInfo, o.client, c)
|
||||
}
|
||||
|
||||
func (o *Third) GetSignalInvitationInfoStartApp(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.GetSignalInvitationInfoStartApp, o.client, c)
|
||||
}
|
||||
|
||||
func (o *Third) FcmUpdateToken(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.FcmUpdateToken, o.client, c)
|
||||
}
|
||||
|
||||
func (o *Third) SetAppBadge(c *gin.Context) {
|
||||
a2r.Call(third.ThirdClient.SetAppBadge, o.client, c)
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
"fmt"
|
||||
openapi "github.com/alibabacloud-go/darabonba-openapi/client"
|
||||
sts20150401 "github.com/alibabacloud-go/sts-20150401/client"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
"github.com/fatih/structs"
|
||||
|
||||
//"github.com/fatih/structs"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
var stsClient *sts20150401.Client
|
||||
|
||||
/**
|
||||
* 使用AK&SK初始化账号Client
|
||||
* @param accessKeyId
|
||||
* @param accessKeySecret
|
||||
* @return Client
|
||||
* @throws Exception
|
||||
*/
|
||||
func getStsClient() *sts20150401.Client {
|
||||
if stsClient != nil {
|
||||
return stsClient
|
||||
}
|
||||
conf := &openapi.Config{
|
||||
// 您的AccessKey ID
|
||||
AccessKeyId: tea.String(config.Config.Credential.Ali.AccessKeyID),
|
||||
// 您的AccessKey Secret
|
||||
AccessKeySecret: tea.String(config.Config.Credential.Ali.AccessKeySecret),
|
||||
// Endpoint
|
||||
Endpoint: tea.String(config.Config.Credential.Ali.StsEndpoint),
|
||||
}
|
||||
result, err := sts20150401.NewClient(conf)
|
||||
if err != nil {
|
||||
log.NewError("", "alists client初始化失败 ", err)
|
||||
}
|
||||
stsClient = result
|
||||
return stsClient
|
||||
}
|
||||
|
||||
func AliOSSCredential(c *gin.Context) {
|
||||
req := api.OSSCredentialReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var userID string
|
||||
var errInfo string
|
||||
ok, userID, errInfo = tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "AliOSSCredential args ", userID)
|
||||
|
||||
stsResp, err := getStsClient().AssumeRole(&sts20150401.AssumeRoleRequest{
|
||||
DurationSeconds: tea.Int64(config.Config.Credential.Ali.StsDurationSeconds),
|
||||
Policy: nil,
|
||||
RoleArn: tea.String(config.Config.Credential.Ali.OssRoleArn),
|
||||
RoleSessionName: tea.String(fmt.Sprintf("%s-%d", userID, time.Now().Unix())),
|
||||
})
|
||||
|
||||
resp := api.OSSCredentialResp{}
|
||||
if err != nil {
|
||||
resp.ErrCode = constant.ErrTencentCredential.ErrCode
|
||||
resp.ErrMsg = err.Error()
|
||||
} else {
|
||||
resp = api.OSSCredentialResp{
|
||||
CommResp: api.CommResp{},
|
||||
OssData: api.OSSCredentialRespData{
|
||||
Endpoint: config.Config.Credential.Ali.OssEndpoint,
|
||||
AccessKeyId: *stsResp.Body.Credentials.AccessKeyId,
|
||||
AccessKeySecret: *stsResp.Body.Credentials.AccessKeySecret,
|
||||
Token: *stsResp.Body.Credentials.SecurityToken,
|
||||
Bucket: config.Config.Credential.Ali.Bucket,
|
||||
FinalHost: config.Config.Credential.Ali.FinalHost,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
resp.Data = structs.Map(&resp.OssData)
|
||||
log.NewInfo(req.OperationID, "AliOSSCredential return ", resp)
|
||||
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
awsConfig "github.com/aws/aws-sdk-go-v2/config"
|
||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
||||
"github.com/aws/aws-sdk-go-v2/service/sts"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func AwsStorageCredential(c *gin.Context) {
|
||||
var (
|
||||
req api.AwsStorageCredentialReq
|
||||
resp api.AwsStorageCredentialResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, _, errInfo = tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
//原始帐号信息
|
||||
awsSourceConfig, err := awsConfig.LoadDefaultConfig(context.TODO(), awsConfig.WithRegion(config.Config.Credential.Aws.Region),
|
||||
awsConfig.WithCredentialsProvider(credentials.StaticCredentialsProvider{
|
||||
Value: aws.Credentials{
|
||||
AccessKeyID: config.Config.Credential.Aws.AccessKeyID,
|
||||
SecretAccessKey: config.Config.Credential.Aws.AccessKeySecret,
|
||||
Source: "Open IM OSS",
|
||||
},
|
||||
}))
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + "Init AWS S3 Credential failed " + err.Error() + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
//帐号转化
|
||||
awsStsClient := sts.NewFromConfig(awsSourceConfig)
|
||||
StsRole, err := awsStsClient.AssumeRole(context.Background(), &sts.AssumeRoleInput{
|
||||
RoleArn: aws.String(config.Config.Credential.Aws.RoleArn),
|
||||
DurationSeconds: aws.Int32(constant.AwsDurationTimes),
|
||||
RoleSessionName: aws.String(config.Config.Credential.Aws.RoleSessionName),
|
||||
ExternalId: aws.String(config.Config.Credential.Aws.ExternalId),
|
||||
})
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + "AWS S3 AssumeRole failed " + err.Error() + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
resp.CosData.AccessKeyId = string(*StsRole.Credentials.AccessKeyId)
|
||||
resp.CosData.SecretAccessKey = string(*StsRole.Credentials.SecretAccessKey)
|
||||
resp.CosData.SessionToken = string(*StsRole.Credentials.SessionToken)
|
||||
resp.CosData.Bucket = config.Config.Credential.Aws.Bucket
|
||||
resp.CosData.RegionID = config.Config.Credential.Aws.Region
|
||||
resp.CosData.FinalHost = config.Config.Credential.Aws.FinalHost
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
"OpenIM/pkg/utils"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func FcmUpdateToken(c *gin.Context) {
|
||||
var (
|
||||
req api.FcmUpdateTokenReq
|
||||
resp api.FcmUpdateTokenResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
|
||||
ok, UserId, errInfo := tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
resp.ErrCode = 500
|
||||
resp.ErrMsg = errMsg
|
||||
c.JSON(http.StatusInternalServerError, resp)
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req, UserId)
|
||||
//逻辑处理开始
|
||||
err := db.DB.SetFcmToken(UserId, req.Platform, req.FcmToken, 0)
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + "SetFcmToken failed " + err.Error() + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
resp.ErrCode = 500
|
||||
resp.ErrMsg = errMsg
|
||||
c.JSON(http.StatusInternalServerError, resp)
|
||||
return
|
||||
}
|
||||
//逻辑处理完毕
|
||||
c.JSON(http.StatusOK, resp)
|
||||
return
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
url2 "net/url"
|
||||
)
|
||||
|
||||
var (
|
||||
MinioClient *minio.Client
|
||||
)
|
||||
|
||||
func MinioInit() {
|
||||
operationID := utils.OperationIDGenerator()
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "minio config: ", config.Config.Credential.Minio)
|
||||
var initUrl string
|
||||
if config.Config.Credential.Minio.EndpointInnerEnable {
|
||||
initUrl = config.Config.Credential.Minio.EndpointInner
|
||||
} else {
|
||||
initUrl = config.Config.Credential.Minio.Endpoint
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "use initUrl: ", initUrl)
|
||||
minioUrl, err := url2.Parse(initUrl)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "parse failed, please check config/config.yaml", err.Error())
|
||||
return
|
||||
}
|
||||
opts := &minio.Options{
|
||||
Creds: credentials.NewStaticV4(config.Config.Credential.Minio.AccessKeyID, config.Config.Credential.Minio.SecretAccessKey, ""),
|
||||
//Region: config.Config.Credential.Minio.Location,
|
||||
}
|
||||
if minioUrl.Scheme == "http" {
|
||||
opts.Secure = false
|
||||
} else if minioUrl.Scheme == "https" {
|
||||
opts.Secure = true
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "Parse ok ", config.Config.Credential.Minio)
|
||||
MinioClient, err = minio.New(minioUrl.Host, opts)
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "new ok ", config.Config.Credential.Minio)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), "init minio client failed", err.Error())
|
||||
return
|
||||
}
|
||||
opt := minio.MakeBucketOptions{
|
||||
Region: config.Config.Credential.Minio.Location,
|
||||
}
|
||||
if config.Config.Credential.Minio.IsDistributedMod == true {
|
||||
opt.ObjectLocking = true
|
||||
}
|
||||
err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.Bucket, opt)
|
||||
if err != nil {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "MakeBucket failed ", err.Error())
|
||||
exists, err := MinioClient.BucketExists(context.Background(), config.Config.Credential.Minio.Bucket)
|
||||
if err == nil && exists {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "We already own ", config.Config.Credential.Minio.Bucket)
|
||||
} else {
|
||||
if err != nil {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "create bucket failed and bucket not exists")
|
||||
return
|
||||
}
|
||||
}
|
||||
// make app bucket
|
||||
err = MinioClient.MakeBucket(context.Background(), config.Config.Credential.Minio.AppBucket, opt)
|
||||
if err != nil {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "MakeBucket failed ", err.Error())
|
||||
exists, err := MinioClient.BucketExists(context.Background(), config.Config.Credential.Minio.Bucket)
|
||||
if err == nil && exists {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "We already own ", config.Config.Credential.Minio.Bucket)
|
||||
} else {
|
||||
if err != nil {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "create bucket failed and bucket not exists")
|
||||
return
|
||||
}
|
||||
}
|
||||
policy, err := MinioClient.GetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket)
|
||||
log.NewInfo("", utils.GetSelfFuncName(), policy)
|
||||
|
||||
// 自动化桶public的代码
|
||||
policyJsonString := fmt.Sprintf(`{"Version": "2012-10-17","Statement": [{"Action": ["s3:GetObject","s3:PutObject"],
|
||||
"Effect": "Allow","Principal": {"AWS": ["*"]},"Resource": ["arn:aws:s3:::%s/*"],"Sid": ""}]}`, config.Config.Credential.Minio.Bucket)
|
||||
err = MinioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.Bucket, policyJsonString)
|
||||
if err != nil {
|
||||
log.NewInfo("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in web", err.Error())
|
||||
}
|
||||
policyJsonString = fmt.Sprintf(`{"Version": "2012-10-17","Statement": [{"Action": ["s3:GetObject","s3:PutObject"],
|
||||
"Effect": "Allow","Principal": {"AWS": ["*"]},"Resource": ["arn:aws:s3:::%s/*"],"Sid": ""}]}`, config.Config.Credential.Minio.AppBucket)
|
||||
err = MinioClient.SetBucketPolicy(context.Background(), config.Config.Credential.Minio.AppBucket, policyJsonString)
|
||||
if err != nil {
|
||||
log.NewInfo("", utils.GetSelfFuncName(), "SetBucketPolicy failed please set in web", err.Error())
|
||||
}
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), "minio create and set policy success")
|
||||
}
|
@ -1,276 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
_ "OpenIM/pkg/common/tokenverify"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/minio/minio-go/v7"
|
||||
_ "github.com/minio/minio-go/v7"
|
||||
cr "github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// @Summary minio上传文件(web api)
|
||||
// @Description minio上传文件(web api), 请注意本api请求为form并非json
|
||||
// @Tags 第三方服务相关
|
||||
// @ID MinioUploadFile
|
||||
// @Accept json
|
||||
// @Param token header string true "im token"
|
||||
// @Param file formData file true "要上传的文件文件"
|
||||
// @Param fileType formData int true "文件类型"
|
||||
// @Param operationID formData string true "操作唯一ID"
|
||||
// @Produce json
|
||||
// @Success 0 {object} api.MinioUploadFileResp ""
|
||||
// @Failure 500 {object} api.Swagger500Resp "errCode为500 一般为服务器内部错误"
|
||||
// @Failure 400 {object} api.Swagger400Resp "errCode为400 一般为参数输入错误, token未带上等"
|
||||
// @Router /third/minio_upload [post]
|
||||
func MinioUploadFile(c *gin.Context) {
|
||||
var (
|
||||
req api.MinioUploadFileReq
|
||||
resp api.MinioUploadFile
|
||||
)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), r)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file or snapShot args"})
|
||||
return
|
||||
}
|
||||
}()
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, _, errInfo = tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
switch req.FileType {
|
||||
// videoType upload snapShot
|
||||
case constant.VideoType:
|
||||
snapShotFile, err := c.FormFile("snapShot")
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing snapshot arg: " + err.Error()})
|
||||
return
|
||||
}
|
||||
snapShotFileObj, err := snapShotFile.Open()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
snapShotNewName, snapShotNewType := utils.GetNewFileNameAndContentType(snapShotFile.Filename, constant.ImageType)
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), snapShotNewName, snapShotNewType)
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, snapShotNewName, snapShotFileObj, snapShotFile.Size, minio.PutObjectOptions{ContentType: snapShotNewType})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject snapShotFile error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp.SnapshotURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.Bucket + "/" + snapShotNewName
|
||||
resp.SnapshotNewName = snapShotNewName
|
||||
}
|
||||
file, err := c.FormFile("file")
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "FormFile failed", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "missing file arg: " + err.Error()})
|
||||
return
|
||||
}
|
||||
fileObj, err := file.Open()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()})
|
||||
return
|
||||
}
|
||||
newName, newType := utils.GetNewFileNameAndContentType(file.Filename, req.FileType)
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, newType, MinioClient.EndpointURL())
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "upload file error", err.Error())
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "upload file error" + err.Error()})
|
||||
return
|
||||
}
|
||||
resp.NewName = newName
|
||||
resp.URL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.Bucket + "/" + newName
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
|
||||
return
|
||||
}
|
||||
|
||||
func MinioStorageCredential(c *gin.Context) {
|
||||
var (
|
||||
req api.MinioStorageCredentialReq
|
||||
resp api.MiniostorageCredentialResp
|
||||
)
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, _, errInfo = tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
var stsOpts cr.STSAssumeRoleOptions
|
||||
stsOpts.AccessKey = config.Config.Credential.Minio.AccessKeyID
|
||||
stsOpts.SecretKey = config.Config.Credential.Minio.SecretAccessKey
|
||||
stsOpts.DurationSeconds = constant.MinioDurationTimes
|
||||
var endpoint string
|
||||
if config.Config.Credential.Minio.EndpointInnerEnable {
|
||||
endpoint = config.Config.Credential.Minio.EndpointInner
|
||||
} else {
|
||||
endpoint = config.Config.Credential.Minio.Endpoint
|
||||
}
|
||||
li, err := cr.NewSTSAssumeRole(endpoint, stsOpts)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "NewSTSAssumeRole failed", err.Error(), stsOpts, config.Config.Credential.Minio.Endpoint)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
v, err := li.Get()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "li.Get error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
resp.SessionToken = v.SessionToken
|
||||
resp.SecretAccessKey = v.SecretAccessKey
|
||||
resp.AccessKeyID = v.AccessKeyID
|
||||
resp.BucketName = config.Config.Credential.Minio.Bucket
|
||||
resp.StsEndpointURL = config.Config.Credential.Minio.Endpoint
|
||||
resp.StorageTime = config.Config.Credential.Minio.StorageTime
|
||||
resp.IsDistributedMod = config.Config.Credential.Minio.IsDistributedMod
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": "", "data": resp})
|
||||
}
|
||||
|
||||
func UploadUpdateApp(c *gin.Context) {
|
||||
var (
|
||||
req api.UploadUpdateAppReq
|
||||
resp api.UploadUpdateAppResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
|
||||
var yamlName string
|
||||
if req.Yaml == nil {
|
||||
yamlName = ""
|
||||
} else {
|
||||
yamlName = req.Yaml.Filename
|
||||
}
|
||||
fileObj, err := req.File.Open()
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "Open file error", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "Open file error" + err.Error()})
|
||||
return
|
||||
}
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, req.File.Filename, fileObj, req.File.Size, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject file error")
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "PutObject file error" + err.Error()})
|
||||
return
|
||||
}
|
||||
if yamlName != "" {
|
||||
yamlObj, err := req.Yaml.Open()
|
||||
if err == nil {
|
||||
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, yamlName, yamlObj, req.Yaml.Size, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "PutObject yaml error")
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "PutObject yaml error" + err.Error()})
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
|
||||
}
|
||||
}
|
||||
if err := imdb.UpdateAppVersion(req.Type, req.Version, req.ForceUpdate, req.File.Filename, yamlName, req.UpdateLog); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "UpdateAppVersion error", err.Error())
|
||||
resp.ErrCode = http.StatusInternalServerError
|
||||
resp.ErrMsg = err.Error()
|
||||
c.JSON(http.StatusInternalServerError, resp)
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName())
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func version2Int(version string) (int, error) {
|
||||
versions := strings.Split(version, ".")
|
||||
s := strings.Join(versions, "")
|
||||
versionInt, err := strconv.Atoi(s)
|
||||
return versionInt, err
|
||||
}
|
||||
|
||||
func GetDownloadURL(c *gin.Context) {
|
||||
var (
|
||||
req api.GetDownloadURLReq
|
||||
resp api.GetDownloadURLResp
|
||||
)
|
||||
defer func() {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp)
|
||||
}()
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
app, err := imdb.GetNewestVersion(req.Type)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "getNewestVersion failed", err.Error())
|
||||
}
|
||||
log.Debug(req.OperationID, utils.GetSelfFuncName(), "app: ", app)
|
||||
if app != nil {
|
||||
appVersion, err := version2Int(app.Version)
|
||||
reqVersion, err := version2Int(req.Version)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), "req version", req.Version, "app version", app.Version)
|
||||
}
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "req version:", reqVersion, "app version:", appVersion)
|
||||
if appVersion > reqVersion && app.Version != "" {
|
||||
resp.Data.HasNewVersion = true
|
||||
if app.ForceUpdate == true {
|
||||
resp.Data.ForceUpdate = true
|
||||
}
|
||||
if app.YamlName != "" {
|
||||
resp.Data.YamlURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.YamlName
|
||||
}
|
||||
resp.Data.FileURL = config.Config.Credential.Minio.Endpoint + "/" + config.Config.Credential.Minio.AppBucket + "/" + app.FileName
|
||||
resp.Data.Version = app.Version
|
||||
resp.Data.UpdateLog = app.UpdateLog
|
||||
c.JSON(http.StatusOK, resp)
|
||||
return
|
||||
} else {
|
||||
resp.Data.HasNewVersion = false
|
||||
c.JSON(http.StatusOK, resp)
|
||||
return
|
||||
}
|
||||
}
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 0, "errMsg": "not found app version"})
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
"OpenIM/pkg/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetRTCInvitationInfo(c *gin.Context) {
|
||||
var (
|
||||
req api.GetRTCInvitationInfoReq
|
||||
resp api.GetRTCInvitationInfoResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
ok, userID, errInfo := tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
var err error
|
||||
invitationInfo, err := db.DB.GetSignalInfoFromCacheByClientMsgID(req.ClientMsgID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetSignalInfoFromCache", err.Error(), req)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
if err := db.DB.DelUserSignalList(userID); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelUserSignalList result:", err.Error())
|
||||
}
|
||||
|
||||
resp.Data.OpUserID = invitationInfo.OpUserID
|
||||
resp.Data.Invitation.RoomID = invitationInfo.Invitation.RoomID
|
||||
resp.Data.Invitation.SessionType = invitationInfo.Invitation.SessionType
|
||||
resp.Data.Invitation.GroupID = invitationInfo.Invitation.GroupID
|
||||
resp.Data.Invitation.InviterUserID = invitationInfo.Invitation.InviterUserID
|
||||
resp.Data.Invitation.InviteeUserIDList = invitationInfo.Invitation.InviteeUserIDList
|
||||
resp.Data.Invitation.MediaType = invitationInfo.Invitation.MediaType
|
||||
resp.Data.Invitation.Timeout = invitationInfo.Invitation.Timeout
|
||||
resp.Data.Invitation.InitiateTime = invitationInfo.Invitation.InitiateTime
|
||||
resp.Data.Invitation.PlatformID = invitationInfo.Invitation.PlatformID
|
||||
resp.Data.Invitation.CustomData = invitationInfo.Invitation.CustomData
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func GetRTCInvitationInfoStartApp(c *gin.Context) {
|
||||
var (
|
||||
req api.GetRTCInvitationInfoStartAppReq
|
||||
resp api.GetRTCInvitationInfoStartAppResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req)
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, userID, errInfo := tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
invitationInfo, err := db.DB.GetAvailableSignalInvitationInfo(userID)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetSignalInfoFromCache", err.Error(), req)
|
||||
c.JSON(http.StatusOK, gin.H{"errCode": 0, "errMsg": err.Error(), "data": struct{}{}})
|
||||
return
|
||||
}
|
||||
resp.Data.OpUserID = invitationInfo.OpUserID
|
||||
resp.Data.Invitation.RoomID = invitationInfo.Invitation.RoomID
|
||||
resp.Data.Invitation.SessionType = invitationInfo.Invitation.SessionType
|
||||
resp.Data.Invitation.GroupID = invitationInfo.Invitation.GroupID
|
||||
resp.Data.Invitation.InviterUserID = invitationInfo.Invitation.InviterUserID
|
||||
resp.Data.Invitation.InviteeUserIDList = invitationInfo.Invitation.InviteeUserIDList
|
||||
resp.Data.Invitation.MediaType = invitationInfo.Invitation.MediaType
|
||||
resp.Data.Invitation.Timeout = invitationInfo.Invitation.Timeout
|
||||
resp.Data.Invitation.InitiateTime = invitationInfo.Invitation.InitiateTime
|
||||
resp.Data.Invitation.PlatformID = invitationInfo.Invitation.PlatformID
|
||||
resp.Data.Invitation.CustomData = invitationInfo.Invitation.CustomData
|
||||
c.JSON(http.StatusOK, resp)
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
"OpenIM/pkg/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func SetAppBadge(c *gin.Context) {
|
||||
var (
|
||||
req api.SetAppBadgeReq
|
||||
resp api.SetAppBadgeResp
|
||||
)
|
||||
if err := c.Bind(&req); err != nil {
|
||||
log.NewError("0", utils.GetSelfFuncName(), "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req)
|
||||
|
||||
var ok bool
|
||||
var errInfo, opUserID string
|
||||
ok, opUserID, errInfo = tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
if !tokenverify.CheckAccess(c, opUserID, req.FromUserID) {
|
||||
log.NewError(req.OperationID, "CheckAccess false ", opUserID, req.FromUserID)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "no permission"})
|
||||
}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req, opUserID)
|
||||
err := db.DB.SetUserBadgeUnreadCountSum(req.FromUserID, int(req.AppUnreadCount))
|
||||
if err != nil {
|
||||
errMsg := req.OperationID + " " + "SetUserBadgeUnreadCountSum failed " + err.Error() + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
resp.ErrCode = 500
|
||||
resp.ErrMsg = errMsg
|
||||
c.JSON(http.StatusInternalServerError, resp)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, resp)
|
||||
return
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
api "OpenIM/pkg/apistruct"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/tokenverify"
|
||||
"github.com/fatih/structs"
|
||||
|
||||
//"github.com/fatih/structs"
|
||||
"github.com/gin-gonic/gin"
|
||||
sts "github.com/tencentyun/qcloud-cos-sts-sdk/go"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TencentCloudStorageCredential(c *gin.Context) {
|
||||
req := api.TencentCloudStorageCredentialReq{}
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
var userID string
|
||||
var errInfo string
|
||||
ok, userID, errInfo = tokenverify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, "TencentCloudStorageCredential args ", userID)
|
||||
|
||||
cli := sts.NewClient(
|
||||
config.Config.Credential.Tencent.SecretID,
|
||||
config.Config.Credential.Tencent.SecretKey,
|
||||
nil,
|
||||
)
|
||||
|
||||
opt := &sts.CredentialOptions{
|
||||
DurationSeconds: int64(time.Hour.Seconds()),
|
||||
Region: config.Config.Credential.Tencent.Region,
|
||||
Policy: &sts.CredentialPolicy{
|
||||
Statement: []sts.CredentialPolicyStatement{
|
||||
{
|
||||
Action: []string{
|
||||
"name/cos:PostObject",
|
||||
"name/cos:PutObject",
|
||||
},
|
||||
Effect: "allow",
|
||||
Resource: []string{
|
||||
"qcs::cos:" + config.Config.Credential.Tencent.Region + ":uid/" + config.Config.Credential.Tencent.AppID + ":" + config.Config.Credential.Tencent.Bucket + "/*",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
res, err := cli.GetCredential(opt)
|
||||
resp := api.TencentCloudStorageCredentialResp{}
|
||||
if err != nil {
|
||||
resp.ErrCode = constant.ErrTencentCredential.ErrCode
|
||||
resp.ErrMsg = err.Error()
|
||||
} else {
|
||||
resp.CosData.Bucket = config.Config.Credential.Tencent.Bucket
|
||||
resp.CosData.Region = config.Config.Credential.Tencent.Region
|
||||
resp.CosData.CredentialResult = res
|
||||
}
|
||||
|
||||
resp.Data = structs.Map(&resp.CosData)
|
||||
log.NewInfo(req.OperationID, "TencentCloudStorageCredential return ", resp)
|
||||
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
@ -1 +1,18 @@
|
||||
package third
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/proto/third"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (t *thirdServer) ApplyPut(ctx context.Context, req *third.ApplyPutReq) (*third.ApplyPutResp, error) {
|
||||
return t.s3dataBase.ApplyPut(ctx, req)
|
||||
}
|
||||
|
||||
func (t *thirdServer) GetPut(ctx context.Context, req *third.GetPutReq) (*third.GetPutResp, error) {
|
||||
return t.s3dataBase.GetPut(ctx, req)
|
||||
}
|
||||
|
||||
func (t *thirdServer) ConfirmPut(ctx context.Context, req *third.ConfirmPutReq) (*third.ConfirmPutResp, error) {
|
||||
return t.s3dataBase.ConfirmPut(ctx, req)
|
||||
}
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"OpenIM/internal/common/check"
|
||||
"OpenIM/pkg/common/db/cache"
|
||||
"OpenIM/pkg/common/db/controller"
|
||||
"OpenIM/pkg/common/db/obj"
|
||||
"OpenIM/pkg/common/db/relation"
|
||||
"OpenIM/pkg/common/db/tx"
|
||||
"OpenIM/pkg/common/db/unrelation"
|
||||
relationTb "OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/proto/third"
|
||||
"context"
|
||||
"github.com/OpenIMSDK/openKeeper"
|
||||
@ -18,22 +18,31 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o, err := obj.NewMinioInterface()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
db, err := relation.NewGormDB()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := db.AutoMigrate(&relationTb.ObjectHashModel{}, &relationTb.ObjectInfoModel{}, &relationTb.ObjectPutModel{}); err != nil {
|
||||
return err
|
||||
}
|
||||
third.RegisterThirdServer(server, &thirdServer{
|
||||
thirdDatabase: controller.NewThirdDatabase(cache.NewCache(rdb)),
|
||||
userCheck: check.NewUserCheck(client),
|
||||
s3dataBase: controller.NewS3Database(o, relation.NewObjectHash(db), relation.NewObjectInfo(db), relation.NewObjectPut(db)),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
type thirdServer struct {
|
||||
thirdDatabase controller.ThirdDatabase
|
||||
s3dataBase controller.S3Database
|
||||
userCheck *check.UserCheck
|
||||
}
|
||||
|
||||
func (t *thirdServer) ApplySpace(ctx context.Context, req *third.ApplySpaceReq) (resp *third.ApplySpaceResp, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (t *thirdServer) GetSignalInvitationInfo(ctx context.Context, req *third.GetSignalInvitationInfoReq) (resp *third.GetSignalInvitationInfoResp, err error) {
|
||||
signalReq, err := t.thirdDatabase.GetSignalInvitationInfoByClientMsgID(ctx, req.ClientMsgID)
|
||||
if err != nil {
|
||||
|
@ -164,6 +164,7 @@ type config struct {
|
||||
OpenImConversationName string `yaml:"openImConversationName"`
|
||||
OpenImCacheName string `yaml:"openImCacheName"`
|
||||
OpenImRtcName string `yaml:"openImRtcName"`
|
||||
OpenImThirdName string `yaml:"openImThirdName"`
|
||||
}
|
||||
Zookeeper struct {
|
||||
Schema string `yaml:"schema"`
|
||||
|
353
pkg/common/db/controller/s3.go
Normal file
353
pkg/common/db/controller/s3.go
Normal file
@ -0,0 +1,353 @@
|
||||
package controller
|
||||
|
||||
import "C"
|
||||
import (
|
||||
"OpenIM/pkg/common/db/obj"
|
||||
"OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/proto/third"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"log"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type S3Database interface {
|
||||
ApplyPut(ctx context.Context, req *third.ApplyPutReq) (*third.ApplyPutResp, error)
|
||||
GetPut(ctx context.Context, req *third.GetPutReq) (*third.GetPutResp, error)
|
||||
ConfirmPut(ctx context.Context, req *third.ConfirmPutReq) (*third.ConfirmPutResp, error)
|
||||
}
|
||||
|
||||
func NewS3Database(obj obj.Interface, hash relation.ObjectHashModelInterface, info relation.ObjectInfoModelInterface, put relation.ObjectPutModelInterface) S3Database {
|
||||
return &s3Database{
|
||||
obj: obj,
|
||||
hash: hash,
|
||||
info: info,
|
||||
put: put,
|
||||
}
|
||||
}
|
||||
|
||||
type s3Database struct {
|
||||
obj obj.Interface
|
||||
hash relation.ObjectHashModelInterface
|
||||
info relation.ObjectInfoModelInterface
|
||||
put relation.ObjectPutModelInterface
|
||||
}
|
||||
|
||||
// today 今天的日期
|
||||
func (c *s3Database) today() string {
|
||||
return time.Now().Format("20060102")
|
||||
}
|
||||
|
||||
// fragmentName 根据序号生成文件名
|
||||
func (c *s3Database) fragmentName(index int) string {
|
||||
return "fragment_" + strconv.Itoa(index+1)
|
||||
}
|
||||
|
||||
// getFragmentNum 获取分片大小和分片数量
|
||||
func (c *s3Database) getFragmentNum(fragmentSize int64, objectSize int64) (int64, int) {
|
||||
if size := c.obj.MinFragmentSize(); fragmentSize < size {
|
||||
fragmentSize = size
|
||||
}
|
||||
if fragmentSize <= 0 || objectSize <= fragmentSize {
|
||||
return objectSize, 1
|
||||
} else {
|
||||
num := int(objectSize / fragmentSize)
|
||||
if objectSize%fragmentSize > 0 {
|
||||
num++
|
||||
}
|
||||
if n := c.obj.MaxFragmentNum(); num > n {
|
||||
num = n
|
||||
}
|
||||
return fragmentSize, num
|
||||
}
|
||||
}
|
||||
|
||||
func (c *s3Database) CheckHash(hash string) error {
|
||||
val, err := hex.DecodeString(hash)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(val) != md5.Size {
|
||||
return errors.New("hash value error")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *s3Database) urlName(name string) string {
|
||||
if name[0] != '/' {
|
||||
name = "/" + name
|
||||
}
|
||||
return "http://127.0.0.1:8080" + name
|
||||
}
|
||||
|
||||
func (c *s3Database) UUID() string {
|
||||
return uuid.New().String()
|
||||
}
|
||||
|
||||
func (c *s3Database) HashName(hash string) string {
|
||||
return path.Join("hash", hash)
|
||||
}
|
||||
|
||||
func (c *s3Database) isNotFound(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *s3Database) ApplyPut(ctx context.Context, req *third.ApplyPutReq) (*third.ApplyPutResp, error) {
|
||||
if err := c.CheckHash(req.Hash); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := c.obj.CheckName(req.Name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req.CleanTime != 0 && req.CleanTime <= time.Now().UnixMilli() {
|
||||
return nil, errors.New("invalid CleanTime")
|
||||
}
|
||||
var expirationTime *time.Time
|
||||
if req.CleanTime != 0 {
|
||||
expirationTime = utils.ToPtr(time.UnixMilli(req.CleanTime))
|
||||
}
|
||||
if hash, err := c.hash.Take(ctx, req.Hash, c.obj.Name()); err == nil {
|
||||
o := relation.ObjectInfoModel{
|
||||
Name: req.Name,
|
||||
Hash: hash.Hash,
|
||||
ExpirationTime: expirationTime,
|
||||
CreateTime: time.Now(),
|
||||
}
|
||||
if err := c.info.SetObject(ctx, &o); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &third.ApplyPutResp{Url: c.urlName(o.Name)}, nil // 服务器已存在
|
||||
} else if !c.isNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
// 新上传
|
||||
var pack int
|
||||
const effective = time.Hour * 24 * 2
|
||||
req.FragmentSize, pack = c.getFragmentNum(req.FragmentSize, req.Size)
|
||||
put := relation.ObjectPutModel{
|
||||
PutID: c.UUID(),
|
||||
Hash: req.Hash,
|
||||
Name: req.Name,
|
||||
ObjectSize: req.Size,
|
||||
FragmentSize: req.FragmentSize,
|
||||
ExpirationTime: expirationTime,
|
||||
EffectiveTime: time.Now().Add(effective),
|
||||
}
|
||||
put.Path = path.Join("upload", c.today(), req.Hash, put.PutID)
|
||||
putURLs := make([]string, 0, pack)
|
||||
for i := 0; i < pack; i++ {
|
||||
url, err := c.obj.PresignedPutURL(ctx, &obj.ApplyPutArgs{
|
||||
Bucket: c.obj.TempBucket(),
|
||||
Name: path.Join(put.Path, c.fragmentName(i)),
|
||||
Effective: effective,
|
||||
MaxObjectSize: req.FragmentSize,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
putURLs = append(putURLs, url)
|
||||
}
|
||||
put.CreateTime = time.Now()
|
||||
if err := c.put.Create(ctx, []*relation.ObjectPutModel{&put}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &third.ApplyPutResp{
|
||||
PutID: put.PutID,
|
||||
FragmentSize: put.FragmentSize,
|
||||
PutURLs: putURLs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *s3Database) GetPut(ctx context.Context, req *third.GetPutReq) (*third.GetPutResp, error) {
|
||||
up, err := c.put.Take(ctx, req.PutID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if up.Complete {
|
||||
return nil, errors.New("up completed")
|
||||
}
|
||||
_, pack := c.getFragmentNum(up.FragmentSize, up.ObjectSize)
|
||||
fragments := make([]*third.GetPutFragment, pack)
|
||||
for i := 0; i < pack; i++ {
|
||||
name := path.Join(up.Path, c.fragmentName(i))
|
||||
o, err := c.obj.GetObjectInfo(ctx, &obj.BucketObject{
|
||||
Bucket: c.obj.TempBucket(),
|
||||
Name: name,
|
||||
})
|
||||
if err != nil {
|
||||
if c.obj.IsNotFound(err) {
|
||||
fragments[i] = &third.GetPutFragment{}
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
fragments[i] = &third.GetPutFragment{Size: o.Size, Hash: o.Hash}
|
||||
}
|
||||
var cleanTime int64
|
||||
if up.ExpirationTime != nil {
|
||||
cleanTime = up.ExpirationTime.UnixMilli()
|
||||
}
|
||||
return &third.GetPutResp{
|
||||
FragmentSize: up.FragmentSize,
|
||||
Size: up.ObjectSize,
|
||||
Name: up.Name,
|
||||
Hash: up.Hash,
|
||||
Fragments: fragments,
|
||||
CleanTime: cleanTime,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *s3Database) ConfirmPut(ctx context.Context, req *third.ConfirmPutReq) (_ *third.ConfirmPutResp, _err error) {
|
||||
up, err := c.put.Take(ctx, req.PutID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, pack := c.getFragmentNum(up.FragmentSize, up.ObjectSize)
|
||||
defer func() {
|
||||
if _err == nil {
|
||||
// 清理上传的碎片
|
||||
for i := 0; i < pack; i++ {
|
||||
name := path.Join(up.Path, c.fragmentName(i))
|
||||
err := c.obj.DeleteObjet(ctx, &obj.BucketObject{
|
||||
Bucket: c.obj.TempBucket(),
|
||||
Name: name,
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("delete fragment %d %s %s failed %s\n", i, c.obj.TempBucket(), name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
if up.Complete {
|
||||
return nil, errors.New("put completed")
|
||||
}
|
||||
now := time.Now().UnixMilli()
|
||||
if up.EffectiveTime.UnixMilli() < now {
|
||||
return nil, errors.New("upload expired")
|
||||
}
|
||||
if up.ExpirationTime != nil && up.ExpirationTime.UnixMilli() < now {
|
||||
return nil, errors.New("object expired")
|
||||
}
|
||||
if hash, err := c.hash.Take(ctx, up.Hash, c.obj.Name()); err == nil {
|
||||
o := relation.ObjectInfoModel{
|
||||
Name: up.Name,
|
||||
Hash: hash.Hash,
|
||||
ExpirationTime: up.ExpirationTime,
|
||||
CreateTime: time.Now(),
|
||||
}
|
||||
if err := c.info.SetObject(ctx, &o); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 服务端已存在
|
||||
return &third.ConfirmPutResp{
|
||||
Url: c.urlName(o.Name),
|
||||
}, nil
|
||||
} else if c.isNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
src := make([]obj.BucketObject, pack)
|
||||
for i := 0; i < pack; i++ {
|
||||
name := path.Join(up.Path, c.fragmentName(i))
|
||||
o, err := c.obj.GetObjectInfo(ctx, &obj.BucketObject{
|
||||
Bucket: c.obj.TempBucket(),
|
||||
Name: name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if i+1 == pack { // 最后一个
|
||||
size := up.ObjectSize - up.FragmentSize*int64(i)
|
||||
if size != o.Size {
|
||||
return nil, fmt.Errorf("last fragment %d size %d not equal to %d hash %s", i, o.Size, size, o.Hash)
|
||||
}
|
||||
} else {
|
||||
if o.Size != up.FragmentSize {
|
||||
return nil, fmt.Errorf("fragment %d size %d not equal to %d hash %s", i, o.Size, up.FragmentSize, o.Hash)
|
||||
}
|
||||
}
|
||||
src[i] = obj.BucketObject{
|
||||
Bucket: c.obj.TempBucket(),
|
||||
Name: name,
|
||||
}
|
||||
}
|
||||
dst := &obj.BucketObject{
|
||||
Bucket: c.obj.DataBucket(),
|
||||
Name: c.HashName(up.Hash),
|
||||
}
|
||||
if len(src) == 1 { // 未分片直接触发copy
|
||||
// 检查数据完整性,避免脏数据
|
||||
o, err := c.obj.GetObjectInfo(ctx, &src[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if up.ObjectSize != o.Size {
|
||||
return nil, fmt.Errorf("size mismatching should %d reality %d", up.ObjectSize, o.Size)
|
||||
}
|
||||
if up.Hash != o.Hash {
|
||||
return nil, fmt.Errorf("hash mismatching should %s reality %s", up.Hash, o.Hash)
|
||||
}
|
||||
if err := c.obj.CopyObjet(ctx, &src[0], dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
tempBucket := &obj.BucketObject{
|
||||
Bucket: c.obj.TempBucket(),
|
||||
Name: path.Join("merge", c.today(), req.PutID, c.UUID()),
|
||||
}
|
||||
defer func() { // 清理合成的文件
|
||||
if err := c.obj.DeleteObjet(ctx, tempBucket); err != nil {
|
||||
log.Printf("delete %s %s %s failed %s\n", c.obj.Name(), tempBucket.Bucket, tempBucket.Name, err)
|
||||
}
|
||||
}()
|
||||
err := c.obj.ComposeObject(ctx, src, tempBucket)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info, err := c.obj.GetObjectInfo(ctx, tempBucket)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if up.ObjectSize != info.Size {
|
||||
return nil, fmt.Errorf("size mismatch should %d reality %d", up.ObjectSize, info.Size)
|
||||
}
|
||||
if up.Hash != info.Hash {
|
||||
return nil, fmt.Errorf("hash mismatch should %s reality %s", up.Hash, info.Hash)
|
||||
}
|
||||
if err := c.obj.CopyObjet(ctx, tempBucket, dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
o := &relation.ObjectInfoModel{
|
||||
Name: up.Name,
|
||||
Hash: up.Hash,
|
||||
ExpirationTime: up.ExpirationTime,
|
||||
CreateTime: time.Now(),
|
||||
}
|
||||
h := &relation.ObjectHashModel{
|
||||
Hash: up.Hash,
|
||||
Size: up.ObjectSize,
|
||||
Engine: c.obj.Name(),
|
||||
Bucket: c.obj.DataBucket(),
|
||||
Name: c.HashName(up.Hash),
|
||||
CreateTime: time.Now(),
|
||||
}
|
||||
if err := c.hash.Create(ctx, []*relation.ObjectHashModel{h}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := c.info.SetObject(ctx, o); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := c.put.SetCompleted(ctx, up.PutID); err != nil {
|
||||
log.Printf("set uploaded %s failed %s\n", up.PutID, err)
|
||||
}
|
||||
return &third.ConfirmPutResp{
|
||||
Url: c.urlName(o.Name),
|
||||
}, nil
|
||||
}
|
183
pkg/common/db/obj/minio.go
Normal file
183
pkg/common/db/obj/minio.go
Normal file
@ -0,0 +1,183 @@
|
||||
package obj
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/s3utils"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func NewMinioClient() {
|
||||
|
||||
}
|
||||
|
||||
func NewMinioInterface() (Interface, error) {
|
||||
//client, err := minio.New("127.0.0.1:9000", &minio.Options{
|
||||
// Creds: credentials.NewStaticV4("minioadmin", "minioadmin", ""),
|
||||
// Secure: false,
|
||||
//})
|
||||
|
||||
return &minioImpl{}, nil
|
||||
}
|
||||
|
||||
type minioImpl struct {
|
||||
tempBucket string // 上传桶
|
||||
permanentBucket string // 永久桶
|
||||
clearBucket string // 自动清理桶
|
||||
urlstr string // 访问地址
|
||||
client *minio.Client
|
||||
}
|
||||
|
||||
//func (m *minioImpl) Init() error {
|
||||
// client, err := minio.New("127.0.0.1:9000", &minio.Options{
|
||||
// Creds: credentials.NewStaticV4("minioadmin", "minioadmin", ""),
|
||||
// Secure: false,
|
||||
// })
|
||||
// if err != nil {
|
||||
// return fmt.Errorf("minio client error: %w", err)
|
||||
// }
|
||||
// m.urlstr = "http://127.0.0.1:9000"
|
||||
// m.client = client
|
||||
// m.tempBucket = "temp"
|
||||
// m.permanentBucket = "permanent"
|
||||
// m.clearBucket = "clear"
|
||||
// return nil
|
||||
//}
|
||||
|
||||
func (m *minioImpl) Name() string {
|
||||
return "minio"
|
||||
}
|
||||
|
||||
func (m *minioImpl) MinFragmentSize() int64 {
|
||||
return 1024 * 1024 * 5 // 每个分片最小大小 minio.absMinPartSize
|
||||
}
|
||||
|
||||
func (m *minioImpl) MaxFragmentNum() int {
|
||||
return 1000 // 最大分片数量 minio.maxPartsCount
|
||||
}
|
||||
|
||||
func (m *minioImpl) MinExpirationTime() time.Duration {
|
||||
return time.Hour * 24
|
||||
}
|
||||
|
||||
func (m *minioImpl) AppendHeader() http.Header {
|
||||
return map[string][]string{
|
||||
"x-amz-object-append": {"true"},
|
||||
}
|
||||
}
|
||||
|
||||
func (m *minioImpl) TempBucket() string {
|
||||
return m.tempBucket
|
||||
}
|
||||
|
||||
func (m *minioImpl) DataBucket() string {
|
||||
return m.permanentBucket
|
||||
}
|
||||
|
||||
func (m *minioImpl) ClearBucket() string {
|
||||
return m.clearBucket
|
||||
}
|
||||
|
||||
func (m *minioImpl) GetURL(bucket string, name string) string {
|
||||
return fmt.Sprintf("%s/%s/%s", m.urlstr, bucket, name)
|
||||
}
|
||||
|
||||
func (m *minioImpl) PresignedPutURL(ctx context.Context, args *ApplyPutArgs) (string, error) {
|
||||
if args.Effective <= 0 {
|
||||
return "", errors.New("EffectiveTime <= 0")
|
||||
}
|
||||
_, err := m.GetObjectInfo(ctx, &BucketObject{
|
||||
Bucket: m.tempBucket,
|
||||
Name: args.Name,
|
||||
})
|
||||
if err == nil {
|
||||
return "", fmt.Errorf("minio bucket %s name %s already exists", args.Bucket, args.Name)
|
||||
} else if !m.IsNotFound(err) {
|
||||
return "", err
|
||||
}
|
||||
u, err := m.client.PresignedPutObject(ctx, m.tempBucket, args.Name, args.Effective)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("minio apply error: %w", err)
|
||||
}
|
||||
return u.String(), nil
|
||||
}
|
||||
|
||||
func (m *minioImpl) GetObjectInfo(ctx context.Context, args *BucketObject) (*ObjectInfo, error) {
|
||||
info, err := m.client.StatObject(ctx, args.Bucket, args.Name, minio.StatObjectOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ObjectInfo{
|
||||
URL: m.GetURL(args.Bucket, args.Name),
|
||||
Size: info.Size,
|
||||
Hash: info.ETag,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *minioImpl) CopyObjet(ctx context.Context, src *BucketObject, dst *BucketObject) error {
|
||||
_, err := m.client.CopyObject(ctx, minio.CopyDestOptions{
|
||||
Bucket: dst.Bucket,
|
||||
Object: dst.Name,
|
||||
}, minio.CopySrcOptions{
|
||||
Bucket: src.Bucket,
|
||||
Object: src.Name,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *minioImpl) DeleteObjet(ctx context.Context, info *BucketObject) error {
|
||||
return m.client.RemoveObject(ctx, info.Bucket, info.Name, minio.RemoveObjectOptions{})
|
||||
}
|
||||
|
||||
func (m *minioImpl) MoveObjetInfo(ctx context.Context, src *BucketObject, dst *BucketObject) error {
|
||||
if err := m.CopyObjet(ctx, src, dst); err != nil {
|
||||
return err
|
||||
}
|
||||
return m.DeleteObjet(ctx, src)
|
||||
}
|
||||
|
||||
func (m *minioImpl) ComposeObject(ctx context.Context, src []BucketObject, dst *BucketObject) error {
|
||||
destOptions := minio.CopyDestOptions{
|
||||
Bucket: dst.Bucket,
|
||||
Object: dst.Name + ".temp",
|
||||
}
|
||||
sources := make([]minio.CopySrcOptions, len(src))
|
||||
for i, s := range src {
|
||||
sources[i] = minio.CopySrcOptions{
|
||||
Bucket: s.Bucket,
|
||||
Object: s.Name,
|
||||
}
|
||||
}
|
||||
_, err := m.client.ComposeObject(ctx, destOptions, sources...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return m.MoveObjetInfo(ctx, &BucketObject{
|
||||
Bucket: destOptions.Bucket,
|
||||
Name: destOptions.Object,
|
||||
}, &BucketObject{
|
||||
Bucket: dst.Bucket,
|
||||
Name: dst.Name,
|
||||
})
|
||||
}
|
||||
|
||||
func (m *minioImpl) IsNotFound(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
switch e := err.(type) {
|
||||
case minio.ErrorResponse:
|
||||
return e.StatusCode == 404 && e.Code == "NoSuchKey"
|
||||
case *minio.ErrorResponse:
|
||||
return e.StatusCode == 404 && e.Code == "NoSuchKey"
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (m *minioImpl) CheckName(name string) error {
|
||||
return s3utils.CheckValidObjectName(name)
|
||||
}
|
58
pkg/common/db/obj/obj.go
Normal file
58
pkg/common/db/obj/obj.go
Normal file
@ -0,0 +1,58 @@
|
||||
package obj
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type BucketObject struct {
|
||||
Bucket string `json:"bucket"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ApplyPutArgs struct {
|
||||
Bucket string
|
||||
Name string
|
||||
Effective time.Duration // 申请有效时间
|
||||
Header http.Header // header
|
||||
MaxObjectSize int64
|
||||
}
|
||||
|
||||
type ObjectInfo struct {
|
||||
URL string
|
||||
Size int64
|
||||
Hash string
|
||||
Expiration time.Time
|
||||
}
|
||||
|
||||
type Interface interface {
|
||||
// Name 存储名字
|
||||
Name() string
|
||||
// MinFragmentSize 最小允许的分片大小
|
||||
MinFragmentSize() int64
|
||||
// MaxFragmentNum 最大允许的分片数量
|
||||
MaxFragmentNum() int
|
||||
// MinExpirationTime 最小过期时间
|
||||
MinExpirationTime() time.Duration
|
||||
// TempBucket 临时桶名,用于上传
|
||||
TempBucket() string
|
||||
// DataBucket 永久存储的桶名
|
||||
DataBucket() string
|
||||
// GetURL 通过桶名和对象名返回URL
|
||||
GetURL(bucket string, name string) string
|
||||
// PresignedPutURL 申请上传,返回PUT的上传地址
|
||||
PresignedPutURL(ctx context.Context, args *ApplyPutArgs) (string, error)
|
||||
// GetObjectInfo 获取对象信息
|
||||
GetObjectInfo(ctx context.Context, args *BucketObject) (*ObjectInfo, error)
|
||||
// CopyObjet 复制对象
|
||||
CopyObjet(ctx context.Context, src *BucketObject, dst *BucketObject) error
|
||||
// DeleteObjet 删除对象
|
||||
DeleteObjet(ctx context.Context, info *BucketObject) error
|
||||
// ComposeObject 合并对象
|
||||
ComposeObject(ctx context.Context, src []BucketObject, dst *BucketObject) error
|
||||
// IsNotFound 判断是不是不存在导致的错误
|
||||
IsNotFound(err error) bool
|
||||
// CheckName 检查名字是否可用
|
||||
CheckName(name string) error
|
||||
}
|
40
pkg/common/db/relation/object_hash_model.go
Normal file
40
pkg/common/db/relation/object_hash_model.go
Normal file
@ -0,0 +1,40 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func NewObjectHash(db *gorm.DB) relation.ObjectHashModelInterface {
|
||||
return &ObjectHashGorm{
|
||||
DB: db,
|
||||
}
|
||||
}
|
||||
|
||||
type ObjectHashGorm struct {
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func (o *ObjectHashGorm) NewTx(tx any) relation.ObjectHashModelInterface {
|
||||
return &ObjectHashGorm{
|
||||
DB: tx.(*gorm.DB),
|
||||
}
|
||||
}
|
||||
|
||||
func (o *ObjectHashGorm) Take(ctx context.Context, hash string, engine string) (oh *relation.ObjectHashModel, err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "hash", hash, "engine", engine, "objectHash", oh)
|
||||
}()
|
||||
oh = &relation.ObjectHashModel{}
|
||||
return oh, utils.Wrap1(o.DB.Where("hash = ? and engine = ?", hash, engine).Take(oh).Error)
|
||||
}
|
||||
|
||||
func (o *ObjectHashGorm) Create(ctx context.Context, h []*relation.ObjectHashModel) (err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "objectHash", h)
|
||||
}()
|
||||
return utils.Wrap1(o.DB.Create(h).Error)
|
||||
}
|
45
pkg/common/db/relation/object_info_model.go
Normal file
45
pkg/common/db/relation/object_info_model.go
Normal file
@ -0,0 +1,45 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func NewObjectInfo(db *gorm.DB) relation.ObjectInfoModelInterface {
|
||||
return &ObjectInfoGorm{
|
||||
DB: db,
|
||||
}
|
||||
}
|
||||
|
||||
type ObjectInfoGorm struct {
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func (o *ObjectInfoGorm) NewTx(tx any) relation.ObjectInfoModelInterface {
|
||||
return &ObjectInfoGorm{
|
||||
DB: tx.(*gorm.DB),
|
||||
}
|
||||
}
|
||||
|
||||
func (o *ObjectInfoGorm) SetObject(ctx context.Context, obj *relation.ObjectInfoModel) (err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "objectInfo", obj)
|
||||
}()
|
||||
return utils.Wrap1(o.DB.Transaction(func(tx *gorm.DB) error {
|
||||
if err := tx.Where("name = ?", obj.Name).Delete(&relation.ObjectInfoModel{}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Create(obj).Error
|
||||
}))
|
||||
}
|
||||
|
||||
func (o *ObjectInfoGorm) Take(ctx context.Context, name string) (info *relation.ObjectInfoModel, err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "name", name, "info", info)
|
||||
}()
|
||||
info = &relation.ObjectInfoModel{}
|
||||
return info, utils.Wrap1(o.DB.Where("name = ?", name).Take(info).Error)
|
||||
}
|
47
pkg/common/db/relation/object_put_model.go
Normal file
47
pkg/common/db/relation/object_put_model.go
Normal file
@ -0,0 +1,47 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/db/table/relation"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"OpenIM/pkg/utils"
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func NewObjectPut(db *gorm.DB) relation.ObjectPutModelInterface {
|
||||
return &ObjectPutGorm{
|
||||
DB: db,
|
||||
}
|
||||
}
|
||||
|
||||
type ObjectPutGorm struct {
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func (o *ObjectPutGorm) NewTx(tx any) relation.ObjectPutModelInterface {
|
||||
return &ObjectPutGorm{
|
||||
DB: tx.(*gorm.DB),
|
||||
}
|
||||
}
|
||||
|
||||
func (o *ObjectPutGorm) Create(ctx context.Context, m []*relation.ObjectPutModel) (err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "objectPut", m)
|
||||
}()
|
||||
return utils.Wrap1(o.DB.Create(m).Error)
|
||||
}
|
||||
|
||||
func (o *ObjectPutGorm) Take(ctx context.Context, putID string) (put *relation.ObjectPutModel, err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "putID", putID, "put", put)
|
||||
}()
|
||||
put = &relation.ObjectPutModel{}
|
||||
return put, utils.Wrap1(o.DB.Where("put_id = ?", putID).Take(put).Error)
|
||||
}
|
||||
|
||||
func (o *ObjectPutGorm) SetCompleted(ctx context.Context, putID string) (err error) {
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "putID", putID)
|
||||
}()
|
||||
return utils.Wrap1(o.DB.Model(&relation.ObjectPutModel{}).Where("put_id = ?", putID).Update("complete", true).Error)
|
||||
}
|
29
pkg/common/db/table/relation/object_hash.go
Normal file
29
pkg/common/db/table/relation/object_hash.go
Normal file
@ -0,0 +1,29 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ObjectHashModelTableName = "object_hash"
|
||||
)
|
||||
|
||||
type ObjectHashModel struct {
|
||||
Hash string `gorm:"column:hash;primary_key;size:32"`
|
||||
Engine string `gorm:"column:engine;primary_key;size:16"`
|
||||
Size int64 `gorm:"column:size"`
|
||||
Bucket string `gorm:"column:bucket"`
|
||||
Name string `gorm:"column:name"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (ObjectHashModel) TableName() string {
|
||||
return ObjectHashModelTableName
|
||||
}
|
||||
|
||||
type ObjectHashModelInterface interface {
|
||||
NewTx(tx any) ObjectHashModelInterface
|
||||
Take(ctx context.Context, hash string, engine string) (*ObjectHashModel, error)
|
||||
Create(ctx context.Context, h []*ObjectHashModel) error
|
||||
}
|
27
pkg/common/db/table/relation/object_info.go
Normal file
27
pkg/common/db/table/relation/object_info.go
Normal file
@ -0,0 +1,27 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ObjectInfoModelTableName = "object_info"
|
||||
)
|
||||
|
||||
type ObjectInfoModel struct {
|
||||
Name string `gorm:"column:name;primary_key"`
|
||||
Hash string `gorm:"column:hash"`
|
||||
ExpirationTime *time.Time `gorm:"column:expiration_time"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (ObjectInfoModel) TableName() string {
|
||||
return ObjectInfoModelTableName
|
||||
}
|
||||
|
||||
type ObjectInfoModelInterface interface {
|
||||
NewTx(tx any) ObjectInfoModelInterface
|
||||
SetObject(ctx context.Context, obj *ObjectInfoModel) error
|
||||
Take(ctx context.Context, name string) (*ObjectInfoModel, error)
|
||||
}
|
34
pkg/common/db/table/relation/object_put.go
Normal file
34
pkg/common/db/table/relation/object_put.go
Normal file
@ -0,0 +1,34 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ObjectPutModelTableName = "object_put"
|
||||
)
|
||||
|
||||
type ObjectPutModel struct {
|
||||
PutID string `gorm:"column:put_id;primary_key"`
|
||||
Hash string `gorm:"column:hash"`
|
||||
Path string `gorm:"column:path"`
|
||||
Name string `gorm:"column:name"`
|
||||
ObjectSize int64 `gorm:"column:object_size"`
|
||||
FragmentSize int64 `gorm:"column:fragment_size"`
|
||||
Complete bool `gorm:"column:complete"`
|
||||
ExpirationTime *time.Time `gorm:"column:expiration_time"`
|
||||
EffectiveTime time.Time `gorm:"column:effective_time"`
|
||||
CreateTime time.Time `gorm:"column:create_time"`
|
||||
}
|
||||
|
||||
func (ObjectPutModel) TableName() string {
|
||||
return ObjectPutModelTableName
|
||||
}
|
||||
|
||||
type ObjectPutModelInterface interface {
|
||||
NewTx(tx any) ObjectPutModelInterface
|
||||
Create(ctx context.Context, m []*ObjectPutModel) error
|
||||
Take(ctx context.Context, putID string) (*ObjectPutModel, error)
|
||||
SetCompleted(ctx context.Context, putID string) error
|
||||
}
|
@ -24,214 +24,384 @@ var _ = math.Inf
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type ApplySpaceReq struct {
|
||||
type ApplyPutReq struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
Size int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"`
|
||||
Hash string `protobuf:"bytes,3,opt,name=hash" json:"hash,omitempty"`
|
||||
Purpose uint32 `protobuf:"varint,4,opt,name=purpose" json:"purpose,omitempty"`
|
||||
ContentType string `protobuf:"bytes,5,opt,name=contentType" json:"contentType,omitempty"`
|
||||
FragmentSize int64 `protobuf:"varint,4,opt,name=fragmentSize" json:"fragmentSize,omitempty"`
|
||||
CleanTime int64 `protobuf:"varint,5,opt,name=cleanTime" json:"cleanTime,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ApplySpaceReq) Reset() { *m = ApplySpaceReq{} }
|
||||
func (m *ApplySpaceReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*ApplySpaceReq) ProtoMessage() {}
|
||||
func (*ApplySpaceReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{0}
|
||||
func (m *ApplyPutReq) Reset() { *m = ApplyPutReq{} }
|
||||
func (m *ApplyPutReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*ApplyPutReq) ProtoMessage() {}
|
||||
func (*ApplyPutReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{0}
|
||||
}
|
||||
func (m *ApplySpaceReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ApplySpaceReq.Unmarshal(m, b)
|
||||
func (m *ApplyPutReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ApplyPutReq.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ApplySpaceReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ApplySpaceReq.Marshal(b, m, deterministic)
|
||||
func (m *ApplyPutReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ApplyPutReq.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ApplySpaceReq) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ApplySpaceReq.Merge(dst, src)
|
||||
func (dst *ApplyPutReq) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ApplyPutReq.Merge(dst, src)
|
||||
}
|
||||
func (m *ApplySpaceReq) XXX_Size() int {
|
||||
return xxx_messageInfo_ApplySpaceReq.Size(m)
|
||||
func (m *ApplyPutReq) XXX_Size() int {
|
||||
return xxx_messageInfo_ApplyPutReq.Size(m)
|
||||
}
|
||||
func (m *ApplySpaceReq) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ApplySpaceReq.DiscardUnknown(m)
|
||||
func (m *ApplyPutReq) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ApplyPutReq.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ApplySpaceReq proto.InternalMessageInfo
|
||||
var xxx_messageInfo_ApplyPutReq proto.InternalMessageInfo
|
||||
|
||||
func (m *ApplySpaceReq) GetName() string {
|
||||
func (m *ApplyPutReq) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ApplySpaceReq) GetSize() int64 {
|
||||
func (m *ApplyPutReq) GetSize() int64 {
|
||||
if m != nil {
|
||||
return m.Size
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ApplySpaceReq) GetHash() string {
|
||||
func (m *ApplyPutReq) GetHash() string {
|
||||
if m != nil {
|
||||
return m.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ApplySpaceReq) GetPurpose() uint32 {
|
||||
func (m *ApplyPutReq) GetFragmentSize() int64 {
|
||||
if m != nil {
|
||||
return m.Purpose
|
||||
return m.FragmentSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ApplySpaceReq) GetContentType() string {
|
||||
func (m *ApplyPutReq) GetCleanTime() int64 {
|
||||
if m != nil {
|
||||
return m.ContentType
|
||||
return m.CleanTime
|
||||
}
|
||||
return ""
|
||||
return 0
|
||||
}
|
||||
|
||||
type ApplySpaceResp struct {
|
||||
type ApplyPutResp struct {
|
||||
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
|
||||
Size int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"`
|
||||
Put []string `protobuf:"bytes,3,rep,name=put" json:"put,omitempty"`
|
||||
ConfirmID string `protobuf:"bytes,4,opt,name=confirmID" json:"confirmID,omitempty"`
|
||||
PutID string `protobuf:"bytes,2,opt,name=putID" json:"putID,omitempty"`
|
||||
FragmentSize int64 `protobuf:"varint,3,opt,name=fragmentSize" json:"fragmentSize,omitempty"`
|
||||
ExpirationTime int64 `protobuf:"varint,4,opt,name=expirationTime" json:"expirationTime,omitempty"`
|
||||
PutURLs []string `protobuf:"bytes,5,rep,name=PutURLs" json:"PutURLs,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ApplySpaceResp) Reset() { *m = ApplySpaceResp{} }
|
||||
func (m *ApplySpaceResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*ApplySpaceResp) ProtoMessage() {}
|
||||
func (*ApplySpaceResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{1}
|
||||
func (m *ApplyPutResp) Reset() { *m = ApplyPutResp{} }
|
||||
func (m *ApplyPutResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*ApplyPutResp) ProtoMessage() {}
|
||||
func (*ApplyPutResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{1}
|
||||
}
|
||||
func (m *ApplySpaceResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ApplySpaceResp.Unmarshal(m, b)
|
||||
func (m *ApplyPutResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ApplyPutResp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ApplySpaceResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ApplySpaceResp.Marshal(b, m, deterministic)
|
||||
func (m *ApplyPutResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ApplyPutResp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ApplySpaceResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ApplySpaceResp.Merge(dst, src)
|
||||
func (dst *ApplyPutResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ApplyPutResp.Merge(dst, src)
|
||||
}
|
||||
func (m *ApplySpaceResp) XXX_Size() int {
|
||||
return xxx_messageInfo_ApplySpaceResp.Size(m)
|
||||
func (m *ApplyPutResp) XXX_Size() int {
|
||||
return xxx_messageInfo_ApplyPutResp.Size(m)
|
||||
}
|
||||
func (m *ApplySpaceResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ApplySpaceResp.DiscardUnknown(m)
|
||||
func (m *ApplyPutResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ApplyPutResp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ApplySpaceResp proto.InternalMessageInfo
|
||||
var xxx_messageInfo_ApplyPutResp proto.InternalMessageInfo
|
||||
|
||||
func (m *ApplySpaceResp) GetUrl() string {
|
||||
func (m *ApplyPutResp) GetUrl() string {
|
||||
if m != nil {
|
||||
return m.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ApplySpaceResp) GetSize() int64 {
|
||||
func (m *ApplyPutResp) GetPutID() string {
|
||||
if m != nil {
|
||||
return m.PutID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ApplyPutResp) GetFragmentSize() int64 {
|
||||
if m != nil {
|
||||
return m.FragmentSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ApplyPutResp) GetExpirationTime() int64 {
|
||||
if m != nil {
|
||||
return m.ExpirationTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ApplyPutResp) GetPutURLs() []string {
|
||||
if m != nil {
|
||||
return m.PutURLs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ConfirmPutReq struct {
|
||||
PutID string `protobuf:"bytes,1,opt,name=putID" json:"putID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ConfirmPutReq) Reset() { *m = ConfirmPutReq{} }
|
||||
func (m *ConfirmPutReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*ConfirmPutReq) ProtoMessage() {}
|
||||
func (*ConfirmPutReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{2}
|
||||
}
|
||||
func (m *ConfirmPutReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ConfirmPutReq.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ConfirmPutReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ConfirmPutReq.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ConfirmPutReq) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ConfirmPutReq.Merge(dst, src)
|
||||
}
|
||||
func (m *ConfirmPutReq) XXX_Size() int {
|
||||
return xxx_messageInfo_ConfirmPutReq.Size(m)
|
||||
}
|
||||
func (m *ConfirmPutReq) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ConfirmPutReq.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ConfirmPutReq proto.InternalMessageInfo
|
||||
|
||||
func (m *ConfirmPutReq) GetPutID() string {
|
||||
if m != nil {
|
||||
return m.PutID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ConfirmPutResp struct {
|
||||
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ConfirmPutResp) Reset() { *m = ConfirmPutResp{} }
|
||||
func (m *ConfirmPutResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*ConfirmPutResp) ProtoMessage() {}
|
||||
func (*ConfirmPutResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{3}
|
||||
}
|
||||
func (m *ConfirmPutResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ConfirmPutResp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ConfirmPutResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ConfirmPutResp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ConfirmPutResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ConfirmPutResp.Merge(dst, src)
|
||||
}
|
||||
func (m *ConfirmPutResp) XXX_Size() int {
|
||||
return xxx_messageInfo_ConfirmPutResp.Size(m)
|
||||
}
|
||||
func (m *ConfirmPutResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ConfirmPutResp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ConfirmPutResp proto.InternalMessageInfo
|
||||
|
||||
func (m *ConfirmPutResp) GetUrl() string {
|
||||
if m != nil {
|
||||
return m.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetPutReq struct {
|
||||
PutID string `protobuf:"bytes,1,opt,name=putID" json:"putID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetPutReq) Reset() { *m = GetPutReq{} }
|
||||
func (m *GetPutReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetPutReq) ProtoMessage() {}
|
||||
func (*GetPutReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{4}
|
||||
}
|
||||
func (m *GetPutReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetPutReq.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetPutReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetPutReq.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *GetPutReq) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetPutReq.Merge(dst, src)
|
||||
}
|
||||
func (m *GetPutReq) XXX_Size() int {
|
||||
return xxx_messageInfo_GetPutReq.Size(m)
|
||||
}
|
||||
func (m *GetPutReq) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetPutReq.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetPutReq proto.InternalMessageInfo
|
||||
|
||||
func (m *GetPutReq) GetPutID() string {
|
||||
if m != nil {
|
||||
return m.PutID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetPutFragment struct {
|
||||
Size int64 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
|
||||
Hash string `protobuf:"bytes,2,opt,name=hash" json:"hash,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetPutFragment) Reset() { *m = GetPutFragment{} }
|
||||
func (m *GetPutFragment) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetPutFragment) ProtoMessage() {}
|
||||
func (*GetPutFragment) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{5}
|
||||
}
|
||||
func (m *GetPutFragment) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetPutFragment.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetPutFragment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetPutFragment.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *GetPutFragment) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetPutFragment.Merge(dst, src)
|
||||
}
|
||||
func (m *GetPutFragment) XXX_Size() int {
|
||||
return xxx_messageInfo_GetPutFragment.Size(m)
|
||||
}
|
||||
func (m *GetPutFragment) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetPutFragment.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetPutFragment proto.InternalMessageInfo
|
||||
|
||||
func (m *GetPutFragment) GetSize() int64 {
|
||||
if m != nil {
|
||||
return m.Size
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ApplySpaceResp) GetPut() []string {
|
||||
func (m *GetPutFragment) GetHash() string {
|
||||
if m != nil {
|
||||
return m.Put
|
||||
return m.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetPutResp struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
Size int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"`
|
||||
Hash string `protobuf:"bytes,3,opt,name=hash" json:"hash,omitempty"`
|
||||
FragmentSize int64 `protobuf:"varint,4,opt,name=fragmentSize" json:"fragmentSize,omitempty"`
|
||||
CleanTime int64 `protobuf:"varint,5,opt,name=cleanTime" json:"cleanTime,omitempty"`
|
||||
Fragments []*GetPutFragment `protobuf:"bytes,6,rep,name=fragments" json:"fragments,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *GetPutResp) Reset() { *m = GetPutResp{} }
|
||||
func (m *GetPutResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetPutResp) ProtoMessage() {}
|
||||
func (*GetPutResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{6}
|
||||
}
|
||||
func (m *GetPutResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetPutResp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *GetPutResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_GetPutResp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *GetPutResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_GetPutResp.Merge(dst, src)
|
||||
}
|
||||
func (m *GetPutResp) XXX_Size() int {
|
||||
return xxx_messageInfo_GetPutResp.Size(m)
|
||||
}
|
||||
func (m *GetPutResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_GetPutResp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_GetPutResp proto.InternalMessageInfo
|
||||
|
||||
func (m *GetPutResp) GetName() string {
|
||||
if m != nil {
|
||||
return m.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *GetPutResp) GetSize() int64 {
|
||||
if m != nil {
|
||||
return m.Size
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *GetPutResp) GetHash() string {
|
||||
if m != nil {
|
||||
return m.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *GetPutResp) GetFragmentSize() int64 {
|
||||
if m != nil {
|
||||
return m.FragmentSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *GetPutResp) GetCleanTime() int64 {
|
||||
if m != nil {
|
||||
return m.CleanTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *GetPutResp) GetFragments() []*GetPutFragment {
|
||||
if m != nil {
|
||||
return m.Fragments
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ApplySpaceResp) GetConfirmID() string {
|
||||
if m != nil {
|
||||
return m.ConfirmID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ConfirmSpaceReq struct {
|
||||
ConfirmID string `protobuf:"bytes,1,opt,name=confirmID" json:"confirmID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ConfirmSpaceReq) Reset() { *m = ConfirmSpaceReq{} }
|
||||
func (m *ConfirmSpaceReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*ConfirmSpaceReq) ProtoMessage() {}
|
||||
func (*ConfirmSpaceReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{2}
|
||||
}
|
||||
func (m *ConfirmSpaceReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ConfirmSpaceReq.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ConfirmSpaceReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ConfirmSpaceReq.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ConfirmSpaceReq) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ConfirmSpaceReq.Merge(dst, src)
|
||||
}
|
||||
func (m *ConfirmSpaceReq) XXX_Size() int {
|
||||
return xxx_messageInfo_ConfirmSpaceReq.Size(m)
|
||||
}
|
||||
func (m *ConfirmSpaceReq) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ConfirmSpaceReq.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ConfirmSpaceReq proto.InternalMessageInfo
|
||||
|
||||
func (m *ConfirmSpaceReq) GetConfirmID() string {
|
||||
if m != nil {
|
||||
return m.ConfirmID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ConfirmSpaceResp struct {
|
||||
ConfirmID string `protobuf:"bytes,1,opt,name=confirmID" json:"confirmID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ConfirmSpaceResp) Reset() { *m = ConfirmSpaceResp{} }
|
||||
func (m *ConfirmSpaceResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*ConfirmSpaceResp) ProtoMessage() {}
|
||||
func (*ConfirmSpaceResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{3}
|
||||
}
|
||||
func (m *ConfirmSpaceResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ConfirmSpaceResp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ConfirmSpaceResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ConfirmSpaceResp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ConfirmSpaceResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ConfirmSpaceResp.Merge(dst, src)
|
||||
}
|
||||
func (m *ConfirmSpaceResp) XXX_Size() int {
|
||||
return xxx_messageInfo_ConfirmSpaceResp.Size(m)
|
||||
}
|
||||
func (m *ConfirmSpaceResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ConfirmSpaceResp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ConfirmSpaceResp proto.InternalMessageInfo
|
||||
|
||||
func (m *ConfirmSpaceResp) GetConfirmID() string {
|
||||
if m != nil {
|
||||
return m.ConfirmID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetSignalInvitationInfoReq struct {
|
||||
ClientMsgID string `protobuf:"bytes,1,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
@ -243,7 +413,7 @@ func (m *GetSignalInvitationInfoReq) Reset() { *m = GetSignalInvitationI
|
||||
func (m *GetSignalInvitationInfoReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetSignalInvitationInfoReq) ProtoMessage() {}
|
||||
func (*GetSignalInvitationInfoReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{4}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{7}
|
||||
}
|
||||
func (m *GetSignalInvitationInfoReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetSignalInvitationInfoReq.Unmarshal(m, b)
|
||||
@ -282,7 +452,7 @@ func (m *GetSignalInvitationInfoResp) Reset() { *m = GetSignalInvitation
|
||||
func (m *GetSignalInvitationInfoResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetSignalInvitationInfoResp) ProtoMessage() {}
|
||||
func (*GetSignalInvitationInfoResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{5}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{8}
|
||||
}
|
||||
func (m *GetSignalInvitationInfoResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetSignalInvitationInfoResp.Unmarshal(m, b)
|
||||
@ -327,7 +497,7 @@ func (m *GetSignalInvitationInfoStartAppReq) Reset() { *m = GetSignalInv
|
||||
func (m *GetSignalInvitationInfoStartAppReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetSignalInvitationInfoStartAppReq) ProtoMessage() {}
|
||||
func (*GetSignalInvitationInfoStartAppReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{6}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{9}
|
||||
}
|
||||
func (m *GetSignalInvitationInfoStartAppReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetSignalInvitationInfoStartAppReq.Unmarshal(m, b)
|
||||
@ -366,7 +536,7 @@ func (m *GetSignalInvitationInfoStartAppResp) Reset() { *m = GetSignalIn
|
||||
func (m *GetSignalInvitationInfoStartAppResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetSignalInvitationInfoStartAppResp) ProtoMessage() {}
|
||||
func (*GetSignalInvitationInfoStartAppResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{7}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{10}
|
||||
}
|
||||
func (m *GetSignalInvitationInfoStartAppResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetSignalInvitationInfoStartAppResp.Unmarshal(m, b)
|
||||
@ -414,7 +584,7 @@ func (m *FcmUpdateTokenReq) Reset() { *m = FcmUpdateTokenReq{} }
|
||||
func (m *FcmUpdateTokenReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*FcmUpdateTokenReq) ProtoMessage() {}
|
||||
func (*FcmUpdateTokenReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{8}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{11}
|
||||
}
|
||||
func (m *FcmUpdateTokenReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FcmUpdateTokenReq.Unmarshal(m, b)
|
||||
@ -472,7 +642,7 @@ func (m *FcmUpdateTokenResp) Reset() { *m = FcmUpdateTokenResp{} }
|
||||
func (m *FcmUpdateTokenResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*FcmUpdateTokenResp) ProtoMessage() {}
|
||||
func (*FcmUpdateTokenResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{9}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{12}
|
||||
}
|
||||
func (m *FcmUpdateTokenResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FcmUpdateTokenResp.Unmarshal(m, b)
|
||||
@ -504,7 +674,7 @@ func (m *SetAppBadgeReq) Reset() { *m = SetAppBadgeReq{} }
|
||||
func (m *SetAppBadgeReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetAppBadgeReq) ProtoMessage() {}
|
||||
func (*SetAppBadgeReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{10}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{13}
|
||||
}
|
||||
func (m *SetAppBadgeReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SetAppBadgeReq.Unmarshal(m, b)
|
||||
@ -548,7 +718,7 @@ func (m *SetAppBadgeResp) Reset() { *m = SetAppBadgeResp{} }
|
||||
func (m *SetAppBadgeResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*SetAppBadgeResp) ProtoMessage() {}
|
||||
func (*SetAppBadgeResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_third_de04cb9a0062d654, []int{11}
|
||||
return fileDescriptor_third_1a03a4b056d14713, []int{14}
|
||||
}
|
||||
func (m *SetAppBadgeResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SetAppBadgeResp.Unmarshal(m, b)
|
||||
@ -569,10 +739,13 @@ func (m *SetAppBadgeResp) XXX_DiscardUnknown() {
|
||||
var xxx_messageInfo_SetAppBadgeResp proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ApplySpaceReq)(nil), "third.ApplySpaceReq")
|
||||
proto.RegisterType((*ApplySpaceResp)(nil), "third.ApplySpaceResp")
|
||||
proto.RegisterType((*ConfirmSpaceReq)(nil), "third.ConfirmSpaceReq")
|
||||
proto.RegisterType((*ConfirmSpaceResp)(nil), "third.ConfirmSpaceResp")
|
||||
proto.RegisterType((*ApplyPutReq)(nil), "third.ApplyPutReq")
|
||||
proto.RegisterType((*ApplyPutResp)(nil), "third.ApplyPutResp")
|
||||
proto.RegisterType((*ConfirmPutReq)(nil), "third.ConfirmPutReq")
|
||||
proto.RegisterType((*ConfirmPutResp)(nil), "third.ConfirmPutResp")
|
||||
proto.RegisterType((*GetPutReq)(nil), "third.GetPutReq")
|
||||
proto.RegisterType((*GetPutFragment)(nil), "third.GetPutFragment")
|
||||
proto.RegisterType((*GetPutResp)(nil), "third.GetPutResp")
|
||||
proto.RegisterType((*GetSignalInvitationInfoReq)(nil), "third.GetSignalInvitationInfoReq")
|
||||
proto.RegisterType((*GetSignalInvitationInfoResp)(nil), "third.GetSignalInvitationInfoResp")
|
||||
proto.RegisterType((*GetSignalInvitationInfoStartAppReq)(nil), "third.GetSignalInvitationInfoStartAppReq")
|
||||
@ -594,7 +767,9 @@ const _ = grpc.SupportPackageIsVersion4
|
||||
// Client API for Third service
|
||||
|
||||
type ThirdClient interface {
|
||||
ApplySpace(ctx context.Context, in *ApplySpaceReq, opts ...grpc.CallOption) (*ApplySpaceResp, error)
|
||||
ApplyPut(ctx context.Context, in *ApplyPutReq, opts ...grpc.CallOption) (*ApplyPutResp, error)
|
||||
GetPut(ctx context.Context, in *GetPutReq, opts ...grpc.CallOption) (*GetPutResp, error)
|
||||
ConfirmPut(ctx context.Context, in *ConfirmPutReq, opts ...grpc.CallOption) (*ConfirmPutResp, error)
|
||||
GetSignalInvitationInfo(ctx context.Context, in *GetSignalInvitationInfoReq, opts ...grpc.CallOption) (*GetSignalInvitationInfoResp, error)
|
||||
GetSignalInvitationInfoStartApp(ctx context.Context, in *GetSignalInvitationInfoStartAppReq, opts ...grpc.CallOption) (*GetSignalInvitationInfoStartAppResp, error)
|
||||
FcmUpdateToken(ctx context.Context, in *FcmUpdateTokenReq, opts ...grpc.CallOption) (*FcmUpdateTokenResp, error)
|
||||
@ -609,9 +784,27 @@ func NewThirdClient(cc *grpc.ClientConn) ThirdClient {
|
||||
return &thirdClient{cc}
|
||||
}
|
||||
|
||||
func (c *thirdClient) ApplySpace(ctx context.Context, in *ApplySpaceReq, opts ...grpc.CallOption) (*ApplySpaceResp, error) {
|
||||
out := new(ApplySpaceResp)
|
||||
err := grpc.Invoke(ctx, "/third.third/ApplySpace", in, out, c.cc, opts...)
|
||||
func (c *thirdClient) ApplyPut(ctx context.Context, in *ApplyPutReq, opts ...grpc.CallOption) (*ApplyPutResp, error) {
|
||||
out := new(ApplyPutResp)
|
||||
err := grpc.Invoke(ctx, "/third.third/ApplyPut", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *thirdClient) GetPut(ctx context.Context, in *GetPutReq, opts ...grpc.CallOption) (*GetPutResp, error) {
|
||||
out := new(GetPutResp)
|
||||
err := grpc.Invoke(ctx, "/third.third/GetPut", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *thirdClient) ConfirmPut(ctx context.Context, in *ConfirmPutReq, opts ...grpc.CallOption) (*ConfirmPutResp, error) {
|
||||
out := new(ConfirmPutResp)
|
||||
err := grpc.Invoke(ctx, "/third.third/ConfirmPut", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -657,7 +850,9 @@ func (c *thirdClient) SetAppBadge(ctx context.Context, in *SetAppBadgeReq, opts
|
||||
// Server API for Third service
|
||||
|
||||
type ThirdServer interface {
|
||||
ApplySpace(context.Context, *ApplySpaceReq) (*ApplySpaceResp, error)
|
||||
ApplyPut(context.Context, *ApplyPutReq) (*ApplyPutResp, error)
|
||||
GetPut(context.Context, *GetPutReq) (*GetPutResp, error)
|
||||
ConfirmPut(context.Context, *ConfirmPutReq) (*ConfirmPutResp, error)
|
||||
GetSignalInvitationInfo(context.Context, *GetSignalInvitationInfoReq) (*GetSignalInvitationInfoResp, error)
|
||||
GetSignalInvitationInfoStartApp(context.Context, *GetSignalInvitationInfoStartAppReq) (*GetSignalInvitationInfoStartAppResp, error)
|
||||
FcmUpdateToken(context.Context, *FcmUpdateTokenReq) (*FcmUpdateTokenResp, error)
|
||||
@ -668,20 +863,56 @@ func RegisterThirdServer(s *grpc.Server, srv ThirdServer) {
|
||||
s.RegisterService(&_Third_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Third_ApplySpace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApplySpaceReq)
|
||||
func _Third_ApplyPut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ApplyPutReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ThirdServer).ApplySpace(ctx, in)
|
||||
return srv.(ThirdServer).ApplyPut(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/third.third/ApplySpace",
|
||||
FullMethod: "/third.third/ApplyPut",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ThirdServer).ApplySpace(ctx, req.(*ApplySpaceReq))
|
||||
return srv.(ThirdServer).ApplyPut(ctx, req.(*ApplyPutReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Third_GetPut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetPutReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ThirdServer).GetPut(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/third.third/GetPut",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ThirdServer).GetPut(ctx, req.(*GetPutReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Third_ConfirmPut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ConfirmPutReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ThirdServer).ConfirmPut(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/third.third/ConfirmPut",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ThirdServer).ConfirmPut(ctx, req.(*ConfirmPutReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@ -763,8 +994,16 @@ var _Third_serviceDesc = grpc.ServiceDesc{
|
||||
HandlerType: (*ThirdServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ApplySpace",
|
||||
Handler: _Third_ApplySpace_Handler,
|
||||
MethodName: "ApplyPut",
|
||||
Handler: _Third_ApplyPut_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPut",
|
||||
Handler: _Third_GetPut_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ConfirmPut",
|
||||
Handler: _Third_ConfirmPut_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSignalInvitationInfo",
|
||||
@ -787,46 +1026,53 @@ var _Third_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "third/third.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("third/third.proto", fileDescriptor_third_de04cb9a0062d654) }
|
||||
func init() { proto.RegisterFile("third/third.proto", fileDescriptor_third_1a03a4b056d14713) }
|
||||
|
||||
var fileDescriptor_third_de04cb9a0062d654 = []byte{
|
||||
// 608 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0x96, 0xeb, 0xb6, 0x90, 0x89, 0x9a, 0xb6, 0xab, 0xb6, 0x18, 0x53, 0x15, 0x63, 0x24, 0x28,
|
||||
0x48, 0x8d, 0x51, 0x39, 0x21, 0x0a, 0xa2, 0x2d, 0x14, 0xe5, 0x50, 0x35, 0x72, 0xd2, 0x0b, 0x27,
|
||||
0x8c, 0xb3, 0x4e, 0xac, 0x38, 0xeb, 0xc1, 0xbb, 0xee, 0x0f, 0x2f, 0x80, 0x78, 0x09, 0x2e, 0x48,
|
||||
0x3c, 0x27, 0xda, 0xb5, 0x93, 0xda, 0x26, 0x69, 0x38, 0x72, 0xb1, 0x76, 0x3e, 0x7f, 0xdf, 0xec,
|
||||
0xfc, 0xec, 0x0c, 0xac, 0x8b, 0x41, 0x98, 0xf4, 0x1c, 0xf5, 0x6d, 0x62, 0x12, 0x8b, 0x98, 0x2c,
|
||||
0x29, 0xc3, 0x7c, 0x7a, 0x86, 0x94, 0xed, 0xb5, 0x4e, 0xf7, 0x3a, 0x34, 0xb9, 0xa0, 0x89, 0x83,
|
||||
0xc3, 0xbe, 0xa3, 0x08, 0x0e, 0xef, 0x0d, 0x2f, 0xb9, 0x73, 0xc9, 0x33, 0xbe, 0xfd, 0x5d, 0x83,
|
||||
0x95, 0x43, 0xc4, 0xe8, 0xba, 0x83, 0x9e, 0x4f, 0x5d, 0xfa, 0x95, 0x10, 0x58, 0x64, 0xde, 0x88,
|
||||
0x1a, 0x9a, 0xa5, 0xed, 0xd6, 0x5c, 0x75, 0x96, 0x18, 0x0f, 0xbf, 0x51, 0x63, 0xc1, 0xd2, 0x76,
|
||||
0x75, 0x57, 0x9d, 0x25, 0x36, 0xf0, 0xf8, 0xc0, 0xd0, 0x33, 0x9e, 0x3c, 0x13, 0x03, 0xee, 0x60,
|
||||
0x9a, 0x60, 0xcc, 0xa9, 0xb1, 0x68, 0x69, 0xbb, 0x2b, 0xee, 0xd8, 0x24, 0x16, 0xd4, 0xfd, 0x98,
|
||||
0x09, 0xca, 0x44, 0xf7, 0x1a, 0xa9, 0xb1, 0xa4, 0x44, 0x45, 0xc8, 0x0e, 0xa0, 0x51, 0x0c, 0x84,
|
||||
0x23, 0x59, 0x03, 0x3d, 0x4d, 0xa2, 0x3c, 0x10, 0x79, 0x9c, 0x1a, 0xc7, 0x1a, 0xe8, 0x98, 0x0a,
|
||||
0x43, 0xb7, 0x74, 0xc9, 0xc2, 0x54, 0x90, 0x6d, 0xa8, 0xf9, 0x31, 0x0b, 0xc2, 0x64, 0xd4, 0x7a,
|
||||
0xaf, 0xe2, 0xa8, 0xb9, 0x37, 0x80, 0xed, 0xc0, 0xea, 0x71, 0x66, 0x4c, 0x52, 0x2e, 0x09, 0xb4,
|
||||
0xaa, 0xe0, 0x05, 0xac, 0x95, 0x05, 0x1c, 0xe7, 0x28, 0xde, 0x82, 0xf9, 0x91, 0x8a, 0x4e, 0xd8,
|
||||
0x67, 0x5e, 0xd4, 0x62, 0x17, 0xa1, 0xf0, 0x44, 0x18, 0xb3, 0x16, 0x0b, 0x62, 0x79, 0x9b, 0x05,
|
||||
0xf5, 0xe3, 0x28, 0xa4, 0x4c, 0x9c, 0xf2, 0xfe, 0x44, 0x5d, 0x84, 0xec, 0x9f, 0x1a, 0x3c, 0x98,
|
||||
0xe9, 0x80, 0x23, 0x79, 0x03, 0x8d, 0xb0, 0x84, 0x2a, 0x27, 0xf5, 0xfd, 0xcd, 0xa6, 0xea, 0x6e,
|
||||
0xb3, 0x22, 0xa9, 0x90, 0xc9, 0x3b, 0x58, 0x8d, 0x83, 0x20, 0x0a, 0x19, 0x6d, 0xa7, 0x7c, 0xa0,
|
||||
0xf4, 0x0b, 0x4a, 0xbf, 0x95, 0xeb, 0xcf, 0xca, 0x7f, 0xdd, 0x2a, 0xdd, 0x3e, 0x00, 0x7b, 0x46,
|
||||
0x7c, 0x1d, 0xe1, 0x25, 0xe2, 0x10, 0x51, 0x26, 0xba, 0x05, 0xcb, 0x29, 0xa7, 0xc9, 0x24, 0xc7,
|
||||
0xdc, 0xb2, 0x7f, 0x6b, 0xf0, 0x78, 0xae, 0xfc, 0x7f, 0x48, 0xf3, 0x87, 0x06, 0xeb, 0x27, 0xfe,
|
||||
0xe8, 0x1c, 0x7b, 0x9e, 0xa0, 0xdd, 0x78, 0x48, 0x99, 0x4c, 0x6b, 0x07, 0xa0, 0x1d, 0x79, 0x22,
|
||||
0x88, 0x27, 0xcd, 0x5f, 0x72, 0x0b, 0x08, 0x31, 0xe1, 0xee, 0x89, 0x3f, 0x52, 0x74, 0x75, 0x61,
|
||||
0xcd, 0x9d, 0xd8, 0x72, 0x40, 0x3c, 0xdf, 0x8f, 0x53, 0x26, 0xf2, 0xb9, 0x19, 0x9b, 0xd2, 0x2b,
|
||||
0xbd, 0xc2, 0x30, 0xa1, 0xdd, 0x70, 0x94, 0x4d, 0x8f, 0xee, 0x16, 0x10, 0x7b, 0x03, 0x48, 0x35,
|
||||
0x14, 0x8e, 0x76, 0x1b, 0x1a, 0x1d, 0x2a, 0x0b, 0x76, 0xe4, 0xf5, 0xfa, 0xf4, 0x96, 0xa2, 0x93,
|
||||
0x27, 0x6a, 0xbc, 0xce, 0x59, 0x42, 0xbd, 0xde, 0xb1, 0x0a, 0x60, 0x41, 0x45, 0x5e, 0x41, 0xed,
|
||||
0x75, 0x58, 0x2d, 0x79, 0xe4, 0xb8, 0xff, 0x4b, 0x87, 0x6c, 0xad, 0x90, 0x57, 0x00, 0x37, 0x33,
|
||||
0x4a, 0x36, 0x9a, 0xd9, 0xe6, 0x29, 0xed, 0x0f, 0x73, 0x73, 0x0a, 0xca, 0x91, 0x7c, 0x86, 0x7b,
|
||||
0x33, 0x7a, 0x4e, 0x1e, 0xe5, 0x8a, 0xd9, 0x33, 0x63, 0xda, 0xf3, 0x28, 0x1c, 0xc9, 0x15, 0x3c,
|
||||
0x9c, 0xf3, 0xaa, 0xc8, 0xb3, 0xdb, 0xdd, 0x14, 0x1e, 0xaf, 0xf9, 0xfc, 0x5f, 0xa9, 0x1c, 0xc9,
|
||||
0x07, 0x68, 0x94, 0x7b, 0x43, 0x8c, 0x5c, 0xfd, 0xd7, 0xeb, 0x31, 0xef, 0xcf, 0xf8, 0xc3, 0x91,
|
||||
0x1c, 0x40, 0xbd, 0x50, 0x7a, 0x32, 0x2e, 0x64, 0xb9, 0xc1, 0xe6, 0xd6, 0x34, 0x98, 0xe3, 0xd1,
|
||||
0xce, 0xa7, 0x6d, 0xb9, 0xf4, 0x5b, 0xa7, 0x85, 0x65, 0xaf, 0x98, 0xaf, 0xd5, 0xf7, 0xcb, 0xb2,
|
||||
0x82, 0x5e, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x74, 0xd3, 0xa9, 0xeb, 0x35, 0x06, 0x00, 0x00,
|
||||
var fileDescriptor_third_1a03a4b056d14713 = []byte{
|
||||
// 712 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xdd, 0x4e, 0x13, 0x4f,
|
||||
0x14, 0xcf, 0xb6, 0xb4, 0x7f, 0x7a, 0xca, 0xbf, 0xd0, 0x23, 0xe0, 0xba, 0x12, 0x2c, 0x63, 0xd4,
|
||||
0x6a, 0x02, 0x4d, 0xe0, 0x46, 0x23, 0x1a, 0x01, 0x85, 0x34, 0x91, 0xd0, 0x6c, 0xe1, 0xc6, 0x2b,
|
||||
0xd7, 0x76, 0xda, 0x6e, 0xd8, 0x8f, 0x71, 0x67, 0x16, 0xd0, 0x17, 0x30, 0xc6, 0x57, 0x30, 0x5e,
|
||||
0xfa, 0x1a, 0xbe, 0x9a, 0x99, 0xd9, 0x6d, 0xbb, 0xbb, 0xb4, 0xd4, 0x3b, 0xbd, 0xd9, 0xcc, 0xf9,
|
||||
0xed, 0xef, 0x9c, 0x39, 0xdf, 0x03, 0x55, 0x31, 0xb0, 0x83, 0x6e, 0x43, 0x7d, 0xb7, 0x58, 0xe0,
|
||||
0x0b, 0x1f, 0x0b, 0x4a, 0x30, 0x1e, 0x9d, 0x30, 0xea, 0x6d, 0x36, 0x8f, 0x37, 0xdb, 0x34, 0xb8,
|
||||
0xa0, 0x41, 0x83, 0x9d, 0xf7, 0x1b, 0x8a, 0xd0, 0xe0, 0xdd, 0xf3, 0x4b, 0xde, 0xb8, 0xe4, 0x11,
|
||||
0x9f, 0x7c, 0xd3, 0xa0, 0xbc, 0xc7, 0x98, 0xf3, 0xa9, 0x15, 0x0a, 0x93, 0x7e, 0x44, 0x84, 0x39,
|
||||
0xcf, 0x72, 0xa9, 0xae, 0xd5, 0xb4, 0x7a, 0xc9, 0x54, 0x67, 0x89, 0x71, 0xfb, 0x33, 0xd5, 0x73,
|
||||
0x35, 0xad, 0x9e, 0x37, 0xd5, 0x59, 0x62, 0x03, 0x8b, 0x0f, 0xf4, 0x7c, 0xc4, 0x93, 0x67, 0x24,
|
||||
0xb0, 0xd0, 0x0b, 0xac, 0xbe, 0x4b, 0x3d, 0xd1, 0x96, 0xfc, 0x39, 0xc5, 0x4f, 0x61, 0xb8, 0x06,
|
||||
0xa5, 0x8e, 0x43, 0x2d, 0xef, 0xd4, 0x76, 0xa9, 0x5e, 0x50, 0x84, 0x31, 0x40, 0xbe, 0x6b, 0xb0,
|
||||
0x30, 0xf6, 0x86, 0x33, 0x5c, 0x82, 0x7c, 0x18, 0x38, 0xb1, 0x37, 0xf2, 0x88, 0xcb, 0x50, 0x60,
|
||||
0xa1, 0x68, 0xbe, 0x56, 0xde, 0x94, 0xcc, 0x48, 0xb8, 0x76, 0x75, 0x7e, 0xc2, 0xd5, 0x0f, 0xa1,
|
||||
0x42, 0xaf, 0x98, 0x1d, 0x58, 0xc2, 0xf6, 0xa3, 0xfb, 0x23, 0x07, 0x33, 0x28, 0xea, 0xf0, 0x5f,
|
||||
0x2b, 0x14, 0x67, 0xe6, 0x5b, 0xae, 0x17, 0x6a, 0xf9, 0x7a, 0xc9, 0x1c, 0x8a, 0xe4, 0x01, 0xfc,
|
||||
0x7f, 0xe0, 0x7b, 0x3d, 0x3b, 0x70, 0xe3, 0x6c, 0x8d, 0x9c, 0xd1, 0x12, 0xce, 0x10, 0x02, 0x95,
|
||||
0x24, 0x6d, 0x52, 0x18, 0x64, 0x03, 0x4a, 0x47, 0x54, 0xdc, 0x68, 0xe6, 0x29, 0x54, 0x22, 0xca,
|
||||
0x61, 0x1c, 0xc5, 0xa8, 0x10, 0xda, 0x84, 0x42, 0xe4, 0xc6, 0x85, 0x20, 0xbf, 0x34, 0x80, 0xa1,
|
||||
0x75, 0xce, 0xfe, 0x6e, 0x4d, 0x71, 0x07, 0x4a, 0x43, 0x36, 0xd7, 0x8b, 0xb5, 0x7c, 0xbd, 0xbc,
|
||||
0xbd, 0xb2, 0x15, 0xb5, 0x6c, 0x3a, 0x3c, 0x73, 0xcc, 0x23, 0x2f, 0xc1, 0x38, 0xa2, 0xa2, 0x6d,
|
||||
0xf7, 0x3d, 0xcb, 0x69, 0x7a, 0x17, 0xb6, 0x50, 0xe5, 0x69, 0x7a, 0x3d, 0x5f, 0xe6, 0xab, 0x06,
|
||||
0xe5, 0x03, 0xc7, 0xa6, 0x9e, 0x38, 0xe6, 0xfd, 0x51, 0xd6, 0x92, 0x10, 0xf9, 0xa1, 0xc1, 0xdd,
|
||||
0xa9, 0x06, 0x38, 0xc3, 0x17, 0x50, 0xb1, 0x53, 0xa8, 0x32, 0x22, 0x3d, 0x53, 0xf3, 0xb1, 0x95,
|
||||
0x51, 0xc9, 0x90, 0xf1, 0x15, 0x2c, 0xfa, 0xbd, 0x9e, 0x63, 0x7b, 0xb4, 0x15, 0xf2, 0x81, 0xd2,
|
||||
0xcf, 0x29, 0xfd, 0xd5, 0x58, 0xff, 0x24, 0xfd, 0xd7, 0xcc, 0xd2, 0xc9, 0x2e, 0x90, 0x29, 0xfe,
|
||||
0xb5, 0x85, 0x15, 0x88, 0x3d, 0xc6, 0x64, 0xa0, 0xab, 0x50, 0x0c, 0x39, 0x0d, 0x46, 0x31, 0xc6,
|
||||
0x12, 0xf9, 0xa9, 0xc1, 0xfd, 0x99, 0xea, 0xff, 0x42, 0x98, 0x5f, 0x35, 0xa8, 0x1e, 0x76, 0xdc,
|
||||
0x33, 0xd6, 0xb5, 0x04, 0x3d, 0xf5, 0xcf, 0xa9, 0x27, 0xc3, 0x5a, 0x07, 0x68, 0x39, 0x96, 0xe8,
|
||||
0xf9, 0x81, 0x1b, 0x87, 0x56, 0x30, 0x13, 0x08, 0x1a, 0x30, 0x7f, 0xd8, 0x71, 0x15, 0x3d, 0xee,
|
||||
0xeb, 0x91, 0x2c, 0xa7, 0xd3, 0xea, 0x74, 0xfc, 0xd0, 0x13, 0x71, 0x9f, 0x0e, 0x45, 0x69, 0x55,
|
||||
0x4d, 0x32, 0x4d, 0xcc, 0x76, 0x02, 0x21, 0xcb, 0x80, 0x59, 0x57, 0x38, 0x23, 0x2d, 0xa8, 0xb4,
|
||||
0xa9, 0x4c, 0xd8, 0xbe, 0xd5, 0xed, 0xd3, 0x1b, 0x92, 0x2e, 0xf7, 0xc7, 0x1e, 0x63, 0x67, 0x5e,
|
||||
0x40, 0xad, 0xee, 0x81, 0x72, 0x20, 0xa7, 0x3c, 0xcf, 0xa0, 0xa4, 0x0a, 0x8b, 0x29, 0x8b, 0x9c,
|
||||
0x6d, 0x7f, 0x99, 0x83, 0x68, 0x31, 0xe3, 0x0e, 0xcc, 0x0f, 0x17, 0x1c, 0x62, 0x3c, 0x06, 0x89,
|
||||
0xfd, 0x6b, 0xdc, 0xba, 0x86, 0x71, 0x86, 0x9b, 0x50, 0x8c, 0x46, 0x05, 0x97, 0x52, 0x93, 0x23,
|
||||
0x15, 0xaa, 0x19, 0x84, 0x33, 0x7c, 0x06, 0x30, 0xde, 0x3f, 0xb8, 0x1c, 0x13, 0x52, 0x9b, 0xcb,
|
||||
0x58, 0x99, 0x80, 0x72, 0x86, 0xef, 0xe1, 0xf6, 0x94, 0xbe, 0xc2, 0x8d, 0xf1, 0x45, 0x53, 0xe6,
|
||||
0xd2, 0x20, 0xb3, 0x28, 0x9c, 0xe1, 0x15, 0xdc, 0x9b, 0xd1, 0xb9, 0xf8, 0xf8, 0x66, 0x33, 0x89,
|
||||
0x01, 0x31, 0x9e, 0xfc, 0x29, 0x95, 0x33, 0x7c, 0x03, 0x95, 0x74, 0xfd, 0x51, 0x8f, 0xb5, 0xaf,
|
||||
0x75, 0xa8, 0x71, 0x67, 0xca, 0x1f, 0xce, 0x70, 0x17, 0xca, 0x89, 0xf2, 0xe2, 0x30, 0x91, 0xe9,
|
||||
0x26, 0x32, 0x56, 0x27, 0xc1, 0x9c, 0xed, 0xaf, 0xbf, 0x5b, 0x93, 0x4f, 0x73, 0xf3, 0x38, 0xf1,
|
||||
0x24, 0x2b, 0xe6, 0x73, 0xf5, 0xfd, 0x50, 0x54, 0xd0, 0xce, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
0xda, 0x49, 0x1e, 0x93, 0xdb, 0x07, 0x00, 0x00,
|
||||
}
|
||||
|
@ -3,28 +3,46 @@ import "Open-IM-Server/pkg/proto/sdkws/ws.proto";
|
||||
option go_package = "OpenIM/pkg/proto/third;third";
|
||||
package third;
|
||||
|
||||
|
||||
message ApplySpaceReq {
|
||||
string name = 1; // 文件名字
|
||||
int64 size = 2; // 大小
|
||||
string hash = 3; // md5
|
||||
uint32 purpose = 4; // 用途
|
||||
string contentType = 5;
|
||||
message ApplyPutReq {
|
||||
string name = 1;
|
||||
int64 size = 2;
|
||||
string hash = 3;
|
||||
int64 fragmentSize = 4;
|
||||
int64 cleanTime = 5;
|
||||
}
|
||||
|
||||
message ApplySpaceResp {
|
||||
string url = 1; // 不为空表示已存在
|
||||
int64 size = 2; // 分片大小
|
||||
repeated string put = 3;// put地址
|
||||
string confirmID = 4; // 确认ID
|
||||
message ApplyPutResp {
|
||||
string url = 1;
|
||||
string putID = 2;
|
||||
int64 fragmentSize = 3;
|
||||
// int64 expirationTime = 4;
|
||||
repeated string PutURLs = 5;
|
||||
}
|
||||
|
||||
message ConfirmSpaceReq {
|
||||
string confirmID = 1; // 确认ID
|
||||
message ConfirmPutReq {
|
||||
string putID = 1;
|
||||
}
|
||||
|
||||
message ConfirmSpaceResp {
|
||||
string confirmID = 1;
|
||||
message ConfirmPutResp {
|
||||
string url = 1;
|
||||
}
|
||||
|
||||
message GetPutReq {
|
||||
string putID = 1;
|
||||
}
|
||||
|
||||
message GetPutFragment{
|
||||
int64 size = 1;
|
||||
string hash = 2;
|
||||
}
|
||||
|
||||
message GetPutResp {
|
||||
string name = 1;
|
||||
int64 size = 2;
|
||||
string hash = 3;
|
||||
int64 fragmentSize = 4;
|
||||
int64 cleanTime = 5;
|
||||
repeated GetPutFragment fragments = 6;
|
||||
}
|
||||
|
||||
message GetSignalInvitationInfoReq {
|
||||
@ -32,8 +50,8 @@ message GetSignalInvitationInfoReq {
|
||||
}
|
||||
|
||||
message GetSignalInvitationInfoResp {
|
||||
sdkws.InvitationInfo invitationInfo = 1;
|
||||
sdkws.OfflinePushInfo offlinePushInfo = 2;
|
||||
sdkws.InvitationInfo invitationInfo = 1;
|
||||
sdkws.OfflinePushInfo offlinePushInfo = 2;
|
||||
}
|
||||
|
||||
message GetSignalInvitationInfoStartAppReq {
|
||||
@ -41,15 +59,15 @@ message GetSignalInvitationInfoStartAppReq {
|
||||
}
|
||||
|
||||
message GetSignalInvitationInfoStartAppResp {
|
||||
sdkws.InvitationInfo invitationInfo = 1;
|
||||
sdkws.OfflinePushInfo offlinePushInfo = 2;
|
||||
sdkws.InvitationInfo invitationInfo = 1;
|
||||
sdkws.OfflinePushInfo offlinePushInfo = 2;
|
||||
}
|
||||
|
||||
message FcmUpdateTokenReq {
|
||||
int32 PlatformID = 1;
|
||||
string FcmToken = 2;
|
||||
string account = 3;
|
||||
int64 expireTime = 4;
|
||||
int32 PlatformID = 1;
|
||||
string FcmToken = 2;
|
||||
string account = 3;
|
||||
int64 expireTime = 4;
|
||||
}
|
||||
|
||||
message FcmUpdateTokenResp {
|
||||
@ -64,7 +82,10 @@ message SetAppBadgeResp {
|
||||
}
|
||||
|
||||
service third {
|
||||
rpc ApplySpace(ApplySpaceReq) returns(ApplySpaceResp);
|
||||
rpc ApplyPut(ApplyPutReq) returns(ApplyPutResp);
|
||||
rpc GetPut(GetPutReq) returns(GetPutResp);
|
||||
rpc ConfirmPut(ConfirmPutReq) returns(ConfirmPutResp);
|
||||
|
||||
rpc GetSignalInvitationInfo(GetSignalInvitationInfoReq) returns(GetSignalInvitationInfoResp);
|
||||
rpc GetSignalInvitationInfoStartApp(GetSignalInvitationInfoStartAppReq) returns(GetSignalInvitationInfoStartAppResp);
|
||||
rpc FcmUpdateToken(FcmUpdateTokenReq) returns(FcmUpdateTokenResp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user