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() (*shared.Request, error)
- func (self *JsonCodec) ReadResponse() (interface{}, error)
- func (self *JsonCodec) WriteResponse(res interface{}) error
Constants ¶
View Source
const (
MAX_RESPONSE_SIZE = 64 * 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, 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 ¶
Serialize obj to JSON and write it to conn
func (*JsonCodec) ReadResponse ¶
func (*JsonCodec) WriteResponse ¶
Parse JSON data from conn to obj
Click to show internal directories.
Click to hide internal directories.