add: new pipeline to log parser

This commit is contained in:
Inanc Gumus
2019-08-08 14:11:54 +03:00
parent 91b3258042
commit e4dae5e0d4
10 changed files with 112 additions and 107 deletions

View File

@@ -26,7 +26,7 @@ import (
// + uses a manual atoi
// +
func fastTextReader(r io.Reader) inputFunc {
func fastTextReader(r io.Reader) inputFn {
return func() ([]result, error) {
// first: count the lines, so the parseText can create
// enough buffer.
@@ -45,7 +45,9 @@ func fastParseText(in *bufio.Scanner, nlines int) ([]result, error) {
res := make([]result, 0, nlines)
for l := 0; in.Scan(); l++ {
_ = in.Bytes()
r, err := fastParseFields(in.Bytes())
// r, err := result{"foo.com", "/bar", 10, 10}, error(nil)
if err != nil {
return nil, fmt.Errorf("line %d: %v", l, err)