Documentation ¶
Index ¶
- Constants
- func NewDecoder(intOptimized bool, opts encoding.Options) encoding.Decoder
- func NewEncoder(start time.Time, bytes checked.Bytes, intOptimized bool, opts encoding.Options) encoding.Encoder
- func NewReaderIterator(reader io.Reader, intOptimized bool, opts encoding.Options) encoding.ReaderIterator
- type FloatEncoderAndIterator
- type IntSigBitsTracker
- type TimestampEncoder
- func (enc *TimestampEncoder) WriteFirstTime(stream encoding.OStream, currTime time.Time, ant ts.Annotation, ...) error
- func (enc *TimestampEncoder) WriteNextTime(stream encoding.OStream, currTime time.Time, ant ts.Annotation, ...) error
- func (enc *TimestampEncoder) WriteTime(stream encoding.OStream, currTime time.Time, ant ts.Annotation, ...) error
- func (enc *TimestampEncoder) WriteTimeUnit(stream encoding.OStream, timeUnit xtime.Unit)
- type TimestampIterator
Constants ¶
const ( // DefaultIntOptimizationEnabled is the default switch for m3tsz int optimization DefaultIntOptimizationEnabled = true // OpcodeZeroSig indicates that there were zero significant digits. OpcodeZeroSig = 0x0 // OpcodeNonZeroSig indicates that there were a non-zero number of significant digits. OpcodeNonZeroSig = 0x1 // NumSigBits is the number of bits required to encode the maximum possible value // of significant digits. NumSigBits = 6 )
Variables ¶
This section is empty.
Functions ¶
func NewDecoder ¶
NewDecoder creates a decoder.
func NewEncoder ¶
func NewEncoder( start time.Time, bytes checked.Bytes, intOptimized bool, opts encoding.Options, ) encoding.Encoder
NewEncoder creates a new encoder.
func NewReaderIterator ¶
func NewReaderIterator(reader io.Reader, intOptimized bool, opts encoding.Options) encoding.ReaderIterator
NewReaderIterator returns a new iterator for a given reader
Types ¶
type FloatEncoderAndIterator ¶ added in v0.8.2
type FloatEncoderAndIterator struct { PrevXOR uint64 PrevFloatBits uint64 // Only taken into account if using the WriteFloat() and ReadFloat() // APIs. NotFirst bool }
FloatEncoderAndIterator encapsulates the state required for a logical stream of bits that represent a stream of float values compressed with XOR.
func (*FloatEncoderAndIterator) ReadFloat ¶ added in v0.8.2
func (eit *FloatEncoderAndIterator) ReadFloat(stream encoding.IStream) error
ReadFloat reads a compressed float from the stream.
func (*FloatEncoderAndIterator) WriteFloat ¶ added in v0.8.2
func (eit *FloatEncoderAndIterator) WriteFloat(stream encoding.OStream, val float64)
WriteFloat writes a float into the stream, writing the full value or a compressed XOR as appropriate.
type IntSigBitsTracker ¶ added in v0.8.2
type IntSigBitsTracker struct { NumSig uint8 // current largest number of significant places for int diffs CurHighestLowerSig uint8 NumLowerSig uint8 }
IntSigBitsTracker is used to track the number of significant bits which should be used to encode the delta between two integers.
func (*IntSigBitsTracker) TrackNewSig ¶ added in v0.8.2
func (t *IntSigBitsTracker) TrackNewSig(numSig uint8) uint8
TrackNewSig gets the new number of significant bits given the number of significant bits of the current diff. It takes into account thresholds to try and find a value that's best for the current data
func (*IntSigBitsTracker) WriteIntSig ¶ added in v0.8.2
func (t *IntSigBitsTracker) WriteIntSig(stream encoding.OStream, sig uint8)
WriteIntSig writes the number of significant bits of the diff if it has changed and updates the IntSigBitsTracker.
func (*IntSigBitsTracker) WriteIntValDiff ¶ added in v0.8.2
func (t *IntSigBitsTracker) WriteIntValDiff( stream encoding.OStream, valBits uint64, neg bool)
WriteIntValDiff writes the provided val diff bits along with whether the bits are negative or not.
type TimestampEncoder ¶ added in v0.8.2
type TimestampEncoder struct { PrevTime time.Time PrevTimeDelta time.Duration PrevAnnotation []byte Options encoding.Options TimeUnit xtime.Unit // contains filtered or unexported fields }
TimestampEncoder encapsulates the state required for a logical stream of bits that represent a stream of timestamps compressed using delta-of-delta
func NewTimestampEncoder ¶ added in v0.8.2
func NewTimestampEncoder( start time.Time, timeUnit xtime.Unit, opts encoding.Options) TimestampEncoder
NewTimestampEncoder creates a new TimestampEncoder.
func (*TimestampEncoder) WriteFirstTime ¶ added in v0.8.2
func (enc *TimestampEncoder) WriteFirstTime( stream encoding.OStream, currTime time.Time, ant ts.Annotation, timeUnit xtime.Unit) error
WriteFirstTime encodes the first timestamp.
func (*TimestampEncoder) WriteNextTime ¶ added in v0.8.2
func (enc *TimestampEncoder) WriteNextTime( stream encoding.OStream, currTime time.Time, ant ts.Annotation, timeUnit xtime.Unit) error
WriteNextTime encodes the next (non-first) timestamp.
func (*TimestampEncoder) WriteTime ¶ added in v0.8.2
func (enc *TimestampEncoder) WriteTime( stream encoding.OStream, currTime time.Time, ant ts.Annotation, timeUnit xtime.Unit) error
WriteTime encode the timestamp using delta-of-delta compression.
func (*TimestampEncoder) WriteTimeUnit ¶ added in v0.8.2
func (enc *TimestampEncoder) WriteTimeUnit(stream encoding.OStream, timeUnit xtime.Unit)
WriteTimeUnit writes the new time unit into the stream. It exists as a standalone method so that other calls can encode time unit changes without relying on the marker scheme.
type TimestampIterator ¶ added in v0.8.2
type TimestampIterator struct { PrevTime xtime.UnixNano PrevTimeDelta time.Duration PrevAnt ts.Annotation TimeUnit xtime.Unit Opts encoding.Options TimeUnitChanged bool Done bool // Controls whether the iterator will "look ahead" for marker encoding // schemes. Setting SkipMarkers to true disables the look ahead behavior // for situations where looking ahead is not safe. SkipMarkers bool // contains filtered or unexported fields }
TimestampIterator encapsulates all the state required for iterating over delta-of-delta compresed timestamps.
func NewTimestampIterator ¶ added in v0.8.2
func NewTimestampIterator(opts encoding.Options, skipMarkers bool) TimestampIterator
NewTimestampIterator creates a new TimestampIterator.
func (*TimestampIterator) ReadTimeUnit ¶ added in v0.8.2
func (it *TimestampIterator) ReadTimeUnit(stream encoding.IStream) error
ReadTimeUnit reads an encoded time unit and updates the iterator's state accordingly. It is exposed as a public method so that callers can control the encoding / decoding of the time unit on their own if they choose.
func (*TimestampIterator) ReadTimestamp ¶ added in v0.8.2
ReadTimestamp reads the first or next timestamp.