iter

package
v0.0.0-...-360277a Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoopIterator = noOpIterator{}

Functions

func ReadBatch

func ReadBatch(i EntryIterator, size uint32) (*logproto.QueryResponse, uint32, error)

ReadBatch reads a set of entries off an iterator.

func ReadSampleBatch

func ReadSampleBatch(i SampleIterator, size uint32) (*logproto.SampleQueryResponse, uint32, error)

ReadBatch reads a set of entries off an iterator.

Types

type CacheEntryIterator

type CacheEntryIterator interface {
	EntryIterator
	Reset()
}

func NewCachedIterator

func NewCachedIterator(it EntryIterator, cap int) CacheEntryIterator

NewCachedIterator creates an iterator that cache iteration result and can be iterated again after closing it without re-using the underlaying iterator `it`.

type CacheSampleIterator

type CacheSampleIterator interface {
	SampleIterator
	Reset()
}

func NewCachedSampleIterator

func NewCachedSampleIterator(it SampleIterator, cap int) CacheSampleIterator

newSampleCachedIterator creates an iterator that cache iteration result and can be iterated again after closing it without re-using the underlaying iterator `it`.

type EntryIterator

type EntryIterator interface {
	Next() bool
	Entry() logproto.Entry
	Labels() string
	Error() error
	Close() error
}

EntryIterator iterates over entries in time-order.

func NewEntryReversedIter

func NewEntryReversedIter(it EntryIterator) (EntryIterator, error)

NewEntryReversedIter returns an iterator which loads all entries and iterates backward. The labels of entries is always empty.

func NewNonOverlappingIterator

func NewNonOverlappingIterator(iterators []EntryIterator, labels string) EntryIterator

NewNonOverlappingIterator gives a chained iterator over a list of iterators.

func NewQueryClientIterator

func NewQueryClientIterator(client logproto.Querier_QueryClient, direction logproto.Direction) EntryIterator

NewQueryClientIterator returns an iterator over a QueryClient.

func NewQueryResponseIterator

func NewQueryResponseIterator(ctx context.Context, resp *logproto.QueryResponse, direction logproto.Direction) EntryIterator

NewQueryResponseIterator returns an iterator over a QueryResponse.

func NewReversedIter

func NewReversedIter(it EntryIterator, limit uint32, preload bool) (EntryIterator, error)

NewReversedIter returns an iterator which loads all or up to N entries of an existing iterator, and then iterates over them backward. Preload entries when they are being queried with a timeout.

func NewStreamIterator

func NewStreamIterator(stream logproto.Stream) EntryIterator

NewStreamIterator iterates over entries in a stream.

func NewStreamsIterator

func NewStreamsIterator(ctx context.Context, streams []logproto.Stream, direction logproto.Direction) EntryIterator

NewStreamsIterator returns an iterator over logproto.Stream

func NewTimeRangedIterator

func NewTimeRangedIterator(it EntryIterator, mint, maxt time.Time) EntryIterator

NewTimeRangedIterator returns an iterator which filters entries by time range. Note: Only works with iterators that go forwards.

type HeapIterator

type HeapIterator interface {
	EntryIterator
	Peek() time.Time
	Len() int
	Push(EntryIterator)
}

HeapIterator iterates over a heap of iterators with ability to push new iterators and get some properties like time of entry at peek and len Not safe for concurrent use

func NewHeapIterator

func NewHeapIterator(ctx context.Context, is []EntryIterator, direction logproto.Direction) HeapIterator

NewHeapIterator returns a new iterator which uses a heap to merge together entries for multiple interators.

type PeekingEntryIterator

type PeekingEntryIterator interface {
	EntryIterator
	Peek() (string, logproto.Entry, bool)
}

PeekingEntryIterator is an entry iterator that can look ahead an entry using `Peek` without advancing its cursor.

func NewPeekingIterator

func NewPeekingIterator(iter EntryIterator) PeekingEntryIterator

NewPeekingIterator creates a new peeking iterator.

type PeekingSampleIterator

type PeekingSampleIterator interface {
	SampleIterator
	Peek() (string, logproto.Sample, bool)
}

PeekingSampleIterator is a sample iterator that can peek sample without moving the current sample.

func NewPeekingSampleIterator

func NewPeekingSampleIterator(iter SampleIterator) PeekingSampleIterator

type QuerySampleClient

type QuerySampleClient interface {
	Recv() (*logproto.SampleQueryResponse, error)
	Context() context.Context
	CloseSend() error
}

QuerySampleClient is GRPC stream client with only method used by the SampleQueryClientIterator

type SampleIterator

type SampleIterator interface {
	Next() bool
	// todo(ctovena) we should add `Seek(t int64) bool`
	// This way we can skip when ranging over samples.
	Sample() logproto.Sample
	Labels() string
	Error() error
	Close() error
}

SampleIterator iterates over samples in time-order.

func NewHeapSampleIterator

func NewHeapSampleIterator(ctx context.Context, is []SampleIterator) SampleIterator

NewHeapSampleIterator returns a new iterator which uses a heap to merge together entries for multiple iterators.

func NewMultiSeriesIterator

func NewMultiSeriesIterator(ctx context.Context, series []logproto.Series) SampleIterator

NewMultiSeriesIterator returns an iterator over multiple logproto.Series

func NewNonOverlappingSampleIterator

func NewNonOverlappingSampleIterator(iterators []SampleIterator, labels string) SampleIterator

NewNonOverlappingSampleIterator gives a chained iterator over a list of iterators.

func NewSampleQueryClientIterator

func NewSampleQueryClientIterator(client QuerySampleClient) SampleIterator

NewQueryClientIterator returns an iterator over a QueryClient.

func NewSampleQueryResponseIterator

func NewSampleQueryResponseIterator(ctx context.Context, resp *logproto.SampleQueryResponse) SampleIterator

NewSampleQueryResponseIterator returns an iterator over a SampleQueryResponse.

func NewSeriesIterator

func NewSeriesIterator(series logproto.Series) SampleIterator

NewSeriesIterator iterates over sample in a series.

func NewTimeRangedSampleIterator

func NewTimeRangedSampleIterator(it SampleIterator, mint, maxt int64) SampleIterator

NewTimeRangedSampleIterator returns an iterator which filters entries by time range.

Jump to

Keyboard shortcuts

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