protoio

package
v0.0.0-...-b0c7fd6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDataCorrupted = fmt.Errorf("data corrupted")

Functions

This section is empty.

Types

type Iterator

type Iterator[T proto.Message] struct {
	Item T
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator[T proto.Message](reader *Reader, newItem func() T) *Iterator[T]

func (*Iterator[T]) Next

func (i *Iterator[T]) Next() error

type RandomAccessReader

type RandomAccessReader interface {
	ReadAt(entry proto.Message, offset int64) (int, error)
}

RandomAccessReader is an interface for reading protobuf messages from a seekable source.

type Reader

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

func NewReader

func NewReader(source io.ReaderAt) *Reader

func (*Reader) Offset

func (r *Reader) Offset() int64

func (*Reader) ReadAt

func (r *Reader) ReadAt(msg proto.Message, offset int64) (int, error)

func (*Reader) ReadNext

func (r *Reader) ReadNext(msg proto.Message) (int, error)

func (*Reader) Skip

func (r *Reader) Skip() error

func (*Reader) SkipN

func (r *Reader) SkipN(n int) error

type SequentialReader

type SequentialReader interface {
	ReadNext(entry proto.Message) (int, error)
	SkipN(n int) error
	Skip() error
	Offset() int64
}

SequentialReader is an interface for reading protobuf messages sequentially from a source that does not support seeking.

type SequentialWriter

type SequentialWriter interface {
	Append(entry proto.Message) (int, error)
	Offset() int64
}

SequentialWriter is an interface for writing protobuf messages to a sequential source. The offset of the next write can be queried with the Offset method.

type Writer

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

func NewWriter

func NewWriter(file io.Writer) *Writer

func (*Writer) Append

func (w *Writer) Append(entry proto.Message) (int, error)

func (*Writer) Offset

func (w *Writer) Offset() int64

Jump to

Keyboard shortcuts

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