rpc

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RpcMap sync.Map

Functions

func Cleanup added in v1.0.1

func Cleanup()

func RpcGo added in v1.0.2

func RpcGo(addrs string, servicePath, serviceMethod string, args interface{}, reply interface{}) error

Asynchronous rpc calling

func RpcInvoke

func RpcInvoke(addrs string, servicePath, serviceMethod string, args interface{}, reply interface{}) error

Synchronized rpc calling

Types

type Args

type Args struct {
	Session Session
	MsgId   int
	MsgReq  interface{}
}

func (*Args) GetObject

func (a *Args) GetObject(t interface{}) error

type ArgsGroup

type ArgsGroup struct {
	Sids    []int64
	Route   string
	Payload []byte
}

Group message request

type Call

type Call struct {
	Session     *Session
	MsgId       int
	ServicePath string
	ServiceName string
	MsgReq      interface{}
	MsgResp     interface{}
	Done        interface{}
}

type CustomerRoute added in v1.0.1

type CustomerRoute func(session *Session, servicePath, serviceName string) (string, error)

Route msg to the specified node

type HandlerRegister

type HandlerRegister interface {
	GetRemoteAddrs() string
	RegisterHandler(rcvr interface{}, metadata string) error
	RegisterName(name string, rcvr interface{}, metadata string) error
}

register msg handler as service

type Reply

type Reply struct {
	Code    int
	ErrMsg  string
	MsgResp interface{}
}

type ReplyGroup

type ReplyGroup struct {
}

Group message response

type RpcResponder

type RpcResponder interface {
	Cb(session *Session, msgId int, msg interface{})
}

proxy return msg to agent

type RpcRouter

type RpcRouter interface {
	Go(call *Call)
}

agent route msg to proxy

type Session

type Session struct {
	NodeAddr  string
	SessionId int64

	UserId int64

	Settings map[string]string
	// contains filtered or unexported fields
}

func NewSession

func NewSession(nodeAddr string) *Session

func (*Session) Bind

func (s *Session) Bind(userId int64)

func (*Session) Clone

func (s *Session) Clone() *Session

func (*Session) Close

func (s *Session) Close(reason string)

func (*Session) Get

func (s *Session) Get(key string) string

func (*Session) GetSessionId

func (s *Session) GetSessionId() int64

func (*Session) GetUserId

func (s *Session) GetUserId() int64

func (*Session) Push

func (s *Session) Push()

synchronize setting with frontend session

func (*Session) Remove

func (s *Session) Remove(key string)

func (*Session) Set

func (s *Session) Set(key, value string)

func (*Session) SetUserId

func (s *Session) SetUserId(userId int64)

func (*Session) SyncSettings

func (s *Session) SyncSettings(settings map[string]interface{})

func (*Session) UnBind

func (s *Session) UnBind()

Jump to

Keyboard shortcuts

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