Skip to content
Snippets Groups Projects
Commit e73024d3 authored by Tom Wilkie's avatar Tom Wilkie Committed by Tom Wilkie
Browse files

Remove RegexpIter, we don't need it.


Signed-off-by: default avatarTom Wilkie <tom.wilkie@gmail.com>
parent bfb34e40
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,6 @@ import (
"container/heap"
"fmt"
"io"
"regexp"
"sort"
"time"
......@@ -298,6 +297,7 @@ type filter struct {
f func(string) bool
}
// NewFilter builds a filtering iterator.
func NewFilter(f func(string) bool, i EntryIterator) EntryIterator {
return &filter{
f: f,
......@@ -314,32 +314,6 @@ func (i *filter) Next() bool {
return false
}
type regexpFilter struct {
re *regexp.Regexp
EntryIterator
}
// NewRegexpFilter returns an iterator that filters entries by regexp.
func NewRegexpFilter(r string, i EntryIterator) (EntryIterator, error) {
re, err := regexp.Compile(r)
if err != nil {
return nil, err
}
return &regexpFilter{
re: re,
EntryIterator: i,
}, nil
}
func (i *regexpFilter) Next() bool {
for i.EntryIterator.Next() {
if i.re.MatchString(i.Entry().Line) {
return true
}
}
return false
}
type nonOverlappingIterator struct {
labels string
i int
......
......@@ -112,12 +112,6 @@ func buildHeapIterator(ctx context.Context, req *logproto.QueryRequest, chks [][
if err != nil {
return nil, err
}
if req.Regex != "" {
iterator, err = iter.NewRegexpFilter(req.Regex, iterator)
if err != nil {
return nil, err
}
}
iterators = append(iterators, iterator)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment