protostream

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package protostream implements reading and writing of protobuf messages to data streams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader reads protobuf messages from an io.Reader.

func NewReader

func NewReader(src io.Reader) *Reader

NewReader returns a new Reader. src is the io.Reader that the Reader should read the log from.

func (*Reader) Read

func (r *Reader) Read(dst proto.Message) error

Read reads a protobuf message from the stream and unmarshals it into the dst message.

func (*Reader) ReadAny

func (r *Reader) ReadAny() (proto.Message, error)

ReadAny reads a protobuf message wrapped in an anypb.Any message from the stream.

type Writer

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

Writer writes protobuf messages to an io.Writer.

func NewWriter

func NewWriter(dest io.Writer) *Writer

NewWriter returns a new Writer. dest is the io.Writer that the Writer should write to (the stream).

func (*Writer) Write

func (w *Writer) Write(msg proto.Message) error

Write writes a proto message to the stream.

func (*Writer) WriteAny

func (w *Writer) WriteAny(msg proto.Message) error

WriteAny writes a proto message to the stream wrapped in an anypb.Any message.

Jump to

Keyboard shortcuts

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