proto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 25 Imported by: 5 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIterator

func NewIterator(
	reader io.Reader,
	descr namespace.SchemaDescr,
	opts encoding.Options,
) encoding.ReaderIterator

NewIterator creates a new iterator.

func ParseProtoSchema

func ParseProtoSchema(filePath string, messageName string) (*desc.MessageDescriptor, error)

ParseProtoSchema parses a Protobuf schema. TODO(rartoul): This is temporary code that will eventually be replaced with storing the schemas in etcd.

Types

type Encoder

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

Encoder compresses arbitrary ProtoBuf streams given a schema.

func NewEncoder

func NewEncoder(start time.Time, opts encoding.Options) *Encoder

NewEncoder creates a new protobuf encoder.

func (*Encoder) Bytes

func (enc *Encoder) Bytes() ([]byte, error)

Bytes returns the raw bytes of the underlying data stream. Does not transfer ownership and is generally unsafe.

func (*Encoder) Close

func (enc *Encoder) Close()

Close closes the encoder.

func (*Encoder) Discard

func (enc *Encoder) Discard() ts.Segment

Discard closes the encoder and transfers ownership of the data stream to the caller.

func (*Encoder) DiscardReset

func (enc *Encoder) DiscardReset(start time.Time, capacity int, descr namespace.SchemaDescr) ts.Segment

DiscardReset does the same thing as Discard except it also resets the encoder for reuse.

func (*Encoder) Encode

func (enc *Encoder) Encode(dp ts.Datapoint, timeUnit xtime.Unit, protoBytes ts.Annotation) error

Encode encodes a timestamp and a protobuf message. The function signature is strange in order to implement the encoding.Encoder interface. It accepts a ts.Datapoint, but only the Timestamp field will be used, the Value field will be ignored and will always return 0 on subsequent iteration. In addition, the provided annotation is expected to be a marshalled protobuf message that matches the configured schema.

func (*Encoder) LastAnnotationChecksum added in v1.0.0

func (enc *Encoder) LastAnnotationChecksum() (uint64, error)

LastAnnotation returns the checksum of the last encoded annotation (which contain the bytes used for ProtoBuf data).

func (*Encoder) LastEncoded

func (enc *Encoder) LastEncoded() (ts.Datapoint, error)

LastEncoded returns the last encoded datapoint. Does not include annotation / protobuf message for interface purposes.

func (*Encoder) Len

func (enc *Encoder) Len() int

Len returns the length of the data stream.

func (*Encoder) NumEncoded

func (enc *Encoder) NumEncoded() int

NumEncoded returns the number of encoded messages.

func (*Encoder) Reset

func (enc *Encoder) Reset(
	start time.Time,
	capacity int,
	descr namespace.SchemaDescr,
)

Reset resets the encoder for reuse.

func (*Encoder) SetSchema

func (enc *Encoder) SetSchema(descr namespace.SchemaDescr)

SetSchema sets the schema for the encoder.

func (*Encoder) Stats added in v0.8.4

func (enc *Encoder) Stats() EncoderStats

Stats returns EncoderStats which contain statistics about the encoders compression ratio.

func (*Encoder) Stream

func (enc *Encoder) Stream(ctx context.Context) (xio.SegmentReader, bool)

Stream returns a copy of the underlying data stream.

type EncoderStats added in v0.8.4

type EncoderStats struct {
	UncompressedBytes int
	CompressedBytes   int
}

EncoderStats contains statistics about the encoders compression performance.

type Schema

type Schema *desc.MessageDescriptor

Schema represents a schema for a protobuf message.

Jump to

Keyboard shortcuts

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