Documentation ¶
Index ¶
- func NewIterator(reader io.Reader, descr namespace.SchemaDescr, opts encoding.Options) encoding.ReaderIterator
- func ParseProtoSchema(filePath string, messageName string) (*desc.MessageDescriptor, error)
- type Encoder
- func (enc *Encoder) Bytes() ([]byte, error)
- func (enc *Encoder) Close()
- func (enc *Encoder) Discard() ts.Segment
- func (enc *Encoder) DiscardReset(start time.Time, capacity int, descr namespace.SchemaDescr) ts.Segment
- func (enc *Encoder) Encode(dp ts.Datapoint, timeUnit xtime.Unit, protoBytes ts.Annotation) error
- func (enc *Encoder) LastAnnotationChecksum() (uint64, error)
- func (enc *Encoder) LastEncoded() (ts.Datapoint, error)
- func (enc *Encoder) Len() int
- func (enc *Encoder) NumEncoded() int
- func (enc *Encoder) Reset(start time.Time, capacity int, descr namespace.SchemaDescr)
- func (enc *Encoder) SetSchema(descr namespace.SchemaDescr)
- func (enc *Encoder) Stats() EncoderStats
- func (enc *Encoder) Stream(ctx context.Context) (xio.SegmentReader, bool)
- type EncoderStats
- type Schema
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 ¶
NewEncoder creates a new protobuf encoder.
func (*Encoder) Bytes ¶
Bytes returns the raw bytes of the underlying data stream. Does not transfer ownership and is generally unsafe.
func (*Encoder) Discard ¶
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 ¶
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
LastAnnotation returns the checksum of the last encoded annotation (which contain the bytes used for ProtoBuf data).
func (*Encoder) LastEncoded ¶
LastEncoded returns the last encoded datapoint. Does not include annotation / protobuf message for interface purposes.
func (*Encoder) NumEncoded ¶
NumEncoded returns the number of encoded messages.
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.
type EncoderStats ¶ added in v0.8.4
EncoderStats contains statistics about the encoders compression performance.
type Schema ¶
type Schema *desc.MessageDescriptor
Schema represents a schema for a protobuf message.