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
- Variables
- type MessageReader
- type MessageReaderCheckpoint
- type ReadContext
- func (r *ReadContext) ExpectMagic(magic int32) error
- func (r *ReadContext) GetSource() savior.Source
- func (r *ReadContext) PopCheckpoint() *MessageReaderCheckpoint
- func (r *ReadContext) ReadMessage(msg proto.Message) error
- func (r *ReadContext) Resume(checkpoint *MessageReaderCheckpoint) error
- func (r *ReadContext) WantSave()
- type Sample
- type WriteContext
Constants ¶
const DebugWire = false
DebugWire controls debug printouts of wharf's wire format
Variables ¶
var Endianness = binary.LittleEndian
Endianness is the byte order of everything in wharf's wire format
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) ProtoMessage ¶
func (*Sample) ProtoMessage()
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