Documentation
¶
Index ¶
- func Call(node string, addr any, cmd string, args any, reply any) error
- func CallHost(host *Host, addr any, cmd string, args any, reply any) error
- func Invoke(caller *client.Caller) error
- func InvokeWithHost(host *Host, caller *client.Caller) error
- func Send(node string, addr any, cmd string, args any) error
- func SendHost(host *Host, addr any, cmd string, args any) error
- func SetClientOptsHandler(handler NewClientOptsHandle)
- type Host
- type NewClientOptsHandle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
Call srpc.call equal skynet cluster.call(node, addr, cmd, args, reply)
Or srpc.Invoke to custom remote call ¶
node: registered skynet cluster node name
addr: skynet service name or number address
args: type *struct will be marshal with argsCodec
reply: providing a new value for the reply. value type must be exported. *sturct will be unmarshal with argsCodec
return waits for it to complete or timeout(default 30s) and returns its error status.
func CallHost ¶ added in v1.0.4
CallHost 使用名称和地址调用,无需提前注册 NOTE: 但是必须提前设定 SetClientOptsHandler 否则使用默认配置初始化客户端可能导致预期之外的问题 Host{Name:"gate",Addr:"127.0.0.1:8888"}
func Invoke ¶
Invoker invoker will query registered client then invoker with caller
caller = client.NewCaller(node, addr, cmd, args).WithTimeout(5*time.Second).WithPayloadCodec("json")
return returns its error status. If not push then waits for it to complete or timeout
func Send ¶
Send equal skynet cluster.send(node, addr, cmd, args)
node: registered cluster node name
addr: skynet service name or number address
args: type *struct will be marshal with argsCodec
return don't waits for it to complete, returns its error status.
func SetClientOptsHandler ¶ added in v1.0.4
func SetClientOptsHandler(handler NewClientOptsHandle)