-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
38 lines (32 loc) · 830 Bytes
/
options.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
32
33
34
35
36
37
38
package sculptor
import (
log "github.com/sirupsen/logrus"
"time"
)
// Options is used for extra Control during DataSculptor.Do()
type Options struct {
Latency time.Duration
BufSize int
TagKey string
DebugLevel log.Level
}
// DefaultOptions is the default options used by DataSculptor
var DefaultOptions = Options{
Latency: 1 * time.Millisecond,
BufSize: 10,
TagKey: "select",
DebugLevel: log.WarnLevel,
}
func (d *DataSculptor) debugInfo() {
log.SetLevel(d.options.DebugLevel)
}
// SetOption set options to replace default options
func (d *DataSculptor) SetOption(o Options) *DataSculptor {
d.options = o
return d
}
// SetBufSize will reset the buffer size of the channel
func (d *DataSculptor) SetBufSize(size int) {
d.options.BufSize = size
d.ConstructedOutput = make(chan any, size)
}