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 ConPackage
- type DecodeNext
- type Decoder
- type DisconnectedError
- type Dispatch
- func (d *Dispatch) Call(name string, arg interface{}, res interface{}, f UnwrapErrorFunc) (err error)
- func (d *Dispatch) Dispatch(m *Message) (err error)
- func (d *Dispatch) RegisterEOFHook(h EOFHook) error
- func (d *Dispatch) RegisterProtocol(p Protocol) (err error)
- func (d *Dispatch) Reset(eofError error) error
- type Dispatcher
- type DispatcherError
- type EOFHook
- 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 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 Transporter, f UnwrapErrorFunc) *Client
type ConPackage ¶
type ConPackage struct { Decoder // 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) RegisterEOFHook ¶
RegisterEOFHook registers a function to call when the dispatcher hits EOF. The hook will be called with whatever error caused the channel to close. Usually this should be io.EOF, but it can of course be otherwise.
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 EOFHook ¶
type EOFHook func(error)
EOFHook is typically called when a transport has to shut down. We supply it with the exact error that caused the shutdown, which should be io.EOF under normal circumstances.
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 NewMessage ¶
func NewMessage(t Transporter, nFields int) Message
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 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
func (*Server) RegisterEOFHook ¶
RegisterEOFHook registers a callback that's called when there's and EOF condition on the underlying channel.
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.