gitee.com/sasukebo/go-micro/v4@v4.7.1/sync/options.go (about) 1 package sync 2 3 import ( 4 "crypto/tls" 5 "time" 6 ) 7 8 // Nodes sets the addresses to use 9 func Nodes(a ...string) Option { 10 return func(o *Options) { 11 o.Nodes = a 12 } 13 } 14 15 // Prefix sets a prefix to any lock ids used 16 func Prefix(p string) Option { 17 return func(o *Options) { 18 o.Prefix = p 19 } 20 } 21 22 // LockTTL sets the lock ttl 23 func LockTTL(t time.Duration) LockOption { 24 return func(o *LockOptions) { 25 o.TTL = t 26 } 27 } 28 29 // LockWait sets the wait time 30 func LockWait(t time.Duration) LockOption { 31 return func(o *LockOptions) { 32 o.Wait = t 33 } 34 } 35 36 // WithTLS sets the TLS config 37 func WithTLS(t *tls.Config) Option { 38 return func(o *Options) { 39 o.TLSConfig = t 40 } 41 }