Documentation
¶
Index ¶
- type Codec
- type ProtobufCodec
- func (c *ProtobufCodec) Decode(data []byte, msg proto.Message) error
- func (c *ProtobufCodec) DecodeStream(r io.Reader, msg proto.Message) error
- func (c *ProtobufCodec) Encode(msg proto.Message) ([]byte, error)
- func (c *ProtobufCodec) EncodeStream(w io.Writer, msg proto.Message) error
- func (c *ProtobufCodec) MaxMessageSize() int
- type Registry
- type StreamCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface {
Encode(msg proto.Message) ([]byte, error)
Decode(data []byte, msg proto.Message) error
MaxMessageSize() int
}
Codec defines the message encoding/decoding interface
type ProtobufCodec ¶
type ProtobufCodec struct {
// contains filtered or unexported fields
}
ProtobufCodec implements length-prefixed protobuf encoding
func NewProtobufCodec ¶
func NewProtobufCodec(maxMessageSize int) *ProtobufCodec
NewProtobufCodec creates a new protobuf codec
func (*ProtobufCodec) Decode ¶
func (c *ProtobufCodec) Decode(data []byte, msg proto.Message) error
Decode unmarshals a length-prefixed message
func (*ProtobufCodec) DecodeStream ¶
DecodeStream reads a length-prefixed message from stream
func (*ProtobufCodec) Encode ¶
func (c *ProtobufCodec) Encode(msg proto.Message) ([]byte, error)
Encode marshals a message with length prefix
func (*ProtobufCodec) EncodeStream ¶
EncodeStream writes a length-prefixed message to stream
func (*ProtobufCodec) MaxMessageSize ¶
func (c *ProtobufCodec) MaxMessageSize() int
MaxMessageSize returns the maximum message size
Click to show internal directories.
Click to hide internal directories.