protoio

package
v38.0.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalDelimited

func MarshalDelimited(msg proto.Message) ([]byte, error)

func UnmarshalDelimited

func UnmarshalDelimited(data []byte, msg proto.Message) error

Types

type ReadCloser

type ReadCloser interface {
	Reader
	io.Closer
}

func NewDelimitedReader

func NewDelimitedReader(r io.Reader, maxSize int) ReadCloser

NewDelimitedReader reads varint-delimited Protobuf messages from a reader. Unlike the gogoproto NewDelimitedReader, this does not buffer the reader, which may cause poor performance but is necessary when only reading single messages (e.g. in the p2p package). It also returns the number of bytes read, which is necessary for the p2p package.

type Reader

type Reader interface {
	ReadMsg(msg proto.Message) (int, error)
}

type WriteCloser

type WriteCloser interface {
	Writer
	io.Closer
}

func NewDelimitedWriter

func NewDelimitedWriter(w io.Writer) WriteCloser

NewDelimitedWriter writes a varint-delimited Protobuf message to a writer. It is equivalent to the gogoproto NewDelimitedWriter, except WriteMsg() also returns the number of bytes written, which is necessary in the p2p package.

type Writer

type Writer interface {
	WriteMsg(proto.Message) (int, error)
}

Jump to

Keyboard shortcuts

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