/
options.go
35 lines (30 loc) · 895 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
package endure
import "time"
// SetLogLevel option sets the log level in the Endure
func SetLogLevel(lvl Level) Options {
return func(endure *Endure) {
endure.loglevel = lvl
}
}
// SetBackoff sets initial and maximum backoff interval for retry
func SetBackoff(initialInterval time.Duration, maxInterval time.Duration) Options {
return func(endure *Endure) {
endure.maxInterval = maxInterval
endure.initialInterval = initialInterval
}
}
// Visualize visualize current graph. Output: can be file or stdout
func Visualize(output Output, path string) Options {
return func(endure *Endure) {
endure.output = output
if path != "" {
endure.path = path
}
}
}
// GracefulShutdownTimeout sets the timeout to kill the vertices is one or more of them are frozen
func GracefulShutdownTimeout(to time.Duration) Options {
return func(endure *Endure) {
endure.stopTimeout = to
}
}