wire

package
v0.0.0-...-189a019 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 9 Imported by: 23

Documentation

Overview

Package wire is a generated protocol buffer package.

It is generated from these files:

wire/wire.proto

It has these top-level messages:

Sample

Index

Constants

View Source
const DebugWire = false

DebugWire controls debug printouts of wharf's wire format

Variables

View Source
var Endianness = binary.LittleEndian

Endianness is the byte order of everything in wharf's wire format

View Source
var (
	// ErrFormat is returned when we find a magic number that isn't the one we expected
	ErrFormat = fmt.Errorf("wrong magic (invalid input file)")
)

Functions

This section is empty.

Types

type MessageReader

type MessageReader interface {
	// Resume returns an error it was unable
	// to resume from the given checkpoint, and
	// returns nil otherwise.
	Resume(checkpoint *MessageReaderCheckpoint) error

	// ExpectMagic ensures that a given magic number is
	// contained in the wire format
	ExpectMagic(magic int32) error

	// ReadMessage reads a protobuf message
	ReadMessage(msg proto.Message) error

	// Signal that we want to save as soon as possible
	// This may be called any number of times
	WantSave()

	// PopCheckpoint returns the last made checkpoint
	// if ready, or nil if there are none ready
	PopCheckpoint() *MessageReaderCheckpoint
}

type MessageReaderCheckpoint

type MessageReaderCheckpoint struct {
	Offset           int64
	SourceCheckpoint *savior.SourceCheckpoint
}

type ReadContext

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

ReadContext holds state of a wharf wire format reader

func NewReadContext

func NewReadContext(source savior.Source) *ReadContext

NewReadContext builds a new ReadContext that reads from a given reader

func (*ReadContext) ExpectMagic

func (r *ReadContext) ExpectMagic(magic int32) error

ExpectMagic returns an error if the next 32-bit int is not the magic number specified

func (*ReadContext) GetSource

func (r *ReadContext) GetSource() savior.Source

func (*ReadContext) PopCheckpoint

func (r *ReadContext) PopCheckpoint() *MessageReaderCheckpoint

func (*ReadContext) ReadMessage

func (r *ReadContext) ReadMessage(msg proto.Message) error

ReadMessage deserializes a protobuf message from the underlying reader

func (*ReadContext) Resume

func (r *ReadContext) Resume(checkpoint *MessageReaderCheckpoint) error

func (*ReadContext) WantSave

func (r *ReadContext) WantSave()

type Sample

type Sample struct {
	Data   []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	Number int64  `protobuf:"varint,2,opt,name=number" json:"number,omitempty"`
	Eof    bool   `protobuf:"varint,3,opt,name=eof" json:"eof,omitempty"`
}

func (*Sample) Descriptor

func (*Sample) Descriptor() ([]byte, []int)

func (*Sample) GetData

func (m *Sample) GetData() []byte

func (*Sample) GetEof

func (m *Sample) GetEof() bool

func (*Sample) GetNumber

func (m *Sample) GetNumber() int64

func (*Sample) ProtoMessage

func (*Sample) ProtoMessage()

func (*Sample) Reset

func (m *Sample) Reset()

func (*Sample) String

func (m *Sample) String() string

type WriteContext

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

WriteContext holds state of a wharf wire format writer

func NewWriteContext

func NewWriteContext(writer io.Writer) *WriteContext

NewWriteContext builds a new WriteContext that writes to a given writer

func (*WriteContext) Close

func (w *WriteContext) Close() error

Close closes the underlying writer if it implements io.Closer

func (*WriteContext) WriteMagic

func (w *WriteContext) WriteMagic(magic int32) error

WriteMagic writes a 32-bit magic integer to identify the file's type

func (*WriteContext) WriteMessage

func (w *WriteContext) WriteMessage(msg proto.Message) error

WriteMessage serializes a protobuf message and writes it to the stream

func (*WriteContext) Writer

func (w *WriteContext) Writer() io.Writer

Writer returns writer a WriteContext writes to

Jump to

Keyboard shortcuts

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