rcore

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package rpcpb is a generated protocol buffer package.

It is generated from these files:

rpc/rpc.proto

It has these top-level messages:

RPCInfo
ResultInfo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CId

func CId(v string) cOption

func CLog

func CLog(v bool) cOption

func CNats

func CNats(v *nats.Conn) cOption

func CRpcExpired

func CRpcExpired(v int) cOption

func CrpcId

func CrpcId(v string) cOption

func SId

func SId(v string) sOption

func SLog

func SLog(v bool) sOption

func SMaxCoroutine

func SMaxCoroutine(v int) sOption

func SNats

func SNats(v *nats.Conn) sOption

Types

type CallInfo

type CallInfo struct {
	RpcInfo RPCInfo
	Result  ResultInfo
	Props   map[string]interface{}
	Agent   MQServer //代理者  AMQPServer / LocalServer 都继承 Callback(callinfo CallInfo)(error) 方法
}

type ClinetCallInfo

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

type FunctionInfo

type FunctionInfo struct {
	Function  reflect.Value
	Goroutine bool
}

type IRpcMsgClient

type IRpcMsgClient interface {
	Done() (err error)
	Delete(key string) (err error)
	Call(callInfo CallInfo, callback chan ResultInfo) error
	CallNR(callInfo CallInfo) error
}

type IRpcMsgServer

type IRpcMsgServer interface {
	RpcId() string
	Done() (err error)
}

type MQServer

type MQServer interface {
	Callback(callinfo CallInfo) error
}

type NatsClient

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

func NewNatsClient

func NewNatsClient(rId string, nts *nats.Conn) (natsClient *NatsClient, err error)

func (*NatsClient) Call

func (this *NatsClient) Call(callInfo CallInfo, callback chan ResultInfo) error

* 消息请求

func (*NatsClient) CallNR

func (this *NatsClient) CallNR(callInfo 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 (this *NatsClient) Marshal(rpcInfo *RPCInfo) ([]byte, error)

func (*NatsClient) Unmarshal

func (this *NatsClient) Unmarshal(data []byte) (*RPCInfo, error)

func (*NatsClient) UnmarshalResult

func (this *NatsClient) UnmarshalResult(data []byte) (*ResultInfo, error)

type NatsServer

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

func NewNatsServer

func NewNatsServer(server *RpcServer) (natsServer *NatsServer, err error)

func (*NatsServer) Callback

func (this *NatsServer) Callback(callinfo CallInfo) error

func (*NatsServer) Done

func (this *NatsServer) Done() (err error)

* 注销消息队列

func (*NatsServer) MarshalResult

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

goroutine safe

func (*NatsServer) RpcId

func (this *NatsServer) RpcId() string

func (*NatsServer) Unmarshal

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

type RPCInfo

type RPCInfo struct {
	Cid      string   `protobuf:"bytes,1,opt,name=Cid" json:"Cid,omitempty"`
	Fn       string   `protobuf:"bytes,2,opt,name=Fn" json:"Fn,omitempty"`
	ReplyTo  string   `protobuf:"bytes,3,opt,name=ReplyTo" json:"ReplyTo,omitempty"`
	Track    string   `protobuf:"bytes,4,opt,name=track" json:"track,omitempty"`
	Expired  int64    `protobuf:"varint,5,opt,name=Expired" json:"Expired,omitempty"`
	Reply    bool     `protobuf:"varint,6,opt,name=Reply" json:"Reply,omitempty"`
	ArgsType []string `protobuf:"bytes,7,rep,name=ArgsType" json:"ArgsType,omitempty"`
	Args     [][]byte `protobuf:"bytes,8,rep,name=Args,proto3" json:"Args,omitempty"`
}

func (*RPCInfo) Descriptor

func (*RPCInfo) Descriptor() ([]byte, []int)

func (*RPCInfo) GetArgs

func (m *RPCInfo) GetArgs() [][]byte

func (*RPCInfo) GetArgsType

func (m *RPCInfo) GetArgsType() []string

func (*RPCInfo) GetCid

func (m *RPCInfo) GetCid() string

func (*RPCInfo) GetExpired

func (m *RPCInfo) GetExpired() int64

func (*RPCInfo) GetFn

func (m *RPCInfo) GetFn() string

func (*RPCInfo) GetReply

func (m *RPCInfo) GetReply() bool

func (*RPCInfo) GetReplyTo

func (m *RPCInfo) GetReplyTo() string

func (*RPCInfo) GetTrack

func (m *RPCInfo) GetTrack() string

func (*RPCInfo) ProtoMessage

func (*RPCInfo) ProtoMessage()

func (*RPCInfo) Reset

func (m *RPCInfo) Reset()

func (*RPCInfo) String

func (m *RPCInfo) String() string

type RPCListener

type RPCListener interface {
	NoFoundFunction(fn string) (*FunctionInfo, error)
	BeforeHandle(fn string, callInfo *CallInfo) error
	OnTimeOut(fn string, Expired int64)
	OnError(fn string, callInfo *CallInfo, err error)
	OnComplete(fn string, callInfo *CallInfo, result *ResultInfo, exec_time int64)
}

type ResultInfo

type ResultInfo struct {
	Cid        string `protobuf:"bytes,1,opt,name=Cid" json:"Cid,omitempty"`
	Error      string `protobuf:"bytes,2,opt,name=CodeError" json:"CodeError,omitempty"`
	ResultType string `protobuf:"bytes,4,opt,name=ResultType" json:"ResultType,omitempty"`
	Result     []byte `protobuf:"bytes,5,opt,name=Result,proto3" json:"Result,omitempty"`
}

func NewResultInfo

func NewResultInfo(Cid string, Error string, ArgsType string, result []byte) *ResultInfo

func (*ResultInfo) Descriptor

func (*ResultInfo) Descriptor() ([]byte, []int)

func (*ResultInfo) GetCid

func (m *ResultInfo) GetCid() string

func (*ResultInfo) GetError

func (m *ResultInfo) GetError() string

func (*ResultInfo) GetResult

func (m *ResultInfo) GetResult() []byte

func (*ResultInfo) GetResultType

func (m *ResultInfo) GetResultType() string

func (*ResultInfo) ProtoMessage

func (*ResultInfo) ProtoMessage()

func (*ResultInfo) Reset

func (m *ResultInfo) Reset()

func (*ResultInfo) String

func (m *ResultInfo) String() string

type RpcClient

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

func NewRpcClient

func NewRpcClient(opt ...cOption) (srpc *RpcClient, err error)

func (*RpcClient) Call

func (this *RpcClient) Call(_func string, params ...interface{}) (interface{}, error)

* 消息请求 需要回复

func (*RpcClient) CallArgs

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

func (*RpcClient) CallNR

func (this *RpcClient) CallNR(_func string, params ...interface{}) (err error)

* 消息请求 不需要回复

func (*RpcClient) CallNRArgs

func (this *RpcClient) CallNRArgs(_func string, ArgsType []string, args [][]byte) (err error)

func (*RpcClient) Done

func (this *RpcClient) Done() (err error)

type RpcServer

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

func NewRpcServer

func NewRpcServer(opt ...sOption) (srpc *RpcServer, err error)

func (*RpcServer) Call

func (this *RpcServer) Call(callInfo CallInfo) error

func (*RpcServer) Done

func (this *RpcServer) Done() (err error)

func (*RpcServer) Finish

func (this *RpcServer) Finish()

func (*RpcServer) Register

func (this *RpcServer) Register(id string, f interface{})

func (*RpcServer) RegisterGO

func (this *RpcServer) RegisterGO(id string, f interface{})

func (*RpcServer) RpcId

func (this *RpcServer) RpcId() string

func (*RpcServer) UnRegister

func (this *RpcServer) UnRegister(id string, f interface{})

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