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

View File

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

View File

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