pull/218/head
wangchuxiao 3 years ago
parent 7e44f7f110
commit 8f07f8e9e1

@ -10,7 +10,7 @@ func main() {
rpcPort := flag.Int("port", 10600, "RpcToken default listen port 10800")
flag.Parse()
fmt.Println("start auth rpc server, port: ", *rpcPort)
rpcServer := rpcCache.NewOfficeServer(*rpcPort)
rpcServer := rpcCache.NewCacheServer(*rpcPort)
rpcServer.Run()
}

@ -8,6 +8,7 @@ import (
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
cacheRpc "Open_IM/pkg/proto/cache"
pbRelay "Open_IM/pkg/proto/relay"
open_im_sdk "Open_IM/pkg/proto/sdk_ws"
rpc "Open_IM/pkg/proto/user"
@ -18,7 +19,6 @@ import (
"strings"
)
//todo
func GetUsersInfoFromCache(c *gin.Context) {
params := api.GetUsersInfoReq{}
if err := c.BindJSON(&params); err != nil {
@ -26,34 +26,100 @@ func GetUsersInfoFromCache(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()})
return
}
req := &rpc.GetUserInfoReq{}
utils.CopyStructFields(req, &params)
getUserInfoReq := &rpc.GetUserInfoReq{}
getUserInfoReq.OperationID = params.OperationID
var ok bool
ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
ok, getUserInfoReq.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), getUserInfoReq.OperationID)
if !ok {
log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
log.NewError(getUserInfoReq.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token"))
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"})
return
}
log.NewInfo(params.OperationID, "GetUserInfo args ", req.String())
log.NewInfo(params.OperationID, "GetUserInfo args ", getUserInfoReq.String())
reqCacheGetUserInfo := &cacheRpc.GetUserInfoReq{}
utils.CopyStructFields(reqCacheGetUserInfo, &params)
var userInfoList []*open_im_sdk.UserInfo
var publicUserInfoList []*open_im_sdk.PublicUserInfo
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
cacheClient := cacheRpc.NewCacheClient(etcdConn)
cacheResp, err := cacheClient.GetUserInfo(context.Background(), reqCacheGetUserInfo)
if err != nil {
log.NewError(getUserInfoReq.OperationID, utils.GetSelfFuncName(), "GetUserInfo failed", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed: " + err.Error()})
return
}
if cacheResp.CommonResp.ErrCode != 0 {
log.NewError(getUserInfoReq.OperationID, utils.GetSelfFuncName(), "GetUserInfo failed", cacheResp.CommonResp)
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}}
resp.Data = []map[string]interface{}{}
log.NewInfo(getUserInfoReq.OperationID, "GetUserInfo api return ", resp)
c.JSON(http.StatusOK, resp)
return
}
log.NewInfo(getUserInfoReq.OperationID, utils.GetSelfFuncName(), "cacheResp:", cacheResp.String())
userInfoList = cacheResp.UserInfoList
var needCacheUserIDList []string
for _, userID := range reqCacheGetUserInfo.UserIDList {
isGetUserInfoFromCache := false
for _, cacheUser := range userInfoList {
if cacheUser.UserID == userID {
isGetUserInfoFromCache = true
}
}
if !isGetUserInfoFromCache {
needCacheUserIDList = append(needCacheUserIDList, userID)
}
}
if len(needCacheUserIDList) == 0 {
log.NewInfo(getUserInfoReq.OperationID, utils.GetSelfFuncName(), "get all userInfo from cache success")
for _, v := range userInfoList {
publicUserInfoList = append(publicUserInfoList,
&open_im_sdk.PublicUserInfo{UserID: v.UserID, Nickname: v.Nickname, FaceURL: v.FaceURL, Gender: v.Gender, Ex: v.Ex})
}
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}, UserInfoList: publicUserInfoList}
resp.Data = jsonData.JsonDataList(resp.UserInfoList)
log.NewInfo(getUserInfoReq.OperationID, "GetUserInfo api return ", resp)
c.JSON(http.StatusOK, resp)
return
}
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
log.NewDebug(getUserInfoReq.OperationID, utils.GetSelfFuncName(), "need cache user list", needCacheUserIDList)
getUserInfoReq.UserIDList = needCacheUserIDList
etcdConn = getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
client := rpc.NewUserClient(etcdConn)
RpcResp, err := client.GetUserInfo(context.Background(), req)
rpcResp, err := client.GetUserInfo(context.Background(), getUserInfoReq)
if err != nil {
log.NewError(req.OperationID, "GetUserInfo failed ", err.Error(), req.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"})
log.NewError(getUserInfoReq.OperationID, "GetUserInfo failed ", err.Error(), getUserInfoReq.String())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed" + err.Error()})
return
}
var publicUserInfoList []*open_im_sdk.PublicUserInfo
for _, v := range RpcResp.UserInfoList {
if rpcResp.CommonResp.ErrCode != 0 {
log.NewError(getUserInfoReq.OperationID, utils.GetSelfFuncName(), "GetUserInfo failed", cacheResp.CommonResp)
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: cacheResp.CommonResp.ErrCode, ErrMsg: cacheResp.CommonResp.ErrMsg}}
resp.Data = []map[string]interface{}{}
log.NewInfo(getUserInfoReq.OperationID, "GetUserInfo api return ", resp)
c.JSON(http.StatusOK, resp)
return
}
userInfoList = append(userInfoList, rpcResp.UserInfoList...)
cacheUpdateUserInfoReq := &cacheRpc.UpdateUserInfoReq{
UserInfoList: rpcResp.UserInfoList,
OperationID: getUserInfoReq.OperationID,
}
_, err = cacheClient.UpdateUserInfo(context.Background(), cacheUpdateUserInfoReq)
if err != nil {
log.NewError(getUserInfoReq.OperationID, "GetUserInfo failed ", err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed:" + err.Error()})
return
}
userInfoList = rpcResp.UserInfoList
for _, v := range userInfoList {
publicUserInfoList = append(publicUserInfoList,
&open_im_sdk.PublicUserInfo{UserID: v.UserID, Nickname: v.Nickname, FaceURL: v.FaceURL, Gender: v.Gender, Ex: v.Ex})
}
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfoList: publicUserInfoList}
resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: rpcResp.CommonResp.ErrCode, ErrMsg: rpcResp.CommonResp.ErrMsg}, UserInfoList: publicUserInfoList}
resp.Data = jsonData.JsonDataList(resp.UserInfoList)
log.NewInfo(req.OperationID, "GetUserInfo api return ", resp)
log.NewInfo(getUserInfoReq.OperationID, "GetUserInfo api return ", resp)
c.JSON(http.StatusOK, resp)
}

@ -23,11 +23,11 @@ type cacheServer struct {
etcdAddr []string
}
func NewOfficeServer(port int) *cacheServer {
func NewCacheServer(port int) *cacheServer {
log.NewPrivateLog(constant.LogFileName)
return &cacheServer{
rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfficeName,
rpcRegisterName: config.Config.RpcRegisterName.OpenImCacheName,
etcdSchema: config.Config.Etcd.EtcdSchema,
etcdAddr: config.Config.Etcd.EtcdAddr,
}
@ -95,9 +95,18 @@ func (s *cacheServer) UpdateUserInfo(_ context.Context, req *pbCache.UpdateUserI
return resp, nil
}
func (s *cacheServer) UpdateAllUserToCache(_ context.Context, req *pbCache.UpdateAllUserToCacheReq) (resp *pbCache.UpdateAllUserToCacheResp, err error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
resp = &pbCache.UpdateAllUserToCacheResp{CommonResp: &pbCache.CommonResp{}}
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
return resp, nil
func (s *cacheServer) GetBlackList(_ context.Context, req *pbCache.GetBlackListReq) (resp *pbCache.GetBlackListResp, err error) {
return nil, nil
}
func (s *cacheServer) UpdateBlackList(_ context.Context, req *pbCache.UpdateBlackListReq) (resp *pbCache.UpdateBlackListResp, err error) {
return nil, nil
}
func (s *cacheServer) GetFriendInfo(_ context.Context, req *pbCache.GetFriendInfoReq) (resp *pbCache.GetFriendInfoResp, err error) {
return nil, nil
}
func (s *cacheServer) UpdateFriendInfo(_ context.Context, req *pbCache.UpdateFriendInfoReq) (resp *pbCache.UpdateFriendInfoResp, err error) {
return nil, nil
}

@ -1,501 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: cache/cache.proto
package cache // import "./cache"
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import sdk_ws "Open_IM/pkg/proto/sdk_ws"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type CommonResp struct {
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CommonResp) Reset() { *m = CommonResp{} }
func (m *CommonResp) String() string { return proto.CompactTextString(m) }
func (*CommonResp) ProtoMessage() {}
func (*CommonResp) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{0}
}
func (m *CommonResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommonResp.Unmarshal(m, b)
}
func (m *CommonResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CommonResp.Marshal(b, m, deterministic)
}
func (dst *CommonResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_CommonResp.Merge(dst, src)
}
func (m *CommonResp) XXX_Size() int {
return xxx_messageInfo_CommonResp.Size(m)
}
func (m *CommonResp) XXX_DiscardUnknown() {
xxx_messageInfo_CommonResp.DiscardUnknown(m)
}
var xxx_messageInfo_CommonResp proto.InternalMessageInfo
func (m *CommonResp) GetErrCode() int32 {
if m != nil {
return m.ErrCode
}
return 0
}
func (m *CommonResp) GetErrMsg() string {
if m != nil {
return m.ErrMsg
}
return ""
}
type GetUserInfoReq struct {
UserIDList []string `protobuf:"bytes,1,rep,name=userIDList" json:"userIDList,omitempty"`
OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUserInfoReq) Reset() { *m = GetUserInfoReq{} }
func (m *GetUserInfoReq) String() string { return proto.CompactTextString(m) }
func (*GetUserInfoReq) ProtoMessage() {}
func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{1}
}
func (m *GetUserInfoReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserInfoReq.Unmarshal(m, b)
}
func (m *GetUserInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetUserInfoReq.Marshal(b, m, deterministic)
}
func (dst *GetUserInfoReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetUserInfoReq.Merge(dst, src)
}
func (m *GetUserInfoReq) XXX_Size() int {
return xxx_messageInfo_GetUserInfoReq.Size(m)
}
func (m *GetUserInfoReq) XXX_DiscardUnknown() {
xxx_messageInfo_GetUserInfoReq.DiscardUnknown(m)
}
var xxx_messageInfo_GetUserInfoReq proto.InternalMessageInfo
func (m *GetUserInfoReq) GetUserIDList() []string {
if m != nil {
return m.UserIDList
}
return nil
}
func (m *GetUserInfoReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
type GetUserInfoResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"`
UserInfoList []*sdk_ws.UserInfo `protobuf:"bytes,2,rep,name=UserInfoList" json:"UserInfoList,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetUserInfoResp) Reset() { *m = GetUserInfoResp{} }
func (m *GetUserInfoResp) String() string { return proto.CompactTextString(m) }
func (*GetUserInfoResp) ProtoMessage() {}
func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{2}
}
func (m *GetUserInfoResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetUserInfoResp.Unmarshal(m, b)
}
func (m *GetUserInfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetUserInfoResp.Marshal(b, m, deterministic)
}
func (dst *GetUserInfoResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetUserInfoResp.Merge(dst, src)
}
func (m *GetUserInfoResp) XXX_Size() int {
return xxx_messageInfo_GetUserInfoResp.Size(m)
}
func (m *GetUserInfoResp) XXX_DiscardUnknown() {
xxx_messageInfo_GetUserInfoResp.DiscardUnknown(m)
}
var xxx_messageInfo_GetUserInfoResp proto.InternalMessageInfo
func (m *GetUserInfoResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
func (m *GetUserInfoResp) GetUserInfoList() []*sdk_ws.UserInfo {
if m != nil {
return m.UserInfoList
}
return nil
}
type UpdateUserInfoReq struct {
UserInfoList []*sdk_ws.UserInfo `protobuf:"bytes,1,rep,name=UserInfoList" json:"UserInfoList,omitempty"`
OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateUserInfoReq) Reset() { *m = UpdateUserInfoReq{} }
func (m *UpdateUserInfoReq) String() string { return proto.CompactTextString(m) }
func (*UpdateUserInfoReq) ProtoMessage() {}
func (*UpdateUserInfoReq) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{3}
}
func (m *UpdateUserInfoReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateUserInfoReq.Unmarshal(m, b)
}
func (m *UpdateUserInfoReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateUserInfoReq.Marshal(b, m, deterministic)
}
func (dst *UpdateUserInfoReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateUserInfoReq.Merge(dst, src)
}
func (m *UpdateUserInfoReq) XXX_Size() int {
return xxx_messageInfo_UpdateUserInfoReq.Size(m)
}
func (m *UpdateUserInfoReq) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateUserInfoReq.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateUserInfoReq proto.InternalMessageInfo
func (m *UpdateUserInfoReq) GetUserInfoList() []*sdk_ws.UserInfo {
if m != nil {
return m.UserInfoList
}
return nil
}
func (m *UpdateUserInfoReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
type UpdateUserInfoResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateUserInfoResp) Reset() { *m = UpdateUserInfoResp{} }
func (m *UpdateUserInfoResp) String() string { return proto.CompactTextString(m) }
func (*UpdateUserInfoResp) ProtoMessage() {}
func (*UpdateUserInfoResp) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{4}
}
func (m *UpdateUserInfoResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateUserInfoResp.Unmarshal(m, b)
}
func (m *UpdateUserInfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateUserInfoResp.Marshal(b, m, deterministic)
}
func (dst *UpdateUserInfoResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateUserInfoResp.Merge(dst, src)
}
func (m *UpdateUserInfoResp) XXX_Size() int {
return xxx_messageInfo_UpdateUserInfoResp.Size(m)
}
func (m *UpdateUserInfoResp) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateUserInfoResp.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateUserInfoResp proto.InternalMessageInfo
func (m *UpdateUserInfoResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
type UpdateAllUserToCacheReq struct {
OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateAllUserToCacheReq) Reset() { *m = UpdateAllUserToCacheReq{} }
func (m *UpdateAllUserToCacheReq) String() string { return proto.CompactTextString(m) }
func (*UpdateAllUserToCacheReq) ProtoMessage() {}
func (*UpdateAllUserToCacheReq) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{5}
}
func (m *UpdateAllUserToCacheReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateAllUserToCacheReq.Unmarshal(m, b)
}
func (m *UpdateAllUserToCacheReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateAllUserToCacheReq.Marshal(b, m, deterministic)
}
func (dst *UpdateAllUserToCacheReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateAllUserToCacheReq.Merge(dst, src)
}
func (m *UpdateAllUserToCacheReq) XXX_Size() int {
return xxx_messageInfo_UpdateAllUserToCacheReq.Size(m)
}
func (m *UpdateAllUserToCacheReq) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateAllUserToCacheReq.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateAllUserToCacheReq proto.InternalMessageInfo
func (m *UpdateAllUserToCacheReq) GetOperationID() string {
if m != nil {
return m.OperationID
}
return ""
}
type UpdateAllUserToCacheResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateAllUserToCacheResp) Reset() { *m = UpdateAllUserToCacheResp{} }
func (m *UpdateAllUserToCacheResp) String() string { return proto.CompactTextString(m) }
func (*UpdateAllUserToCacheResp) ProtoMessage() {}
func (*UpdateAllUserToCacheResp) Descriptor() ([]byte, []int) {
return fileDescriptor_cache_613af94c3da056d4, []int{6}
}
func (m *UpdateAllUserToCacheResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateAllUserToCacheResp.Unmarshal(m, b)
}
func (m *UpdateAllUserToCacheResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateAllUserToCacheResp.Marshal(b, m, deterministic)
}
func (dst *UpdateAllUserToCacheResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateAllUserToCacheResp.Merge(dst, src)
}
func (m *UpdateAllUserToCacheResp) XXX_Size() int {
return xxx_messageInfo_UpdateAllUserToCacheResp.Size(m)
}
func (m *UpdateAllUserToCacheResp) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateAllUserToCacheResp.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateAllUserToCacheResp proto.InternalMessageInfo
func (m *UpdateAllUserToCacheResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
func init() {
proto.RegisterType((*CommonResp)(nil), "cache.CommonResp")
proto.RegisterType((*GetUserInfoReq)(nil), "cache.GetUserInfoReq")
proto.RegisterType((*GetUserInfoResp)(nil), "cache.GetUserInfoResp")
proto.RegisterType((*UpdateUserInfoReq)(nil), "cache.UpdateUserInfoReq")
proto.RegisterType((*UpdateUserInfoResp)(nil), "cache.UpdateUserInfoResp")
proto.RegisterType((*UpdateAllUserToCacheReq)(nil), "cache.UpdateAllUserToCacheReq")
proto.RegisterType((*UpdateAllUserToCacheResp)(nil), "cache.UpdateAllUserToCacheResp")
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for Cache service
type CacheClient interface {
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error)
UpdateAllUserToCache(ctx context.Context, in *UpdateAllUserToCacheReq, opts ...grpc.CallOption) (*UpdateAllUserToCacheResp, error)
}
type cacheClient struct {
cc *grpc.ClientConn
}
func NewCacheClient(cc *grpc.ClientConn) CacheClient {
return &cacheClient{cc}
}
func (c *cacheClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) {
out := new(GetUserInfoResp)
err := grpc.Invoke(ctx, "/cache.cache/GetUserInfo", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cacheClient) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error) {
out := new(UpdateUserInfoResp)
err := grpc.Invoke(ctx, "/cache.cache/UpdateUserInfo", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cacheClient) UpdateAllUserToCache(ctx context.Context, in *UpdateAllUserToCacheReq, opts ...grpc.CallOption) (*UpdateAllUserToCacheResp, error) {
out := new(UpdateAllUserToCacheResp)
err := grpc.Invoke(ctx, "/cache.cache/UpdateAllUserToCache", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Cache service
type CacheServer interface {
GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error)
UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*UpdateUserInfoResp, error)
UpdateAllUserToCache(context.Context, *UpdateAllUserToCacheReq) (*UpdateAllUserToCacheResp, error)
}
func RegisterCacheServer(s *grpc.Server, srv CacheServer) {
s.RegisterService(&_Cache_serviceDesc, srv)
}
func _Cache_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserInfoReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServer).GetUserInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cache.cache/GetUserInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServer).GetUserInfo(ctx, req.(*GetUserInfoReq))
}
return interceptor(ctx, in, info, handler)
}
func _Cache_UpdateUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateUserInfoReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServer).UpdateUserInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cache.cache/UpdateUserInfo",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServer).UpdateUserInfo(ctx, req.(*UpdateUserInfoReq))
}
return interceptor(ctx, in, info, handler)
}
func _Cache_UpdateAllUserToCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateAllUserToCacheReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServer).UpdateAllUserToCache(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cache.cache/UpdateAllUserToCache",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServer).UpdateAllUserToCache(ctx, req.(*UpdateAllUserToCacheReq))
}
return interceptor(ctx, in, info, handler)
}
var _Cache_serviceDesc = grpc.ServiceDesc{
ServiceName: "cache.cache",
HandlerType: (*CacheServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetUserInfo",
Handler: _Cache_GetUserInfo_Handler,
},
{
MethodName: "UpdateUserInfo",
Handler: _Cache_UpdateUserInfo_Handler,
},
{
MethodName: "UpdateAllUserToCache",
Handler: _Cache_UpdateAllUserToCache_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cache/cache.proto",
}
func init() { proto.RegisterFile("cache/cache.proto", fileDescriptor_cache_613af94c3da056d4) }
var fileDescriptor_cache_613af94c3da056d4 = []byte{
// 383 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x5d, 0x4f, 0xe2, 0x40,
0x14, 0xcd, 0x40, 0x60, 0xc3, 0xed, 0x2e, 0x84, 0xc9, 0x2e, 0x5b, 0x6b, 0x82, 0xb5, 0x4f, 0x7d,
0x6a, 0x23, 0x3e, 0x62, 0x34, 0x0a, 0x86, 0x90, 0x48, 0x4c, 0x26, 0x12, 0x13, 0x5f, 0x9a, 0x0a,
0x23, 0x12, 0xa0, 0x33, 0xce, 0x54, 0xf8, 0x05, 0xfe, 0x54, 0xff, 0x87, 0xe9, 0x14, 0xb0, 0x1f,
0x68, 0x22, 0x2f, 0x93, 0xdc, 0x8f, 0x73, 0xe6, 0x9c, 0x3b, 0x73, 0xa1, 0x3e, 0xf2, 0x47, 0xcf,
0xd4, 0x55, 0xa7, 0xc3, 0x05, 0x0b, 0x19, 0x2e, 0xa9, 0xc0, 0x38, 0xbe, 0xe5, 0x34, 0xf0, 0xfa,
0x03, 0x97, 0xcf, 0x26, 0xae, 0xaa, 0xb8, 0x72, 0x3c, 0xf3, 0x56, 0xd2, 0x5d, 0xc9, 0xb8, 0xd3,
0x3a, 0x07, 0xe8, 0xb0, 0xc5, 0x82, 0x05, 0x84, 0x4a, 0x8e, 0x75, 0xf8, 0x45, 0x85, 0xe8, 0xb0,
0x31, 0xd5, 0x91, 0x89, 0xec, 0x12, 0xd9, 0x84, 0xb8, 0x01, 0x65, 0x2a, 0xc4, 0x40, 0x4e, 0xf4,
0x82, 0x89, 0xec, 0x0a, 0x59, 0x47, 0x16, 0x81, 0x6a, 0x8f, 0x86, 0x43, 0x49, 0x45, 0x3f, 0x78,
0x62, 0x84, 0xbe, 0xe0, 0x26, 0xc0, 0x6b, 0x14, 0x76, 0x6f, 0xa6, 0x32, 0xd4, 0x91, 0x59, 0xb4,
0x2b, 0x24, 0x91, 0xc1, 0x26, 0x68, 0x8c, 0x53, 0xe1, 0x87, 0x53, 0x16, 0xf4, 0xbb, 0x7a, 0x51,
0xd1, 0x25, 0x53, 0xd6, 0x1b, 0x82, 0x5a, 0x8a, 0x54, 0x72, 0x7c, 0x02, 0x30, 0xda, 0xea, 0x54,
0xe2, 0xb4, 0x56, 0xdd, 0x89, 0x3d, 0x7f, 0x1a, 0x20, 0x89, 0x26, 0x7c, 0x01, 0xbf, 0x37, 0x14,
0x4a, 0x4a, 0xc1, 0x2c, 0xda, 0x5a, 0xeb, 0xd0, 0x91, 0x54, 0x2c, 0xa9, 0xf0, 0x7c, 0x3e, 0xf5,
0xb8, 0x2f, 0xfc, 0x85, 0x74, 0xb6, 0x37, 0xa5, 0x00, 0xd6, 0x12, 0xea, 0x43, 0x3e, 0xf6, 0x43,
0x9a, 0xb4, 0x97, 0x65, 0x45, 0x3f, 0x64, 0xcd, 0xfa, 0x2f, 0xe4, 0xfd, 0xf7, 0x00, 0x67, 0xef,
0xdd, 0x6b, 0x02, 0x56, 0x1b, 0xfe, 0xc7, 0x44, 0x97, 0xf3, 0x79, 0xc4, 0x75, 0xc7, 0x3a, 0x51,
0x7b, 0x64, 0x23, 0xa3, 0x02, 0xe5, 0x55, 0x0c, 0x40, 0xdf, 0x0d, 0xde, 0x4b, 0x4b, 0xeb, 0x1d,
0x41, 0xfc, 0x2b, 0xf1, 0x19, 0x68, 0x89, 0xd7, 0xc5, 0xff, 0xd6, 0xb8, 0xf4, 0x37, 0x32, 0x1a,
0xbb, 0xd2, 0x92, 0xe3, 0x6b, 0xa8, 0xa6, 0x87, 0x83, 0xf5, 0x75, 0x67, 0xee, 0xad, 0x8c, 0x83,
0x2f, 0x2a, 0x92, 0xe3, 0x7b, 0xf8, 0xbb, 0xcb, 0x1d, 0x6e, 0xa6, 0x20, 0xb9, 0xb9, 0x19, 0x47,
0xdf, 0xd6, 0x25, 0xbf, 0xaa, 0x3d, 0xfc, 0x71, 0xe2, 0x5d, 0x6c, 0xab, 0xf3, 0xb1, 0xac, 0x16,
0xed, 0xf4, 0x23, 0x00, 0x00, 0xff, 0xff, 0x14, 0x24, 0x83, 0x9c, 0xa7, 0x03, 0x00, 0x00,
}

@ -28,13 +28,32 @@ message UpdateUserInfoResp{
CommonResp commonResp = 1;
}
message GetFriendInfoReq {
string userID = 1;
string operationID = 2;
}
message GetFriendInfoResp {
repeated server_api_params.FriendInfo friendInfoList = 1;
CommonResp commonResp = 2;
}
message UpdateBlackListReq {
repeated server_api_params.BlackInfo blackList = 1;
string operationID = 2;
}
message UpdateBlackListResp {
CommonResp commonResp = 1;
}
message GetBlackListReq {
string userID = 1;
string operationID = 2;
}
message GetBlackListResp {
repeated server_api_params.BlackInfo blackList = 1;
}
@ -52,7 +71,8 @@ service cache{
rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp);
rpc GetFriendInfo(GetFriendInfoReq) returns(GetFriendInfoResp);
rpc UpdateFriendInfo(UpdateFriendInfoReq) returns(UpdateFriendInfoResp);
rpc
rpc UpdateBlackList(UpdateBlackListReq) returns(UpdateBlackListResp);
rpc GetBlackList(GetBlackListReq) returns(GetBlackListResp);
}

Loading…
Cancel
Save