protofile

package
v0.0.0-...-f53b987 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProtoFile

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

ProtoFile contains information for reading and writing to a protofile. It is returned from either Read() or Write().

func (*ProtoFile) Close

func (pf *ProtoFile) Close() error

Close closes a ProtoFile opened by Read() or Write().

func (*ProtoFile) Read

func (pf *ProtoFile) Read(message proto.Message) (int64, error)

func (*ProtoFile) ReadAt

func (pf *ProtoFile) ReadAt(pos int64, message proto.Message) (int64, error)

func (*ProtoFile) Seek

func (pf *ProtoFile) Seek(pos int64) (int64, error)

func (*ProtoFile) Stat

func (pf *ProtoFile) Stat() (os.FileInfo, error)

func (*ProtoFile) Sync

func (pf *ProtoFile) Sync() error

func (*ProtoFile) Tell

func (pf *ProtoFile) Tell() int64

func (*ProtoFile) ValueStreamReader

func (pf *ProtoFile) ValueStreamReader(ctx context.Context, chanSize int) <-chan *oproto.ValueStream

func (*ProtoFile) Write

func (pf *ProtoFile) Write(message proto.Message) (int64, error)

func (*ProtoFile) WriteAt

func (pf *ProtoFile) WriteAt(pos int64, message proto.Message) (int64, error)

type ReaderWriter

type ReaderWriter interface {
	Close() error
	Stat() (os.FileInfo, error)
	Tell() int64
	Sync() error
	Seek(pos int64) (int64, error)
	Read(message proto.Message) (int64, error)
	ReadAt(pos int64, message proto.Message) (int64, error)
	ValueStreamReader(ctx context.Context, chanSize int) <-chan *oproto.ValueStream
	Write(message proto.Message) (int64, error)
	WriteAt(pos int64, message proto.Message) (int64, error)
}

func Read

func Read(filename string) (ReaderWriter, error)

func Write

func Write(filename string) (ReaderWriter, error)

Write creates a file handle for writing a protofile, returning a ProtoFile. After calling this, the file is opened for writing and the file position it the end of the file, ready for appending.

Jump to

Keyboard shortcuts

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