gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/sync/lock/options.go (about) 1 package lock 2 3 import ( 4 "time" 5 ) 6 7 // Nodes sets the addresses the underlying lock implementation 8 func Nodes(a ...string) Option { 9 return func(o *Options) { 10 o.Nodes = a 11 } 12 } 13 14 // Prefix sets a prefix to any lock ids used 15 func Prefix(p string) Option { 16 return func(o *Options) { 17 o.Prefix = p 18 } 19 } 20 21 // TTL sets the lock ttl 22 func TTL(t time.Duration) AcquireOption { 23 return func(o *AcquireOptions) { 24 o.TTL = t 25 } 26 } 27 28 // Wait sets the wait time 29 func Wait(t time.Duration) AcquireOption { 30 return func(o *AcquireOptions) { 31 o.Wait = t 32 } 33 }