fix broken links

This commit is contained in:
Asim Aslam 2019-06-12 07:50:04 +01:00
parent a5412dd4a0
commit 7a1cef46b0
3 changed files with 16 additions and 16 deletions

View File

@ -6,8 +6,8 @@ import (
"encoding/json"
"fmt"
"github.com/micro/go-micro/data"
ckv "github.com/micro/go-micro/data/consul"
"github.com/micro/go-micro/store"
ckv "github.com/micro/go-micro/store/consul"
lock "github.com/micro/go-micro/sync/lock/consul"
)
@ -34,7 +34,7 @@ func (m *syncMap) Read(key, val interface{}) error {
defer m.opts.Lock.Release(kstr)
// get key
kval, err := m.opts.Data.Read(kstr)
kval, err := m.opts.Store.Read(kstr)
if err != nil {
return err
}
@ -63,7 +63,7 @@ func (m *syncMap) Write(key, val interface{}) error {
}
// set key
return m.opts.Data.Write(&data.Record{
return m.opts.Store.Write(&store.Record{
Key: kstr,
Value: b,
})
@ -81,11 +81,11 @@ func (m *syncMap) Delete(key interface{}) error {
return err
}
defer m.opts.Lock.Release(kstr)
return m.opts.Data.Delete(kstr)
return m.opts.Store.Delete(kstr)
}
func (m *syncMap) Iterate(fn func(key, val interface{}) error) error {
keyvals, err := m.opts.Data.Dump()
keyvals, err := m.opts.Store.Dump()
if err != nil {
return err
}
@ -126,7 +126,7 @@ func (m *syncMap) Iterate(fn func(key, val interface{}) error) error {
}
// set key
if err := m.opts.Data.Write(&data.Record{
if err := m.opts.Store.Write(&store.Record{
Key: keyval.Key,
Value: b,
}); err != nil {
@ -147,8 +147,8 @@ func NewMap(opts ...Option) Map {
options.Lock = lock.NewLock()
}
if options.Data == nil {
options.Data = ckv.NewData()
if options.Store == nil {
options.Store = ckv.NewStore()
}
return &syncMap{

View File

@ -1,7 +1,7 @@
package sync
import (
"github.com/micro/go-micro/data"
"github.com/micro/go-micro/store"
"github.com/micro/go-micro/sync/leader"
"github.com/micro/go-micro/sync/lock"
"github.com/micro/go-micro/sync/time"
@ -21,10 +21,10 @@ func WithLock(l lock.Lock) Option {
}
}
// WithData sets the data implementation option
func WithData(s data.Data) Option {
// WithStore sets the store implementation option
func WithStore(s store.Store) Option {
return func(o *Options) {
o.Data = s
o.Store = s
}
}

View File

@ -2,7 +2,7 @@
package sync
import (
"github.com/micro/go-micro/data"
"github.com/micro/go-micro/store"
"github.com/micro/go-micro/sync/leader"
"github.com/micro/go-micro/sync/lock"
"github.com/micro/go-micro/sync/task"
@ -10,7 +10,7 @@ import (
)
// Map provides synchronized access to key-value storage.
// It uses the data interface and lock interface to
// It uses the store interface and lock interface to
// provide a consistent storage mechanism.
type Map interface {
// Read value with given key
@ -33,7 +33,7 @@ type Cron interface {
type Options struct {
Leader leader.Leader
Lock lock.Lock
Data data.Data
Store store.Store
Task task.Task
Time time.Time
}