Documentation
¶
Index ¶
- Constants
- Variables
- type Callable
- type CallableCallback
- type ClientCallableOnConnect
- type Context
- type FuncDesc
- type HandleFunc
- type MiddlewareFunc
- type RPC
- func (this *RPC) Close() error
- func (this *RPC) Len() int
- func (this *RPC) Loop() liblpc.EventLoop
- func (this *RPC) NewClientCallable(addr *liblpc.SyscallSockAddr, userData interface{}, m ...MiddlewareFunc) (Callable, error)
- func (this *RPC) NewConnCallable(fd int, userData interface{}, m ...MiddlewareFunc) Callable
- func (this *RPC) PreUse(m ...MiddlewareFunc)
- func (this *RPC) RegFunc(f interface{}, m ...MiddlewareFunc)
- func (this *RPC) RegFuncWithName(fname string, f interface{}, m ...MiddlewareFunc)
- func (this *RPC) Run(ctx context.Context)
- func (this *RPC) Start(ctx context.Context)
- func (this *RPC) Use(m ...MiddlewareFunc)
- type RpcMsgHeader
- type SignalCallable
- type TimeWheelEntryImpl
- type Writer
Constants ¶
View Source
const RpcLoopDefaultBufferSize = 1024 * 1024 * 4
Variables ¶
View Source
var Debug = true
noinspection GoUnusedGlobalVariable
View Source
var ErrNeedMore = errors.New("codec want read more bytes")
Functions ¶
This section is empty.
Types ¶
type Callable ¶
type Callable interface {
liblpc.BucketEntry
liblpc.UserDataStorage
Start()
Call(timeout time.Duration, name string, mids ...MiddlewareFunc) error
Call0(timeout time.Duration, name string, headers RpcMsgHeader, mids ...MiddlewareFunc) (ackHeader RpcMsgHeader, err error)
Call1(timeout time.Duration, name string, in interface{}, mids ...MiddlewareFunc) error
Call2(timeout time.Duration, name string, headers RpcMsgHeader, in interface{}, mids ...MiddlewareFunc) (ackHeader RpcMsgHeader, err error)
Call3(timeout time.Duration, name string, out interface{}, mids ...MiddlewareFunc) error
Call4(timeout time.Duration, name string, headers RpcMsgHeader, out interface{}, mids ...MiddlewareFunc) (ackHeader RpcMsgHeader, err error)
Call5(timeout time.Duration, name string, in, out interface{}, mids ...MiddlewareFunc) error
Call6(timeout time.Duration, name string, headers RpcMsgHeader, in, out interface{}, mids ...MiddlewareFunc) (ackHeader RpcMsgHeader, err error)
Perform(timeout time.Duration, ctx Context)
SetOnReady(cb CallableCallback)
SetOnClose(cb CallableCallback)
BindTimeWheel(timeWheel *liblpc.TimeWheel)
NotifyTimeWheel()
}
type CallableCallback ¶
type ClientCallableOnConnect ¶
type Context ¶
type Context interface {
Callable() Callable
Id() string
SetMethod(string)
Method() string
LocalFuncDesc() FuncDesc
SetRequestHeader(header RpcMsgHeader)
RequestHeader() RpcMsgHeader
SetResponseHeader(header RpcMsgHeader)
ResponseHeader() RpcMsgHeader
SetRequest(in interface{})
Request() (in interface{})
SetResponse(out interface{})
Response() (out interface{})
RequestType() reflect.Type
ResponseType() reflect.Type
SetError(err error)
Error() error
SetWriter(w Writer)
Writer() Writer
AddDefer(deferFunc func())
liblpc.UserDataStorage
}
type HandleFunc ¶
type HandleFunc func(ctx Context)
type MiddlewareFunc ¶
type MiddlewareFunc func(next HandleFunc) HandleFunc
type RPC ¶
type RPC struct {
// contains filtered or unexported fields
}
func (*RPC) NewClientCallable ¶
func (this *RPC) NewClientCallable( addr *liblpc.SyscallSockAddr, userData interface{}, m ...MiddlewareFunc) (Callable, error)
func (*RPC) NewConnCallable ¶
func (this *RPC) NewConnCallable(fd int, userData interface{}, m ...MiddlewareFunc) Callable
func (*RPC) PreUse ¶
func (this *RPC) PreUse(m ...MiddlewareFunc)
func (*RPC) RegFunc ¶
func (this *RPC) RegFunc(f interface{}, m ...MiddlewareFunc)
func (*RPC) RegFuncWithName ¶
func (this *RPC) RegFuncWithName(fname string, f interface{}, m ...MiddlewareFunc)
func (*RPC) Use ¶
func (this *RPC) Use(m ...MiddlewareFunc)
type RpcMsgHeader ¶
type SignalCallable ¶
type SignalCallable struct {
Callable
// contains filtered or unexported fields
}
func NewSignalCallable ¶
func NewSignalCallable(call Callable) *SignalCallable
func (*SignalCallable) Close ¶
func (this *SignalCallable) Close() error
func (*SignalCallable) CloseSignal ¶
func (this *SignalCallable) CloseSignal() <-chan error
usage : err,ok := CloseSignal(); !ok -> return , ok -> check error
func (*SignalCallable) ReadySignal ¶
func (this *SignalCallable) ReadySignal() <-chan error
usage : err,ok := ReadySignal(); !ok -> return , ok -> check error
type TimeWheelEntryImpl ¶
func (*TimeWheelEntryImpl) BindTimeWheel ¶
func (this *TimeWheelEntryImpl) BindTimeWheel(timeWheel *liblpc.TimeWheel)
not thread safe
func (*TimeWheelEntryImpl) GetRefCounter ¶
func (this *TimeWheelEntryImpl) GetRefCounter() *int32
func (*TimeWheelEntryImpl) NotifyTimeWheel ¶
func (this *TimeWheelEntryImpl) NotifyTimeWheel()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.