defaultrpc

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientClose      string = "client close"
	DeadlineExceeded string = "deadline exceeded"
)

Variables

This section is empty.

Functions

func NewRPCClient

func NewRPCClient(app module.App, session module.ServerSession) (mqRPC.RPCClient, error)

func NewRPCServer

func NewRPCServer(app module.App, module module.Module) (mqRPC.RPCServer, error)

Types

type ClinetCallInfo

type ClinetCallInfo struct {
	// contains filtered or unexported fields
}

type NatsClient

type NatsClient struct {
	// contains filtered or unexported fields
}

func NewNatsClient

func NewNatsClient(app module.App, session module.ServerSession) (client *NatsClient, err error)

func (*NatsClient) Call

func (c *NatsClient) Call(callInfo mqrpc.CallInfo, callback chan rpcPB.ResultInfo) error

消息請求

func (*NatsClient) CallNR

func (c *NatsClient) CallNR(callInfo mqrpc.CallInfo) error

消息請求 不需要回覆

func (*NatsClient) CloseFch

func (c *NatsClient) CloseFch(fch chan rpcPB.ResultInfo)

func (*NatsClient) Delete

func (c *NatsClient) Delete(key string) (err error)

func (*NatsClient) Done

func (c *NatsClient) Done() (err error)

func (*NatsClient) Marshal

func (c *NatsClient) Marshal(rpcInfo *rpcPB.RPCInfo) ([]byte, error)

goroutine safe

func (*NatsClient) Unmarshal

func (c *NatsClient) Unmarshal(data []byte) (*rpcPB.RPCInfo, error)

func (*NatsClient) UnmarshalResult

func (c *NatsClient) UnmarshalResult(data []byte) (*rpcPB.ResultInfo, error)

保存解碼後的數據,Value可以為任意數據類型

type NatsServer

type NatsServer struct {
	// contains filtered or unexported fields
}

func NewNatsServer

func NewNatsServer(app module.App, s *RPCServer) (*NatsServer, error)

func (*NatsServer) Addr

func (s *NatsServer) Addr() string

取得Nats節點地址

func (*NatsServer) Callback

func (s *NatsServer) Callback(callinfo mqrpc.CallInfo) error

回傳函數

func (*NatsServer) MarshalResult

func (s *NatsServer) MarshalResult(resultInfo rpcPB.ResultInfo) ([]byte, error)

goroutine safe

func (*NatsServer) Shutdown

func (s *NatsServer) Shutdown() (err error)

註銷消息隊列

func (*NatsServer) Unmarshal

func (s *NatsServer) Unmarshal(data []byte) (*rpcPB.RPCInfo, error)

保存解碼後的數據,Value可以為任意數據類型

type RPCClient

type RPCClient struct {
	// contains filtered or unexported fields
}

func (*RPCClient) Call

func (c *RPCClient) Call(ctx context.Context, rpcInvokeResult *mqRPC.ResultInvokeST) (interface{}, string)

* 消息请求 需要回复

func (*RPCClient) CallArgs

func (c *RPCClient) CallArgs(ctx context.Context, internalFunc string, argsType []string, args [][]byte) (r interface{}, e string)

func (*RPCClient) CallNR

func (c *RPCClient) CallNR(rpcInvokeResult *mqRPC.ResultInvokeST) error

* 消息请求 不需要回复

func (*RPCClient) CallNRArgs

func (c *RPCClient) CallNRArgs(ifunc string, argsType []string, args [][]byte) (err error)

func (*RPCClient) Done

func (c *RPCClient) Done() (err error)

type RPCServer

type RPCServer struct {
	// contains filtered or unexported fields
}

func (*RPCServer) Addr

func (s *RPCServer) Addr() string

func (*RPCServer) Call

func (s *RPCServer) Call(callInfo mqRPC.CallInfo) error

func (*RPCServer) Done

func (s *RPCServer) Done() (err error)

func (*RPCServer) GetExecuting

func (s *RPCServer) GetExecuting() int64

* 獲取當前正在執行的goroutine 數量

func (*RPCServer) Register

func (s *RPCServer) Register(id string, f interface{})

you must call the function before calling Open and Go

func (*RPCServer) RegisterGO

func (s *RPCServer) RegisterGO(id string, f interface{})

you must call the function before calling Open and Go

func (*RPCServer) SetGoroutineControl

func (s *RPCServer) SetGoroutineControl(control mqRPC.GoroutineControl)

func (*RPCServer) SetListener

func (s *RPCServer) SetListener(listener mqRPC.RPCListener)

Jump to

Keyboard shortcuts

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