diff --git a/lib/logstorage/fields_set.go b/lib/logstorage/fields_set.go index 00f803fee..faf52ce9d 100644 --- a/lib/logstorage/fields_set.go +++ b/lib/logstorage/fields_set.go @@ -37,13 +37,13 @@ func (fs fieldsSet) getAll() []string { return a } -func (fs fieldsSet) addAll(fields []string) { +func (fs fieldsSet) addFields(fields []string) { for _, f := range fields { fs.add(f) } } -func (fs fieldsSet) removeAll(fields []string) { +func (fs fieldsSet) removeFields(fields []string) { for _, f := range fields { fs.remove(f) } diff --git a/lib/logstorage/fields_set_test.go b/lib/logstorage/fields_set_test.go index 6e848ac13..c0a86d50b 100644 --- a/lib/logstorage/fields_set_test.go +++ b/lib/logstorage/fields_set_test.go @@ -73,8 +73,8 @@ func TestFieldsSet(t *testing.T) { t.Fatalf("fs must be empty") } - // verify addAll, getAll, removeAll - fs.addAll([]string{"foo", "bar", "_msg"}) + // verify addFields, removeFields, getAll + fs.addFields([]string{"foo", "bar", "_msg"}) if !fs.contains("foo") || !fs.contains("bar") || !fs.contains("_msg") { t.Fatalf("fs must contain foo, bar and _msg") } @@ -82,7 +82,7 @@ func TestFieldsSet(t *testing.T) { if !reflect.DeepEqual(a, []string{"_msg", "bar", "foo"}) { t.Fatalf("unexpected result from getAll(); got %q; want %q", a, []string{"_msg", "bar", "foo"}) } - fs.removeAll([]string{"bar", "baz", "_msg"}) + fs.removeFields([]string{"bar", "baz", "_msg"}) if fs.contains("bar") || fs.contains("baz") || fs.contains("_msg") { t.Fatalf("fs mustn't contain bar, baz and _msg") } @@ -91,7 +91,7 @@ func TestFieldsSet(t *testing.T) { } // verify clone - fs.addAll([]string{"foo", "bar", "baz"}) + fs.addFields([]string{"foo", "bar", "baz"}) fsStr := fs.String() fsCopy := fs.clone() fsCopyStr := fsCopy.String() diff --git a/lib/logstorage/pipe_copy.go b/lib/logstorage/pipe_copy.go index cd4cccfe7..d512bb0d5 100644 --- a/lib/logstorage/pipe_copy.go +++ b/lib/logstorage/pipe_copy.go @@ -40,7 +40,7 @@ func (pc *pipeCopy) updateNeededFields(neededFields, unneededFields fieldsSet) { } if neededFields.contains("*") { // update only unneeded fields - unneededFields.addAll(pc.dstFields) + unneededFields.addFields(pc.dstFields) for i, srcField := range pc.srcFields { if neededSrcFields[i] { unneededFields.remove(srcField) @@ -48,7 +48,7 @@ func (pc *pipeCopy) updateNeededFields(neededFields, unneededFields fieldsSet) { } } else { // update only needed fields and reset unneeded fields - neededFields.removeAll(pc.dstFields) + neededFields.removeFields(pc.dstFields) for i, srcField := range pc.srcFields { if neededSrcFields[i] { neededFields.add(srcField) diff --git a/lib/logstorage/pipe_copy_test.go b/lib/logstorage/pipe_copy_test.go index 32b7e2d63..c5dc5ed0f 100644 --- a/lib/logstorage/pipe_copy_test.go +++ b/lib/logstorage/pipe_copy_test.go @@ -75,7 +75,7 @@ func assertNeededFields(t *testing.T, nfs, unfs fieldsSet, neededFieldsExpected, func newTestFieldsSet(fields string) fieldsSet { fs := newFieldsSet() if fields != "" { - fs.addAll(strings.Split(fields, ",")) + fs.addFields(strings.Split(fields, ",")) } return fs } diff --git a/lib/logstorage/pipe_delete.go b/lib/logstorage/pipe_delete.go index efcca0da3..3389cc94e 100644 --- a/lib/logstorage/pipe_delete.go +++ b/lib/logstorage/pipe_delete.go @@ -25,10 +25,10 @@ func (pd *pipeDelete) String() string { func (pd *pipeDelete) updateNeededFields(neededFields, unneededFields fieldsSet) { if neededFields.contains("*") { // update only unneeded fields - unneededFields.addAll(pd.fields) + unneededFields.addFields(pd.fields) } else { // update only needed fields - neededFields.removeAll(pd.fields) + neededFields.removeFields(pd.fields) } } diff --git a/lib/logstorage/pipe_fields.go b/lib/logstorage/pipe_fields.go index 20a5a15de..07298c6dd 100644 --- a/lib/logstorage/pipe_fields.go +++ b/lib/logstorage/pipe_fields.go @@ -32,7 +32,7 @@ func (pf *pipeFields) updateNeededFields(neededFields, unneededFields fieldsSet) if neededFields.contains("*") { // subtract unneeded fields from pf.fields neededFields.reset() - neededFields.addAll(pf.fields) + neededFields.addFields(pf.fields) for _, f := range unneededFields.getAll() { neededFields.remove(f) } diff --git a/lib/logstorage/pipe_rename.go b/lib/logstorage/pipe_rename.go index 0eb48af39..99a774ad4 100644 --- a/lib/logstorage/pipe_rename.go +++ b/lib/logstorage/pipe_rename.go @@ -40,7 +40,7 @@ func (pr *pipeRename) updateNeededFields(neededFields, unneededFields fieldsSet) } if neededFields.contains("*") { // update only unneeded fields - unneededFields.addAll(pr.dstFields) + unneededFields.addFields(pr.dstFields) for i, srcField := range pr.srcFields { if neededSrcFields[i] { unneededFields.remove(srcField) @@ -50,7 +50,7 @@ func (pr *pipeRename) updateNeededFields(neededFields, unneededFields fieldsSet) } } else { // update only needed fields and reset unneeded fields - neededFields.removeAll(pr.dstFields) + neededFields.removeFields(pr.dstFields) for i, srcField := range pr.srcFields { if neededSrcFields[i] { neededFields.add(srcField) diff --git a/lib/logstorage/pipe_uniq.go b/lib/logstorage/pipe_uniq.go index 757b057a4..be338f656 100644 --- a/lib/logstorage/pipe_uniq.go +++ b/lib/logstorage/pipe_uniq.go @@ -40,7 +40,7 @@ func (pu *pipeUniq) updateNeededFields(neededFields, unneededFields fieldsSet) { if len(pu.byFields) == 0 { neededFields.add("*") } else { - neededFields.addAll(pu.byFields) + neededFields.addFields(pu.byFields) } } diff --git a/lib/logstorage/stats_avg.go b/lib/logstorage/stats_avg.go index 5977a31e3..cdf7d6477 100644 --- a/lib/logstorage/stats_avg.go +++ b/lib/logstorage/stats_avg.go @@ -16,7 +16,7 @@ func (sa *statsAvg) String() string { } func (sa *statsAvg) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sa.fields) + neededFields.addFields(sa.fields) } func (sa *statsAvg) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_count.go b/lib/logstorage/stats_count.go index 158ea0f20..1de39031b 100644 --- a/lib/logstorage/stats_count.go +++ b/lib/logstorage/stats_count.go @@ -22,7 +22,7 @@ func (sc *statsCount) updateNeededFields(neededFields fieldsSet) { // There is no need in fetching any columns for count(*) - the number of matching rows can be calculated as len(blockResult.timestamps) return } - neededFields.addAll(sc.fields) + neededFields.addFields(sc.fields) } func (sc *statsCount) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_count_empty.go b/lib/logstorage/stats_count_empty.go index c18756a5d..b9916ef24 100644 --- a/lib/logstorage/stats_count_empty.go +++ b/lib/logstorage/stats_count_empty.go @@ -18,7 +18,7 @@ func (sc *statsCountEmpty) String() string { } func (sc *statsCountEmpty) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sc.fields) + neededFields.addFields(sc.fields) } func (sc *statsCountEmpty) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_count_uniq.go b/lib/logstorage/stats_count_uniq.go index 319aad7fc..7ad3af47f 100644 --- a/lib/logstorage/stats_count_uniq.go +++ b/lib/logstorage/stats_count_uniq.go @@ -25,7 +25,7 @@ func (su *statsCountUniq) String() string { } func (su *statsCountUniq) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(su.fields) + neededFields.addFields(su.fields) } func (su *statsCountUniq) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_max.go b/lib/logstorage/stats_max.go index 8d1cea099..5eed2e748 100644 --- a/lib/logstorage/stats_max.go +++ b/lib/logstorage/stats_max.go @@ -20,7 +20,7 @@ func (sm *statsMax) String() string { } func (sm *statsMax) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sm.fields) + neededFields.addFields(sm.fields) } func (sm *statsMax) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_median.go b/lib/logstorage/stats_median.go index ac60844a3..baeb240e3 100644 --- a/lib/logstorage/stats_median.go +++ b/lib/logstorage/stats_median.go @@ -15,7 +15,7 @@ func (sm *statsMedian) String() string { } func (sm *statsMedian) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sm.fields) + neededFields.addFields(sm.fields) } func (sm *statsMedian) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_min.go b/lib/logstorage/stats_min.go index bd1baecc4..f82d85e6b 100644 --- a/lib/logstorage/stats_min.go +++ b/lib/logstorage/stats_min.go @@ -20,7 +20,7 @@ func (sm *statsMin) String() string { } func (sm *statsMin) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sm.fields) + neededFields.addFields(sm.fields) } func (sm *statsMin) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_quantile.go b/lib/logstorage/stats_quantile.go index 74b6e0de4..d7ac2352e 100644 --- a/lib/logstorage/stats_quantile.go +++ b/lib/logstorage/stats_quantile.go @@ -25,7 +25,7 @@ func (sq *statsQuantile) String() string { } func (sq *statsQuantile) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sq.fields) + neededFields.addFields(sq.fields) } func (sq *statsQuantile) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_sum.go b/lib/logstorage/stats_sum.go index 23b0d5136..5ca7b082f 100644 --- a/lib/logstorage/stats_sum.go +++ b/lib/logstorage/stats_sum.go @@ -17,7 +17,7 @@ func (ss *statsSum) String() string { } func (ss *statsSum) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(ss.fields) + neededFields.addFields(ss.fields) } func (ss *statsSum) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_sum_len.go b/lib/logstorage/stats_sum_len.go index 644a421b5..0b27f45c2 100644 --- a/lib/logstorage/stats_sum_len.go +++ b/lib/logstorage/stats_sum_len.go @@ -16,7 +16,7 @@ func (ss *statsSumLen) String() string { } func (ss *statsSumLen) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(ss.fields) + neededFields.addFields(ss.fields) } func (ss *statsSumLen) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_uniq_values.go b/lib/logstorage/stats_uniq_values.go index 9667d5883..4942f1213 100644 --- a/lib/logstorage/stats_uniq_values.go +++ b/lib/logstorage/stats_uniq_values.go @@ -25,7 +25,7 @@ func (su *statsUniqValues) String() string { } func (su *statsUniqValues) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(su.fields) + neededFields.addFields(su.fields) } func (su *statsUniqValues) newStatsProcessor() (statsProcessor, int) { diff --git a/lib/logstorage/stats_values.go b/lib/logstorage/stats_values.go index b7183d45b..dd57a6ddc 100644 --- a/lib/logstorage/stats_values.go +++ b/lib/logstorage/stats_values.go @@ -22,7 +22,7 @@ func (sv *statsValues) String() string { } func (sv *statsValues) updateNeededFields(neededFields fieldsSet) { - neededFields.addAll(sv.fields) + neededFields.addFields(sv.fields) } func (sv *statsValues) newStatsProcessor() (statsProcessor, int) {