micro/sync/options.go

37 lines
733 B
Go
Raw Normal View History

2019-05-31 02:43:23 +03:00
package sync
import (
2019-06-20 00:04:13 +03:00
"github.com/micro/go-micro/data/store"
2019-05-31 02:43:23 +03: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
}
}
2019-06-12 09:50:04 +03:00
// WithStore sets the store implementation option
func WithStore(s store.Store) Option {
2019-05-31 02:43:23 +03:00
return func(o *Options) {
2019-06-12 09:50:04 +03:00
o.Store = s
2019-05-31 02:43:23 +03:00
}
}
// WithTime sets the time implementation option
func WithTime(t time.Time) Option {
return func(o *Options) {
o.Time = t
}
}