Documentation ¶
Index ¶
- func ReadBatch[T any](ctx context.Context, iterator Iterator[T], batchSize int, ...) error
- func Slice[T any](it Iterator[T]) ([]T, error)
- type Iterator
- func CloneN[T any](it Iterator[T], n int) ([]Iterator[T], error)
- func NewErrIterator[A any](err error) Iterator[A]
- func NewSliceIterator[A any](s []A) Iterator[A]
- func NewSortProfileIterator[P Profile](iters []Iterator[P]) Iterator[P]
- func NewTimeRangedIterator[T Timestamp](it Iterator[T], min, max model.Time) Iterator[T]
- type Profile
- type ProfileIteratorHeap
- type SeekIterator
- type SortIterator
- type TimeRangedIterator
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadBatch ¶
func ReadBatch[T any](ctx context.Context, iterator Iterator[T], batchSize int, fn func(context.Context, []T) error) error
ReadBatch reads profiles from the iterator in batches and call fn. If fn returns an error, the iteration is stopped and the error is returned. The array passed in fn is reused between calls, so it should be copied if needed.
Types ¶
type Iterator ¶
type Iterator[A any] interface { // Next advances the iterator and returns true if another value was found. Next() bool // At returns the value at the current iterator position. At() A // Err returns the last error of the iterator. Err() error Close() error }
func CloneN ¶
CloneN returns N copy of the iterator. The returned iterators are independent of the original iterator. The original might be exhausted and should be discarded.
func NewErrIterator ¶
func NewSliceIterator ¶
func NewSortProfileIterator ¶
NewSortProfileIterator sorts the input iterator by timestamp then labels. Each input iterator must return Profile in ascending time.
type Profile ¶
type Profile interface { Labels() phlaremodel.Labels Timestamp }
type ProfileIteratorHeap ¶
func (ProfileIteratorHeap[P]) Len ¶
func (h ProfileIteratorHeap[P]) Len() int
func (ProfileIteratorHeap[P]) Less ¶
func (h ProfileIteratorHeap[P]) Less(i, j int) bool
func (*ProfileIteratorHeap[P]) Pop ¶
func (h *ProfileIteratorHeap[P]) Pop() interface{}
func (*ProfileIteratorHeap[P]) Push ¶
func (h *ProfileIteratorHeap[P]) Push(x interface{})
func (ProfileIteratorHeap[P]) Swap ¶
func (h ProfileIteratorHeap[P]) Swap(i, j int)
type SeekIterator ¶
type SeekIterator[A any, B any] interface { Iterator[A] // Like Next but skips over results until reading >= the given location Seek(pos B) bool }
func NewErrSeekIterator ¶
func NewErrSeekIterator[A any, B any](err error) SeekIterator[A, B]
func NewSliceSeekIterator ¶
func NewSliceSeekIterator[A constraints.Ordered](s []A) SeekIterator[A, A]
type SortIterator ¶
type SortIterator[P Profile] struct { // contains filtered or unexported fields }
func (*SortIterator[P]) At ¶
func (s *SortIterator[P]) At() P
func (*SortIterator[P]) Close ¶
func (i *SortIterator[P]) Close() error
func (*SortIterator[P]) Err ¶
func (i *SortIterator[P]) Err() error
func (*SortIterator[P]) Next ¶
func (s *SortIterator[P]) Next() bool
type TimeRangedIterator ¶
type TimeRangedIterator[T Timestamp] struct { Iterator[T] // contains filtered or unexported fields }
func (*TimeRangedIterator[T]) Next ¶
func (it *TimeRangedIterator[T]) Next() bool
Click to show internal directories.
Click to hide internal directories.