Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface { // Register registers a message so that the // codec can identify the message when reading // the TCP connection. Register(msg proto.Message) // WriteMsg encodes a message to bytes and // writes it to the io.Writer WriteMsg(msg proto.Message, w io.Writer) error // ReadMsg reads bytes from the io.Reader // and decodes it to a message. ReadMsg(r io.Reader) (proto.Message, error) }
Codec describes the codec interface, which encodes/decodes protobuf messages from/to an io.Reader/Writer
type ProtobufCodec ¶
type ProtobufCodec struct {
// contains filtered or unexported fields
}
ProtobufCodec implements the codec interface.
func NewProtobufCodec ¶
func NewProtobufCodec() *ProtobufCodec
NewProtobufCodec creates and returns a ProtobufCodec.
func (*ProtobufCodec) Register ¶
func (pc *ProtobufCodec) Register(msg proto.Message)
Register registers a message. Note this is not concurrent-safe.
Click to show internal directories.
Click to hide internal directories.