-
Notifications
You must be signed in to change notification settings - Fork 3
/
batch.go
31 lines (24 loc) · 1.14 KB
/
batch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package steps
import (
"time"
"github.com/bitflow-stream/go-bitflow/bitflow"
"github.com/bitflow-stream/go-bitflow/script/reg"
)
// These functions are placed here (and not directly in the bitflow package, next to the BatchProcessor type),
// to avoid an import cycle between the packages bitflow and reg.
// TODO implement DontFlushOnHeaderChange. Requires refactoring of the BatchProcessingStep interface.
// TODO "ignore-header-change"
var BatchProcessorParameters = reg.RegisteredParameters{}.
Optional("tags", reg.List(reg.String()), []string{}).
Optional("timeout", reg.Duration(), time.Duration(0)).
Optional("ignore-close", reg.Bool(), false).
Optional("forward-immediately", reg.Bool(), false)
func MakeBatchProcessor(params map[string]interface{}) (res *bitflow.BatchProcessor, err error) {
return &bitflow.BatchProcessor{
FlushTags: params["tags"].([]string),
FlushTimeout: params["timeout"].(time.Duration),
DontFlushOnClose: params["ignore-close"].(bool),
ForwardImmediately: params["forward-immediately"].(bool),
}, nil
// DontFlushOnHeaderChange: reg.BoolParam(params, "ignore-header-change", false, true, &err),
}