Skip to content

Commit

Permalink
Remove RegexpIter, we don't need it.
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wilkie <[email protected]>
  • Loading branch information
tomwilkie committed May 8, 2019
1 parent bfb34e4 commit e73024d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
28 changes: 1 addition & 27 deletions pkg/iter/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"container/heap"
"fmt"
"io"
"regexp"
"sort"
"time"

Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions pkg/querier/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit e73024d

Please sign in to comment.