Documentation ¶
Index ¶
Constants ¶
const ( OutOfOrderMask = 0b10000000 EncOOOXOR = EncXOR | OutOfOrderMask )
Chunk encodings for out-of-order chunks. These encodings must be only used by the Head block for its internal bookkeeping.
Variables ¶
This section is empty.
Functions ¶
func IsOutOfOrderChunk ¶ added in v0.39.0
func IsValidEncoding ¶ added in v0.39.0
Types ¶
type Chunk ¶
type Chunk interface { // Bytes returns the underlying byte slice of the chunk. Bytes() []byte // Encoding returns the encoding type of the chunk. Encoding() Encoding // Appender returns an appender to append samples to the chunk. Appender() (Appender, error) // The iterator passed as argument is for re-use. // Depending on implementation, the iterator can // be re-used or a new iterator can be allocated. Iterator(Iterator) Iterator // NumSamples returns the number of samples in the chunk. NumSamples() int // Compact is called whenever a chunk is expected to be complete (no more // samples appended) and the underlying implementation can eventually // optimize the chunk. // There's no strong guarantee that no samples will be appended once // Compact() is called. Implementing this function is optional. Compact() }
Chunk holds a sequence of sample pairs that can be iterated over and appended to.
type Iterator ¶
type Iterator interface { // Next advances the iterator by one. Next() bool // Seek advances the iterator forward to the first sample with the timestamp equal or greater than t. // If current sample found by previous `Next` or `Seek` operation already has this property, Seek has no effect. // Seek returns true, if such sample exists, false otherwise. // Iterator is exhausted when the Seek returns false. Seek(t int64) bool // At returns the current timestamp/value pair. // Before the iterator has advanced At behaviour is unspecified. At() (int64, float64) // Err returns the current error. It should be used only after iterator is // exhausted, that is `Next` or `Seek` returns false. Err() error }
Iterator is a simple iterator that can only get the next value. Iterator iterates over the samples of a time series, in timestamp-increasing order.
func MockSeriesIterator ¶
MockSeriesIterator returns an iterator for a mock series with custom timeStamps and values.
func NewNopIterator ¶
func NewNopIterator() Iterator
NewNopIterator returns a new chunk iterator that does not hold any data.
type OOOXORChunk ¶ added in v0.39.0
type OOOXORChunk struct {
*XORChunk
}
OOOXORChunk holds a XORChunk and overrides the Encoding() method.
func (*OOOXORChunk) Encoding ¶ added in v0.39.0
func (c *OOOXORChunk) Encoding() Encoding
type XORChunk ¶
type XORChunk struct {
// contains filtered or unexported fields
}
XORChunk holds XOR encoded sample data.
func NewXORChunk ¶
func NewXORChunk() *XORChunk
NewXORChunk returns a new chunk with XOR encoding of the given size.
func (*XORChunk) Appender ¶
Appender implements the Chunk interface. It is not valid to call Appender() multiple times concurrently or to use multiple Appenders on the same chunk.
func (*XORChunk) Iterator ¶
Iterator implements the Chunk interface. Iterator() must not be called concurrently with any modifications to the chunk, but after it returns you can use an Iterator concurrently with an Appender or other Iterators.
func (*XORChunk) NumSamples ¶
NumSamples returns the number of samples in the chunk.