2019-05-31 00:43:23 +01:00
|
|
|
package sync
|
|
|
|
|
|
|
|
import (
|
2019-06-11 17:20:52 +01:00
|
|
|
"github.com/micro/go-micro/data"
|
2019-05-31 00:43:23 +01:00
|
|
|
"github.com/micro/go-micro/sync/leader"
|
|
|
|
"github.com/micro/go-micro/sync/lock"
|
|
|
|
"github.com/micro/go-micro/sync/time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// WithLeader sets the leader election implementation opton
|
|
|
|
func WithLeader(l leader.Leader) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Leader = l
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithLock sets the locking implementation option
|
|
|
|
func WithLock(l lock.Lock) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Lock = l
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithData sets the data implementation option
|
|
|
|
func WithData(s data.Data) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Data = s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithTime sets the time implementation option
|
|
|
|
func WithTime(t time.Time) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Time = t
|
|
|
|
}
|
|
|
|
}
|