service

package
v0.0.0-...-63a9e4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginMethod        = "Login"
	RefreshTokenMethod = "RefreshToken"
)

Variables

View Source
var (
	// allow 500 messages buffered in UsersNeedNotified queue.
	UsersNeedNotified = make(chan *NotifiedUsers, 500)
)

Functions

func BuildEchoHandlerFunc

func BuildEchoHandlerFunc(bi *BuildInf) echo.HandlerFunc

service.BuildEchoHandlerFunc() 使用对照表建立 restful 路由。 客户端的 restful 请求通过这些路由,执行对应的后端接口,并将结果返回给客户端。 部分地实现了 grpc-restful 的通用转换。

向后端接口的调用,使用 scheduler.Invoke() 异步地进行。 异步调用被 scheduler 内部的负载均衡器按照配置指定的算法进行调度。

func DecodeBaseResult

func DecodeBaseResult(r *v10.Result, ret proto.Message) (err error)

func Init

func Init(callback func(bi *BuildInf)) (ready bool)

func RefreshUserHash

func RefreshUserHash(uid uint64, did string, token string)

func RemoveUserHash

func RemoveUserHash(uid uint64, did string, token string)

Types

type BuildInf

type BuildInf struct {
	Entry string

	FuncName string // grpc 调用函数名
	// contains filtered or unexported fields
}

func (*BuildInf) Result

func (s *BuildInf) Result() proto.Message

type FwdrFunc

type FwdrFunc func(ctx context.Context, in proto.Message) (res proto.Message, err error)

func BuildFwdr

func BuildFwdr(bi *BuildInf) FwdrFunc

service.BuildFwdr() 为 grpc.Init() 所调用。

ImCoreService 籍此建立转发器对照表,并将对 vx-core 的调用转换为到后端接口的调用,然后返回相应的结果。

向后端接口的调用,使用 scheduler.Invoke() 异步地进行。 异步调用被 scheduler 内部的负载均衡器按照配置指定的算法进行调度。

type Hooker

type Hooker interface {
	OnMessageSaveDone(ret proto.Message)
}

type NotifiedUsers

type NotifiedUsers struct {
	ConversationId      uint64
	ConversationSection uint32
	MsgId               uint64
	Users               []uint64
	TS                  int64
	SortNum             uint64
}

func MakeNotifiedUsers

func MakeNotifiedUsers(rr *v10.SaveMessageResponse) (ret *NotifiedUsers)

MakeNotifiedUsers prepares a NotifiedUsers structure from storage.SaveMessageResponse{}

func MakeNotifiedUsersFromNotifyMessage

func MakeNotifiedUsersFromNotifyMessage(uid uint64, nm *v10.NotifyMessage) (ret *NotifiedUsers)

func MakeNotifiedUsersFromTalkingPush

func MakeNotifiedUsersFromTalkingPush(uid uint64, tp *v10.TalkingPush) (ret *NotifiedUsers)

type PostFunctions

type PostFunctions struct{}

func PF

func PF() *PostFunctions

func (*PostFunctions) OnLoginOk

func (s *PostFunctions) OnLoginOk(ret *v10.UserInfoToken)

func (*PostFunctions) OnLoginV11Ok

func (s *PostFunctions) OnLoginV11Ok(ret *v10.AuthReply)

func (*PostFunctions) OnRefreshTokenOk

func (s *PostFunctions) OnRefreshTokenOk(ret *v10.UserInfoToken)

func (*PostFunctions) OnRefreshTokenV11Ok

func (s *PostFunctions) OnRefreshTokenV11Ok(ret *v10.AuthReply)

func (*PostFunctions) OnRegisterV11Ok

func (s *PostFunctions) OnRegisterV11Ok(ret *v10.AuthReply)

func (*PostFunctions) OnX

func (s *PostFunctions) OnX(ret proto.Message)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL