-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore_opt.go
More file actions
28 lines (22 loc) · 789 Bytes
/
store_opt.go
File metadata and controls
28 lines (22 loc) · 789 Bytes
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
package stats
import "time"
// StoreOption contains options of a Store like flush interval, default tags, etc.
type StoreOption struct {
FlushInterval time.Duration
Sinks []Sink
}
const defaultStoreFlushInterval = time.Second * 5
// NewStoreOption creates a StoreOption with FlushInterval set to 5s.
func NewStoreOption() *StoreOption {
return &StoreOption{FlushInterval: defaultStoreFlushInterval}
}
// WithFlushInterval returns a StoreOption that sets flush interval for the store.
func (opt *StoreOption) WithFlushInterval(interval time.Duration) *StoreOption {
opt.FlushInterval = interval
return opt
}
// WithSinks returns a StoreOption that sets sinks for the sotre.
func (opt *StoreOption) WithSinks(sinks ...Sink) *StoreOption {
opt.Sinks = sinks
return opt
}