Documentation ¶
Index ¶
- func InstallAsyncCallOptionsWatchDog(dog func(cc *AsyncCallOptions))
- func InstallCallOptionsWatchDog(dog func(cc *CallOptions))
- func InstallNoticeOptionsWatchDog(dog func(cc *NoticeOptions))
- type AsyncCallOption
- type AsyncCallOptions
- type AsyncResponseFilter
- type CallOption
- type CallOptions
- type NoticeOption
- type NoticeOptions
- type RPCProcess
- func (p *RPCProcess) AsyncCall(ctx context.Context, uri interface{}, rq interface{}, af process.RouterFunc, ...) (err error)
- func (p *RPCProcess) Call(ctx context.Context, uri interface{}, rq, rs interface{}, opts *CallOptions) (err error)
- func (p *RPCProcess) Clean()
- func (p *RPCProcess) Notify(ctx context.Context, uri interface{}, rq interface{}, opts *NoticeOptions) (err error)
- func (p *RPCProcess) OnFailed(pkg interface{}, err error)
- func (p *RPCProcess) OnReply(in interface{}) (filter bool)
- type RPCProcesser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallAsyncCallOptionsWatchDog ¶
func InstallAsyncCallOptionsWatchDog(dog func(cc *AsyncCallOptions))
InstallAsyncCallOptionsWatchDog install watch dog
func InstallCallOptionsWatchDog ¶
func InstallCallOptionsWatchDog(dog func(cc *CallOptions))
InstallCallOptionsWatchDog install watch dog
func InstallNoticeOptionsWatchDog ¶
func InstallNoticeOptionsWatchDog(dog func(cc *NoticeOptions))
InstallNoticeOptionsWatchDog install watch dog
Types ¶
type AsyncCallOption ¶
type AsyncCallOption func(cc *AsyncCallOptions) AsyncCallOption
AsyncCallOption option define
func WithAsyncCallOptionMetadata ¶
func WithAsyncCallOptionMetadata(v metadata.MD) AsyncCallOption
metadata
func WithAsyncCallOptionResponseFilter ¶
func WithAsyncCallOptionResponseFilter(v AsyncResponseFilter) AsyncCallOption
response filter. NOTE: req only valid in Filter func.
func WithAsyncCallOptionTimeout ¶
func WithAsyncCallOptionTimeout(v time.Duration) AsyncCallOption
rpc call timeout
func WithAsyncCallOptionWaitFilter ¶
func WithAsyncCallOptionWaitFilter(v func(await func())) AsyncCallOption
type AsyncCallOptions ¶
type AsyncCallOptions struct { // rpc call timeout Timeout time.Duration // metadata Metadata metadata.MD // response filter. NOTE: req only valid in Filter func. ResponseFilter AsyncResponseFilter WaitFilter func(await func()) }
CallOption rpc call options
func NewAsyncCallOptions ¶
func NewAsyncCallOptions(opts ...AsyncCallOption) *AsyncCallOptions
NewAsyncCallOptions create options instance.
func (*AsyncCallOptions) ApplyOption ¶
func (cc *AsyncCallOptions) ApplyOption(opts ...AsyncCallOption)
ApplyOption modify options
func (*AsyncCallOptions) GetSetOption ¶
func (cc *AsyncCallOptions) GetSetOption(opt AsyncCallOption) AsyncCallOption
GetSetOption modify and get last option
func (*AsyncCallOptions) SetOption ¶
func (cc *AsyncCallOptions) SetOption(opt AsyncCallOption)
SetOption modify options
type AsyncResponseFilter ¶
AsyncResponseFilter 异步请回回复调用
type CallOption ¶
type CallOption func(cc *CallOptions) CallOption
CallOption option define
func WithCallOptionTimeout ¶
func WithCallOptionTimeout(v time.Duration) CallOption
rpc call timeout
type CallOptions ¶
type CallOptions struct { // rpc call timeout Timeout time.Duration // metadata Metadata metadata.MD }
CallOption rpc call options
func NewCallOptions ¶
func NewCallOptions(opts ...CallOption) *CallOptions
NewCallOptions create options instance.
func (*CallOptions) ApplyOption ¶
func (cc *CallOptions) ApplyOption(opts ...CallOption)
ApplyOption modify options
func (*CallOptions) GetSetOption ¶
func (cc *CallOptions) GetSetOption(opt CallOption) CallOption
GetSetOption modify and get last option
func (*CallOptions) SetOption ¶
func (cc *CallOptions) SetOption(opt CallOption)
SetOption modify options
type NoticeOption ¶
type NoticeOption func(cc *NoticeOptions) NoticeOption
NoticeOption option define
func WithNoticeOptionTimeout ¶
func WithNoticeOptionTimeout(v time.Duration) NoticeOption
send message timeout
type NoticeOptions ¶
type NoticeOptions struct { // send message timeout Timeout time.Duration // metadata Metadata metadata.MD }
NoticeOption oneway rpc
func NewNoticeOptions ¶
func NewNoticeOptions(opts ...NoticeOption) *NoticeOptions
NewNoticeOptions create options instance.
func (*NoticeOptions) ApplyOption ¶
func (cc *NoticeOptions) ApplyOption(opts ...NoticeOption)
ApplyOption modify options
func (*NoticeOptions) GetSetOption ¶
func (cc *NoticeOptions) GetSetOption(opt NoticeOption) NoticeOption
GetSetOption modify and get last option
func (*NoticeOptions) SetOption ¶
func (cc *NoticeOptions) SetOption(opt NoticeOption)
SetOption modify options
type RPCProcess ¶
RPCProcess 通用rpc处理流程封装 封装
func NewRPCProcess ¶
func NewRPCProcess(inner *process.InnerOptions, opts *process.ProcessOptions) *RPCProcess
func (*RPCProcess) AsyncCall ¶
func (p *RPCProcess) AsyncCall(ctx context.Context, uri interface{}, rq interface{}, af process.RouterFunc, opts *AsyncCallOptions) (err error)
AsyncCall 异步RPC请求
func (*RPCProcess) Call ¶
func (p *RPCProcess) Call(ctx context.Context, uri interface{}, rq, rs interface{}, opts *CallOptions) (err error)
Call 同步rpc请求
func (*RPCProcess) Notify ¶
func (p *RPCProcess) Notify(ctx context.Context, uri interface{}, rq interface{}, opts *NoticeOptions) (err error)
Notify 通知请求(one way)
func (*RPCProcess) OnFailed ¶ added in v0.0.2
func (p *RPCProcess) OnFailed(pkg interface{}, err error)
OnFailed 调度时候失败.
func (*RPCProcess) OnReply ¶
func (p *RPCProcess) OnReply(in interface{}) (filter bool)
OnReply rpc请求返回处理
type RPCProcesser ¶
type RPCProcesser interface { // OnReply rpc请求返回处理 OnReply(in interface{}) (filter bool) // Call 同步rpc请求 Call(ctx context.Context, uri interface{}, rq, rs interface{}, opts *CallOptions) (err error) // AsyncCall 异步RPC请求 AsyncCall(ctx context.Context, uri interface{}, rq interface{}, af process.RouterFunc, opts *AsyncCallOptions) (err error) // Notify 通知请求(one way) Notify(ctx context.Context, uri interface{}, rq interface{}, opts *NoticeOptions) (err error) // Clean session 清理(rpc请求等缓存清理) Clean() }
RPCProcess 通用rpc处理流程封装 封装