Documentation
¶
Index ¶
- Constants
- type ApiCoder
- type Codec
- type JsonCodec
- func (self *JsonCodec) Close()
- func (self *JsonCodec) Decode(data []byte, msg interface{}) error
- func (self *JsonCodec) Encode(msg interface{}) ([]byte, error)
- func (self *JsonCodec) ReadRequest() (requests []*shared.Request, isBatch bool, err error)
- func (self *JsonCodec) ReadResponse() (interface{}, error)
- func (self *JsonCodec) WriteResponse(res interface{}) error
Constants ¶
View Source
const ( READ_TIMEOUT = 60 // in seconds MAX_REQUEST_SIZE = 1024 * 1024 MAX_RESPONSE_SIZE = 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiCoder ¶
type ApiCoder interface {
// Parse message to request from underlying stream
ReadRequest() ([]*shared.Request, bool, error)
// Parse response message from underlying stream
ReadResponse() (interface{}, error)
// Encode response to encoded form in underlying stream
WriteResponse(interface{}) error
// Decode single message from data
Decode([]byte, interface{}) error
// Encode msg to encoded form
Encode(msg interface{}) ([]byte, error)
// close the underlying stream
Close()
}
(de)serialization support for rpc interface
type JsonCodec ¶
type JsonCodec struct {
// contains filtered or unexported fields
}
Json serialization support
func (*JsonCodec) ReadRequest ¶
Read incoming request and parse it to RPC request
func (*JsonCodec) ReadResponse ¶
func (*JsonCodec) WriteResponse ¶
Parse JSON data from conn to obj
Click to show internal directories.
Click to hide internal directories.