framing

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSize = 4 << 20 // 4MB

MaxSize is the maximum decodable message size.

Variables

View Source
var (
	// ErrSize is returned by Decode calls when a message would exceed the maximum
	// allowed size.
	ErrSize = fmt.Errorf("proto: message exceeds %dMB", MaxSize>>20)
)

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads and decodes Protobuf messages from an io.Reader.

func NewDecoder

func NewDecoder(r Reader, uf UnmarshalFunc) *Decoder

NewDecoder returns a new Decoder that reads from the given io.Reader. If r does not also implement StringReader, it will be wrapped in a bufio.Reader.

func (*Decoder) Decode

func (d *Decoder) Decode(m interface{}) error

Decode reads the next Protobuf-encoded message from its input and stores it in the value pointed to by m. If m isn't a proto.Message, Decode will panic.

type Reader

type Reader interface {
	ReadFrame(buf []byte) (endOfFrame bool, n int, err error)
}

type UnmarshalFunc

type UnmarshalFunc func([]byte, interface{}) error

UnmarshalFunc translates bytes to objects

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL