defaultrpc

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 17 Imported by: 24

Documentation

Overview

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqant Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

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) 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)

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

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)

type RPCClient

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

func (*RPCClient) Call

func (c *RPCClient) Call(_func string, params ...interface{}) (interface{}, string)

* 消息请求 需要回复

func (*RPCClient) CallArgs

func (c *RPCClient) CallArgs(_func string, ArgsType []string, args [][]byte) (interface{}, string)

func (*RPCClient) CallNR

func (c *RPCClient) CallNR(_func string, params ...interface{}) (err error)

* 消息请求 不需要回复

func (*RPCClient) CallNRArgs

func (c *RPCClient) CallNRArgs(_func 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 (this *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) Finish

func (this *RPCServer) Finish()

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)

func (*RPCServer) Wait

func (this *RPCServer) Wait() error

Jump to

Keyboard shortcuts

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