iter

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 60

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoopIterator = noOpIterator{}

Functions

func ReadBatch added in v0.2.0

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

ReadBatch reads a set of entries off an iterator.

func ReadSampleBatch added in v1.6.0

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

ReadBatch reads a set of entries off an iterator.

Types

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 added in v1.5.0

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 added in v1.3.0

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 added in v0.2.0

func NewStreamIterator(stream logproto.Stream) EntryIterator

NewStreamIterator iterates over entries in a stream.

func NewStreamsIterator added in v0.4.0

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.

type HeapIterator added in v0.2.0

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 added in v0.4.0

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 added in v0.4.0

func NewPeekingIterator(iter EntryIterator) PeekingEntryIterator

NewPeekingIterator creates a new peeking iterator.

type PeekingSampleIterator added in v1.6.0

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 added in v1.6.0

func NewPeekingSampleIterator(iter SampleIterator) PeekingSampleIterator

type QuerySampleClient added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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

NewMultiSeriesIterator returns an iterator over multiple logproto.Series

func NewNonOverlappingSampleIterator added in v1.6.0

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

NewNonOverlappingSampleIterator gives a chained iterator over a list of iterators.

func NewSampleQueryClientIterator added in v1.6.0

func NewSampleQueryClientIterator(client QuerySampleClient) SampleIterator

NewQueryClientIterator returns an iterator over a QueryClient.

func NewSampleQueryResponseIterator added in v1.6.0

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

NewSampleQueryResponseIterator returns an iterator over a SampleQueryResponse.

func NewSeriesIterator added in v1.6.0

func NewSeriesIterator(series logproto.Series) SampleIterator

NewSeriesIterator iterates over sample in a series.

func NewTimeRangedSampleIterator added in v1.6.0

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