proto

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MMapProtoReader

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

func (*MMapProtoReader) Close

func (r *MMapProtoReader) Close() error

func (*MMapProtoReader) Open

func (r *MMapProtoReader) Open() error

func (*MMapProtoReader) ReadNextAt

func (r *MMapProtoReader) ReadNextAt(record proto.Message, offset uint64) (proto.Message, error)

type ReadAtI

type ReadAtI interface {
	recordio.OpenClosableI
	// Reads the next record at the given offset into the passed message record, EOF error when it reaches the end signalled by (nil, io.EOF), implementation must be thread-safe
	ReadNextAt(record proto.Message, offset uint64) (proto.Message, error)
}

this type is thread-safe

func NewMMapProtoReaderWithPath

func NewMMapProtoReaderWithPath(path string) (ReadAtI, error)

type Reader

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

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Open

func (r *Reader) Open() error

func (*Reader) ReadNext

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

func (*Reader) SkipNext

func (r *Reader) SkipNext() error

type ReaderI

type ReaderI interface {
	recordio.OpenClosableI
	// Reads the next record into the passed message record, EOF error when it reaches the end signalled by (nil, io.EOF)
	ReadNext(record proto.Message) (proto.Message, error)
	// skips the next record, EOF error when it reaches the end signalled by io.EOF as the error
	SkipNext() error
}

func NewProtoReaderWithFile

func NewProtoReaderWithFile(file *os.File) (ReaderI, error)

func NewProtoReaderWithPath

func NewProtoReaderWithPath(path string) (ReaderI, error)

type Writer

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

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Open

func (w *Writer) Open() error

func (*Writer) Size

func (w *Writer) Size() uint64

func (*Writer) Write

func (w *Writer) Write(record proto.Message) (uint64, error)

func (*Writer) WriteSync

func (w *Writer) WriteSync(record proto.Message) (uint64, error)

type WriterI

type WriterI interface {
	recordio.OpenClosableI
	recordio.SizeI
	// Appends a record, returns the current offset this item was written to
	Write(record proto.Message) (uint64, error)
	// Appends a record and forces a disk sync, returns the current offset this item was written to
	WriteSync(record proto.Message) (uint64, error)
}

func NewWriter

func NewWriter(writerOptions ...WriterOption) (WriterI, error)

create a new writer with the given options. Either Path or File must be supplied, compression is optional and turned off by default.

type WriterOption

type WriterOption func(*WriterOptions)

func CompressionType

func CompressionType(p int) WriterOption

func DirectIO added in v1.3.0

func DirectIO() WriterOption

func File

func File(p *os.File) WriterOption

func Path

func Path(p string) WriterOption

func WriteBufferSizeBytes added in v1.3.0

func WriteBufferSizeBytes(p int) WriterOption

type WriterOptions

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

Jump to

Keyboard shortcuts

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