forked from micro/go-micro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
49 lines (42 loc) · 823 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
39
40
41
42
43
44
45
46
47
48
49
package sync
import (
"context"
"crypto/tls"
"time"
)
// Nodes sets the addresses to use
func Nodes(a ...string) Option {
return func(o *Options) {
o.Nodes = a
}
}
// Prefix sets a prefix to any lock ids used
func Prefix(p string) Option {
return func(o *Options) {
o.Prefix = p
}
}
// LockTTL sets the lock ttl
func LockTTL(t time.Duration) LockOption {
return func(o *LockOptions) {
o.TTL = t
}
}
// LockWait sets the wait time
func LockWait(t time.Duration) LockOption {
return func(o *LockOptions) {
o.Wait = t
}
}
// WithTLS sets the TLS config
func WithTLS(t *tls.Config) Option {
return func(o *Options) {
o.TLSConfig = t
}
}
// WithContext sets the syncs context, for any extra configuration
func WithContext(c context.Context) Option {
return func(o *Options) {
o.Context = c
}
}