Versions in this module Expand all Collapse all v3 v3.0.0 Apr 8, 2024 Changes in this version + const BloomFileName + const DefaultSchemaVersion + const FileMode + const MaxRuneLen + const SeriesFileName + const V1 + var BlockPool = BytePool + var Crc32HashPool = ChecksumPool + var DefaultBlockOptions = NewBlockOptions(0, 4, 1, 50 << 20) + var DefaultMaxPageSize = 64 << 20 + var ErrPageTooLarge = errors.Errorf("bloom page too large") + var FullBounds = NewBounds(0, model.Fingerprint(math.MaxUint64)) + var MatchAll = matchAllTest + func CollectInto[T any](itr Iterator[T], into []T) ([]T, error) + func Collect[T any](itr Iterator[T]) ([]T, error) + func EqualIterators[T any](t *testing.T, test func(a, b T), expected, actual Iterator[T]) + func ExtractTestableLineFilters(expr syntax.Expr) []syntax.LineFilterExpr + func Identity[A any](a A) A + func MakeBlock(t testing.TB, nth int, fromFp, throughFp model.Fingerprint, ...) (*Block, []SeriesWithBloom, [][][]byte) + func PointerSlice[T any](xs []T) []*T + func TarGz(dst io.Writer, reader BlockReader) error + func UnTarGz(dst string, r io.Reader) error + type Block struct + func NewBlock(reader BlockReader, metrics *Metrics) *Block + func (b *Block) LoadHeaders() error + func (b *Block) Metadata() (BlockMetadata, error) + func (b *Block) Reader() BlockReader + func (b *Block) Schema() (Schema, error) + type BlockBuilder struct + func NewBlockBuilder(opts BlockOptions, writer BlockWriter) (*BlockBuilder, error) + func (b *BlockBuilder) AddSeries(series SeriesWithBloom) (bool, error) + func (b *BlockBuilder) BuildFrom(itr Iterator[SeriesWithBloom]) (uint32, error) + func (b *BlockBuilder) Close() (uint32, error) + type BlockIndex struct + func (b *BlockIndex) DecodeHeaders(r io.ReadSeeker) (uint32, error) + func (b *BlockIndex) NewSeriesPageDecoder(r io.ReadSeeker, header SeriesPageHeaderWithOffset, metrics *Metrics) (res *SeriesPageDecoder, err error) + type BlockMetadata struct + Checksum uint32 + Options BlockOptions + Series SeriesHeader + type BlockOptions struct + BlockSize uint64 + BloomPageSize uint64 + Schema Schema + SeriesPageSize uint64 + func NewBlockOptions(enc chunkenc.Encoding, NGramLength, NGramSkip, MaxBlockSizeBytes uint64) BlockOptions + func NewBlockOptionsFromSchema(s Schema) BlockOptions + func (b *BlockOptions) DecodeFrom(r io.ReadSeeker) error + func (b BlockOptions) Encode(enc *encoding.Encbuf) + func (b BlockOptions) Len() int + type BlockQuerier struct + func NewBlockQuerier(b *Block, noCapture bool, maxPageSize int) *BlockQuerier + func (bq *BlockQuerier) At() *SeriesWithBloom + func (bq *BlockQuerier) CheckChunksForSeries(fp model.Fingerprint, chks ChunkRefs, searches [][]byte) (ChunkRefs, error) + func (bq *BlockQuerier) Err() error + func (bq *BlockQuerier) Fuse(inputs []PeekingIterator[Request], logger log.Logger) *FusedQuerier + func (bq *BlockQuerier) Metadata() (BlockMetadata, error) + func (bq *BlockQuerier) Next() bool + func (bq *BlockQuerier) Reset() error + func (bq *BlockQuerier) Schema() (Schema, error) + func (bq *BlockQuerier) Seek(fp model.Fingerprint) error + type BlockReader interface + Blooms func() (io.ReadSeeker, error) + Index func() (io.ReadSeeker, error) + TarEntries func() (Iterator[TarEntry], error) + type BlockWriter interface + Blooms func() (io.WriteCloser, error) + Index func() (io.WriteCloser, error) + Size func() (int, error) + type Bloom struct + func (b *Bloom) Decode(dec *encoding.Decbuf) error + func (b *Bloom) DecodeCopy(dec *encoding.Decbuf) error + func (b *Bloom) Encode(enc *encoding.Encbuf) error + type BloomBlock struct + func NewBloomBlock(encoding chunkenc.Encoding) BloomBlock + func (b *BloomBlock) BloomPageDecoder(r io.ReadSeeker, pageIdx int, maxPageSize int, metrics *Metrics) (res *BloomPageDecoder, err error) + func (b *BloomBlock) DecodeHeaders(r io.ReadSeeker) (uint32, error) + type BloomBlockBuilder struct + func NewBloomBlockBuilder(opts BlockOptions, writer io.WriteCloser) *BloomBlockBuilder + func (b *BloomBlockBuilder) Append(series SeriesWithBloom) (BloomOffset, error) + func (b *BloomBlockBuilder) Close() (uint32, error) + func (b *BloomBlockBuilder) WriteSchema() error + type BloomOffset struct + ByteOffset int + Page int + func (o *BloomOffset) Decode(dec *encoding.Decbuf, previousOffset BloomOffset) error + func (o *BloomOffset) Encode(enc *encoding.Encbuf, previousOffset BloomOffset) + type BloomPageDecoder struct + func LazyDecodeBloomPage(r io.Reader, pool chunkenc.ReaderPool, page BloomPageHeader) (*BloomPageDecoder, error) + func LazyDecodeBloomPageNoCompression(r io.Reader, page BloomPageHeader) (*BloomPageDecoder, error) + func NewBloomPageDecoder(data []byte) *BloomPageDecoder + func (d *BloomPageDecoder) At() *Bloom + func (d *BloomPageDecoder) Err() error + func (d *BloomPageDecoder) Next() bool + func (d *BloomPageDecoder) Relinquish() + func (d *BloomPageDecoder) Reset() + func (d *BloomPageDecoder) Seek(offset int) + type BloomPageHeader struct + DecompressedLen int + Len int + N int + Offset int + func (h *BloomPageHeader) Decode(dec *encoding.Decbuf) error + func (h *BloomPageHeader) Encode(enc *encoding.Encbuf) + type BloomQuerier interface + Seek func(BloomOffset) (*Bloom, error) + type BloomTest interface + Matches func(bloom filter.Checker) bool + MatchesWithPrefixBuf func(bloom filter.Checker, buf []byte, prefixLen int) bool + func FiltersToBloomTest(b NGramBuilder, filters ...syntax.LineFilterExpr) BloomTest + type BloomTests []BloomTest + func (b BloomTests) Matches(bloom filter.Checker) bool + func (b BloomTests) MatchesWithPrefixBuf(bloom filter.Checker, buf []byte, prefixLen int) bool + type BloomTokenizer struct + func NewBloomTokenizer(nGramLen, nGramSkip int, metrics *Metrics) *BloomTokenizer + func (bt *BloomTokenizer) N() uint64 + func (bt *BloomTokenizer) Populate(swb *SeriesWithBloom, chks Iterator[ChunkRefWithIter]) (int, error) + func (bt *BloomTokenizer) SkipFactor() uint64 + type BoundedIter struct + func NewBoundedIter[V any](itr Iterator[V], cmp func(V) BoundsCheck) *BoundedIter[V] + func (bi *BoundedIter[V]) Next() bool + type BoundsCheck uint8 + const After + const Before + const Overlap + type BytePool struct + func (p *BytePool) Get(size int) []byte + func (p *BytePool) Put(b []byte) + type ByteReader struct + func NewByteReader(index, blooms *bytes.Buffer) *ByteReader + func (r *ByteReader) Blooms() (io.ReadSeeker, error) + func (r *ByteReader) Index() (io.ReadSeeker, error) + func (r *ByteReader) TarEntries() (Iterator[TarEntry], error) + type CancellableIter struct + func NewCancelableIter[T any](ctx context.Context, itr Iterator[T]) *CancellableIter[T] + func (cii *CancellableIter[T]) Err() error + func (cii *CancellableIter[T]) Next() bool + type ChecksumPool struct + func (p *ChecksumPool) Get() hash.Hash32 + func (p *ChecksumPool) Put(h hash.Hash32) + type ChunkRef logproto.ShortRef + func (r *ChunkRef) Decode(dec *encoding.Decbuf, previousEnd model.Time) (model.Time, error) + func (r *ChunkRef) Encode(enc *encoding.Encbuf, previousEnd model.Time) model.Time + func (r *ChunkRef) Less(other ChunkRef) bool + type ChunkRefWithIter struct + Itr iter.EntryIterator + Ref ChunkRef + type ChunkRefs []ChunkRef + func (refs ChunkRefs) Compare(others ChunkRefs, populateInclusive bool) (exclusive ChunkRefs, inclusive ChunkRefs) + func (refs ChunkRefs) Len() int + func (refs ChunkRefs) Less(i, j int) bool + func (refs ChunkRefs) Swap(i, j int) + func (refs ChunkRefs) Unless(others []ChunkRef) ChunkRefs + type CloseIter struct + func NewCloseableIterator[T io.Closer](itr Iterator[T]) *CloseIter[T] + func (i *CloseIter[T]) Close() error + type CloseableIterator interface + Close func() error + type CloseableResettableIterator interface + type CounterIter struct + func NewCounterIter[T any](itr Iterator[T]) *CounterIter[T] + func (it *CounterIter[T]) Count() int + func (it *CounterIter[T]) Next() bool + type CounterIterator interface + Count func() int + type DedupeIter struct + func NewDedupingIter[A, B any](eq func(A, B) bool, from func(A) B, merge func(A, B) B, itr PeekingIterator[A]) *DedupeIter[A, B] + func (it *DedupeIter[A, B]) At() B + func (it *DedupeIter[A, B]) Err() error + func (it *DedupeIter[A, B]) Next() bool + type DirectoryBlockReader struct + func NewDirectoryBlockReader(dir string) *DirectoryBlockReader + func (r *DirectoryBlockReader) Blooms() (io.ReadSeeker, error) + func (r *DirectoryBlockReader) Index() (io.ReadSeeker, error) + func (r *DirectoryBlockReader) Init() error + func (r *DirectoryBlockReader) TarEntries() (Iterator[TarEntry], error) + type DirectoryBlockWriter struct + func NewDirectoryBlockWriter(dir string) *DirectoryBlockWriter + func (b *DirectoryBlockWriter) Blooms() (io.WriteCloser, error) + func (b *DirectoryBlockWriter) Index() (io.WriteCloser, error) + func (b *DirectoryBlockWriter) Init() error + func (b *DirectoryBlockWriter) Size() (int, error) + type EmptyIter struct + func NewEmptyIter[T any]() *EmptyIter[T] + func (it *EmptyIter[T]) At() T + func (it *EmptyIter[T]) Err() error + func (it *EmptyIter[T]) Next() bool + func (it *EmptyIter[T]) Reset() + type FilterIter struct + func NewFilterIter[T any](it Iterator[T], p Predicate[T]) *FilterIter[T] + func (i *FilterIter[T]) Next() bool + type FingerprintBounds struct + Max model.Fingerprint + Min model.Fingerprint + func BoundsFromProto(pb logproto.FPBounds) FingerprintBounds + func NewBounds(min, max model.Fingerprint) FingerprintBounds + func ParseBoundsFromAddr(s string) (FingerprintBounds, error) + func ParseBoundsFromParts(a, b string) (FingerprintBounds, error) + func (b FingerprintBounds) Bounds() (model.Fingerprint, model.Fingerprint) + func (b FingerprintBounds) Cmp(fp model.Fingerprint) BoundsCheck + func (b FingerprintBounds) Equal(target FingerprintBounds) bool + func (b FingerprintBounds) GetFromThrough() (model.Fingerprint, model.Fingerprint) + func (b FingerprintBounds) Hash(h hash.Hash32) error + func (b FingerprintBounds) Intersection(target FingerprintBounds) *FingerprintBounds + func (b FingerprintBounds) Less(other FingerprintBounds) bool + func (b FingerprintBounds) Match(fp model.Fingerprint) bool + func (b FingerprintBounds) Overlaps(target FingerprintBounds) bool + func (b FingerprintBounds) Range() uint64 + func (b FingerprintBounds) Slice(min, max model.Fingerprint) *FingerprintBounds + func (b FingerprintBounds) String() string + func (b FingerprintBounds) Union(target FingerprintBounds) (res []FingerprintBounds) + func (b FingerprintBounds) Unless(target FingerprintBounds) (res []FingerprintBounds) + func (b FingerprintBounds) Within(target FingerprintBounds) bool + type FusedQuerier struct + func NewFusedQuerier(bq *BlockQuerier, inputs []PeekingIterator[Request], logger log.Logger) *FusedQuerier + func (fq *FusedQuerier) Run() error + type HeapIterator struct + func NewHeapIterForSeriesWithBloom(queriers ...PeekingIterator[*SeriesWithBloom]) *HeapIterator[*SeriesWithBloom] + func NewHeapIterator[T any](less func(T, T) bool, itrs ...PeekingIterator[T]) *HeapIterator[T] + func (mbq *HeapIterator[T]) At() T + func (mbq *HeapIterator[T]) Err() error + func (mbq *HeapIterator[T]) Less(i, j int) bool + func (mbq *HeapIterator[T]) Next() (ok bool) + func (mbq *HeapIterator[T]) Swap(a, b int) + func (mbq HeapIterator[T]) Len() int + type IndexBuilder struct + func NewIndexBuilder(opts BlockOptions, writer io.WriteCloser) *IndexBuilder + func (b *IndexBuilder) Append(series SeriesWithOffset) error + func (b *IndexBuilder) Close() (uint32, error) + func (b *IndexBuilder) WriteOpts() error + type IndexedValue struct + func (iv IndexedValue[T]) Index() int + func (iv IndexedValue[T]) Value() T + type IterWithIndex struct + func (it *IterWithIndex[T]) At() IndexedValue[T] + type Iterator interface + At func() T + Err func() error + Next func() bool + func NewIterWithIndex[T any](iter Iterator[T], idx int) Iterator[IndexedValue[T]] + type LazyBloomIter struct + func NewLazyBloomIter(b *Block, pool bool, maxSize int) *LazyBloomIter + func (it *LazyBloomIter) At() *Bloom + func (it *LazyBloomIter) Err() error + func (it *LazyBloomIter) Next() bool + func (it *LazyBloomIter) Seek(offset BloomOffset) + type LazySeriesIter struct + func NewLazySeriesIter(b *Block) *LazySeriesIter + func (it *LazySeriesIter) At() *SeriesWithOffset + func (it *LazySeriesIter) Err() error + func (it *LazySeriesIter) Next() bool + func (it *LazySeriesIter) Seek(fp model.Fingerprint) error + type MapIter struct + func NewMapIter[A any, B any](src Iterator[A], f func(A) B) *MapIter[A, B] + func (it *MapIter[A, B]) At() B + type MemoryBlockWriter struct + func NewMemoryBlockWriter(index, blooms *bytes.Buffer) MemoryBlockWriter + func (b MemoryBlockWriter) Blooms() (io.WriteCloser, error) + func (b MemoryBlockWriter) Index() (io.WriteCloser, error) + func (b MemoryBlockWriter) Size() (int, error) + type MergeBuilder struct + func NewMergeBuilder(blocks Iterator[*SeriesWithBloom], store Iterator[*Series], ...) *MergeBuilder + func (mb *MergeBuilder) Build(builder *BlockBuilder) (checksum uint32, totalBytes int, err error) + type Metrics struct + func NewMetrics(r prometheus.Registerer) *Metrics + type MultiFingerprintBounds []FingerprintBounds + func MultiBoundsFromProto(pb []logproto.FPBounds) MultiFingerprintBounds + func (mb MultiFingerprintBounds) Union(target FingerprintBounds) MultiFingerprintBounds + type NGramBuilder interface + N func() int + SkipFactor func() int + Tokens func(line string) Iterator[[]byte] + type NGramTokenIter struct + func (t *NGramTokenIter) At() []byte + func (t *NGramTokenIter) Err() error + func (t *NGramTokenIter) Next() bool + type NGramTokenizer struct + func NewNGramTokenizer(n, skip int) *NGramTokenizer + func (t *NGramTokenizer) N() int + func (t *NGramTokenizer) SkipFactor() int + func (t *NGramTokenizer) Tokens(line string) Iterator[[]byte] + type NoopCloser struct + func NewNoopCloser(w io.Writer) NoopCloser + func (n NoopCloser) Close() error + type Ord byte + const Eq + const Greater + const Less + type Orderable interface + Compare func(T) Ord + type OrderedImpl struct + func NewOrderable[T any](val T, cmp func(T, T) Ord) OrderedImpl[T] + func (o OrderedImpl[T]) Compare(other OrderedImpl[T]) Ord + func (o OrderedImpl[T]) Unwrap() T + type Output struct + Fp model.Fingerprint + Removals ChunkRefs + type PageWriter struct + func NewPageWriter(targetSize int) PageWriter + func (w *PageWriter) Add(item []byte) (offset int) + func (w *PageWriter) Count() int + func (w *PageWriter) Reset() + func (w *PageWriter) SpaceFor(numBytes int) bool + type PeekCloseIter struct + func NewPeekCloseIter[T any](itr CloseableIterator[T]) *PeekCloseIter[T] + func (it *PeekCloseIter[T]) Close() error + type PeekIter struct + func NewPeekingIter[T any](itr Iterator[T]) *PeekIter[T] + func (it *PeekIter[T]) At() T + func (it *PeekIter[T]) Err() error + func (it *PeekIter[T]) Next() bool + func (it *PeekIter[T]) Peek() (T, bool) + type PeekingCloseableIterator interface + type PeekingIterator interface + Peek func() (T, bool) + func NewSliceIterWithIndex[T any](xs []T, idx int) PeekingIterator[IndexedValue[T]] + type Predicate func(T) bool + type PrefixedTokenIter struct + func NewPrefixedTokenIter(buf []byte, prefixLn int, iter Iterator[[]byte]) *PrefixedTokenIter + func (t *PrefixedTokenIter) At() []byte + type Request struct + Chks ChunkRefs + Fp model.Fingerprint + Response chan<- Output + Search BloomTest + type ResettableIterator interface + Reset func() error + type Schema struct + func (s *Schema) CompressorPool() chunkenc.WriterPool + func (s *Schema) Decode(dec *encoding.Decbuf) error + func (s *Schema) DecodeFrom(r io.ReadSeeker) error + func (s *Schema) DecompressorPool() chunkenc.ReaderPool + func (s *Schema) Encode(enc *encoding.Encbuf) + func (s Schema) Compatible(other Schema) bool + func (s Schema) Len() int + func (s Schema) NGramLen() int + func (s Schema) NGramSkip() int + func (s Schema) String() string + type SeekIter interface + Seek func(K) error + type Series struct + Chunks ChunkRefs + Fingerprint model.Fingerprint + type SeriesHeader struct + Bounds FingerprintBounds + FromTs model.Time + NumSeries int + ThroughTs model.Time + func (h *SeriesHeader) Decode(dec *encoding.Decbuf) error + func (h *SeriesHeader) Encode(enc *encoding.Encbuf) + type SeriesIterator interface + Reset func() + type SeriesPageDecoder struct + func (d *SeriesPageDecoder) At() (res *SeriesWithOffset) + func (d *SeriesPageDecoder) Err() error + func (d *SeriesPageDecoder) Next() bool + func (d *SeriesPageDecoder) Reset() + func (d *SeriesPageDecoder) Seek(fp model.Fingerprint) + type SeriesPageHeaderWithOffset struct + DecompressedLen int + Len int + Offset int + func (h *SeriesPageHeaderWithOffset) Decode(dec *encoding.Decbuf) error + func (h *SeriesPageHeaderWithOffset) Encode(enc *encoding.Encbuf) + type SeriesWithBloom struct + Bloom *Bloom + Series *Series + func MkBasicSeriesWithBlooms(nSeries, _ int, fromFp, throughFp model.Fingerprint, ...) (seriesList []SeriesWithBloom, keysList [][][]byte) + type SeriesWithOffset struct + Offset BloomOffset + func (s *SeriesWithOffset) Decode(dec *encoding.Decbuf, previousFp model.Fingerprint, previousOffset BloomOffset) (model.Fingerprint, BloomOffset, error) + func (s *SeriesWithOffset) Encode(enc *encoding.Encbuf, previousFp model.Fingerprint, previousOffset BloomOffset) (model.Fingerprint, BloomOffset) + type SliceIter struct + func NewSliceIter[T any](xs []T) *SliceIter[T] + func (it *SliceIter[T]) At() T + func (it *SliceIter[T]) Err() error + func (it *SliceIter[T]) Len() int + func (it *SliceIter[T]) Next() bool + type SliceIterWithIndex struct + func (it *SliceIterWithIndex[T]) At() IndexedValue[T] + func (it *SliceIterWithIndex[T]) Err() error + func (it *SliceIterWithIndex[T]) Next() bool + func (it *SliceIterWithIndex[T]) Peek() (IndexedValue[T], bool) + type TarEntry struct + Body io.ReadSeeker + Name string + Size int64 + type UnlessIterator struct + func NewUnlessIterator[T Orderable[T]](a, b Iterator[T]) *UnlessIterator[T] + func (it *UnlessIterator[T]) At() T + func (it *UnlessIterator[T]) Err() error + func (it *UnlessIterator[T]) Next() bool