Documentation ¶
Index ¶
- Constants
- func AddrToString(addr net.Addr) string
- func MakeMethodName(prot string, method string) string
- func SplitMethodName(n string) (p string, m string)
- type AlreadyRegisteredError
- type Call
- type Client
- type ClientResultPair
- type ConPackage
- type DecodeNext
- type Decoder
- type DisconnectedError
- type Dispatch
- type Dispatcher
- type DispatcherError
- type EofError
- type Errors
- type LogFactory
- type LogInterface
- type LogOptions
- type LogOutput
- type Message
- type MethodNotFoundError
- type Packetizer
- type PacketizerError
- type Profiler
- type Protocol
- type ProtocolNotFoundError
- type Request
- type ResultPair
- type ServeHook
- type Server
- type SimpleLog
- func (s SimpleLog) ClientCall(q int, meth string, arg interface{})
- func (s SimpleLog) ClientReply(q int, meth string, err error, res interface{})
- func (s SimpleLog) ServerCall(q int, meth string, err error, arg interface{})
- func (s SimpleLog) ServerReply(q int, meth string, err error, res interface{})
- func (s SimpleLog) StartProfiler(format string, args ...interface{}) Profiler
- func (l SimpleLog) TransportError(e error)
- func (l SimpleLog) TransportStart()
- func (s SimpleLog) UnexpectedReply(seqno int)
- func (s SimpleLog) Warning(format string, args ...interface{})
- type SimpleLogFactory
- type SimpleLogOptions
- func (so SimpleLogOptions) ClientTrace() bool
- func (so SimpleLogOptions) Profile() bool
- func (so SimpleLogOptions) ServerTrace() bool
- func (so SimpleLogOptions) ShowAddress() bool
- func (so SimpleLogOptions) ShowArg() bool
- func (so SimpleLogOptions) ShowResult() bool
- func (so SimpleLogOptions) TransportStart() bool
- type SimpleLogOutput
- func (s SimpleLogOutput) Debug(fmt string, args ...interface{})
- func (s SimpleLogOutput) Error(fmt string, args ...interface{})
- func (s SimpleLogOutput) Info(fmt string, args ...interface{})
- func (s SimpleLogOutput) Profile(fmt string, args ...interface{})
- func (s SimpleLogOutput) Warning(fmt string, args ...interface{})
- type SimpleProfiler
- type Transport
- func (t *Transport) Decode(i interface{}) (err error)
- func (t *Transport) Encode(i interface{}) (err error)
- func (t *Transport) GetDispatcher() (d Dispatcher, err error)
- func (t *Transport) GetRemoteAddr() (ret net.Addr)
- func (t *Transport) IsConnected() bool
- func (t *Transport) RawWrite(b []byte) (err error)
- func (t *Transport) ReadByte() (b byte, err error)
- func (t *Transport) ReadLock()
- func (t *Transport) ReadUnlock()
- type Transporter
- type UnwrapErrorFunc
- type WrapErrorFunc
Constants ¶
View Source
const ( TYPE_CALL = 0 TYPE_RESPONSE = 1 TYPE_NOTIFY = 2 )
Variables ¶
This section is empty.
Functions ¶
func AddrToString ¶
func MakeMethodName ¶
func SplitMethodName ¶
Types ¶
type AlreadyRegisteredError ¶
type AlreadyRegisteredError struct {
// contains filtered or unexported fields
}
func (AlreadyRegisteredError) Error ¶
func (a AlreadyRegisteredError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(xp *Transport, f UnwrapErrorFunc) *Client
type ClientResultPair ¶
type ClientResultPair struct {
// contains filtered or unexported fields
}
type ConPackage ¶
type ConPackage struct {
// contains filtered or unexported fields
}
func NewConPackage ¶
func NewConPackage(c net.Conn, mh *codec.MsgpackHandle) *ConPackage
func (*ConPackage) Close ¶
func (c *ConPackage) Close() error
func (*ConPackage) GetRemoteAddr ¶
func (c *ConPackage) GetRemoteAddr() net.Addr
func (*ConPackage) ReadByte ¶
func (c *ConPackage) ReadByte() (b byte, e error)
func (*ConPackage) Write ¶
func (c *ConPackage) Write(b []byte) (err error)
type DecodeNext ¶
type DecodeNext func(interface{}) error
type DisconnectedError ¶
type DisconnectedError struct{}
func (DisconnectedError) Error ¶
func (e DisconnectedError) Error() string
type Dispatch ¶
type Dispatch struct {
// contains filtered or unexported fields
}
func NewDispatch ¶
func NewDispatch(xp Transporter, l LogInterface, wef WrapErrorFunc) *Dispatch
func (*Dispatch) Call ¶
func (d *Dispatch) Call(name string, arg interface{}, res interface{}, f UnwrapErrorFunc) (err error)
func (*Dispatch) RegisterProtocol ¶
type Dispatcher ¶
type DispatcherError ¶
type DispatcherError struct {
// contains filtered or unexported fields
}
func NewDispatcherError ¶
func NewDispatcherError(d string, a ...interface{}) DispatcherError
func (DispatcherError) Error ¶
func (p DispatcherError) Error() string
type LogFactory ¶
type LogFactory interface {
NewLog(net.Addr) LogInterface
}
type LogInterface ¶
type LogInterface interface { TransportStart() TransportError(error) ServerCall(int, string, error, interface{}) ServerReply(int, string, error, interface{}) ClientCall(int, string, interface{}) ClientReply(int, string, error, interface{}) StartProfiler(format string, args ...interface{}) Profiler UnexpectedReply(int) Warning(format string, args ...interface{}) }
type LogOptions ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func (*Message) DecodeError ¶
func (m *Message) DecodeError(f UnwrapErrorFunc) (app error, dispatch error)
func (*Message) WrapError ¶
func (m *Message) WrapError(f WrapErrorFunc, e error) interface{}
type MethodNotFoundError ¶
type MethodNotFoundError struct {
// contains filtered or unexported fields
}
func (MethodNotFoundError) Error ¶
func (m MethodNotFoundError) Error() string
type Packetizer ¶
type Packetizer struct {
// contains filtered or unexported fields
}
func NewPacketizer ¶
func NewPacketizer(d Dispatcher, t Transporter) *Packetizer
func (*Packetizer) Clear ¶
func (p *Packetizer) Clear()
func (*Packetizer) Packetize ¶
func (p *Packetizer) Packetize() (err error)
type PacketizerError ¶
type PacketizerError struct {
// contains filtered or unexported fields
}
func NewPacketizerError ¶
func NewPacketizerError(d string, a ...interface{}) PacketizerError
func (PacketizerError) Error ¶
func (p PacketizerError) Error() string
type Protocol ¶
type Protocol struct { Name string Methods map[string]ServeHook WrapError WrapErrorFunc }
type ProtocolNotFoundError ¶
type ProtocolNotFoundError struct {
// contains filtered or unexported fields
}
func (ProtocolNotFoundError) Error ¶
func (p ProtocolNotFoundError) Error() string
type ResultPair ¶
type ResultPair struct {
// contains filtered or unexported fields
}
type ServeHook ¶
type ServeHook func(DecodeNext) (interface{}, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(xp *Transport, f WrapErrorFunc) *Server
type SimpleLog ¶
type SimpleLog struct { Addr net.Addr Out LogOutput Opts LogOptions }
func (SimpleLog) ClientCall ¶
func (SimpleLog) ClientReply ¶
func (SimpleLog) ServerCall ¶
func (SimpleLog) ServerReply ¶
func (SimpleLog) StartProfiler ¶
func (SimpleLog) TransportError ¶
func (SimpleLog) TransportStart ¶
func (l SimpleLog) TransportStart()
func (SimpleLog) UnexpectedReply ¶
type SimpleLogFactory ¶
type SimpleLogFactory struct {
// contains filtered or unexported fields
}
func NewSimpleLogFactory ¶
func NewSimpleLogFactory(out LogOutput, opts LogOptions) SimpleLogFactory
func (SimpleLogFactory) NewLog ¶
func (s SimpleLogFactory) NewLog(a net.Addr) LogInterface
type SimpleLogOptions ¶
type SimpleLogOptions struct{}
func (SimpleLogOptions) ClientTrace ¶
func (so SimpleLogOptions) ClientTrace() bool
func (SimpleLogOptions) Profile ¶
func (so SimpleLogOptions) Profile() bool
func (SimpleLogOptions) ServerTrace ¶
func (so SimpleLogOptions) ServerTrace() bool
func (SimpleLogOptions) ShowAddress ¶
func (so SimpleLogOptions) ShowAddress() bool
func (SimpleLogOptions) ShowArg ¶
func (so SimpleLogOptions) ShowArg() bool
func (SimpleLogOptions) ShowResult ¶
func (so SimpleLogOptions) ShowResult() bool
func (SimpleLogOptions) TransportStart ¶
func (so SimpleLogOptions) TransportStart() bool
type SimpleLogOutput ¶
type SimpleLogOutput struct{}
func (SimpleLogOutput) Debug ¶
func (s SimpleLogOutput) Debug(fmt string, args ...interface{})
func (SimpleLogOutput) Error ¶
func (s SimpleLogOutput) Error(fmt string, args ...interface{})
func (SimpleLogOutput) Info ¶
func (s SimpleLogOutput) Info(fmt string, args ...interface{})
func (SimpleLogOutput) Profile ¶
func (s SimpleLogOutput) Profile(fmt string, args ...interface{})
func (SimpleLogOutput) Warning ¶
func (s SimpleLogOutput) Warning(fmt string, args ...interface{})
type SimpleProfiler ¶
type SimpleProfiler struct {
// contains filtered or unexported fields
}
func (SimpleProfiler) Stop ¶
func (s SimpleProfiler) Stop()
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTransport ¶
func NewTransport(c net.Conn, l LogFactory, wef WrapErrorFunc) *Transport
func (*Transport) GetDispatcher ¶
func (t *Transport) GetDispatcher() (d Dispatcher, err error)
func (*Transport) GetRemoteAddr ¶
func (*Transport) IsConnected ¶
func (*Transport) ReadUnlock ¶
func (t *Transport) ReadUnlock()
type Transporter ¶
type UnwrapErrorFunc ¶
type UnwrapErrorFunc func(nxt DecodeNext) (error, error)
type WrapErrorFunc ¶
type WrapErrorFunc func(error) interface{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.