fix compilation issues

This commit is contained in:
Asim Aslam 2020-04-11 11:02:06 +01:00
parent c697eed1be
commit 0f2006ac50

View File

@ -11,7 +11,7 @@ import (
"github.com/mholt/certmagic" "github.com/mholt/certmagic"
"github.com/micro/go-micro/v2/store" "github.com/micro/go-micro/v2/store"
"github.com/micro/go-micro/v2/sync/lock" "github.com/micro/go-micro/v2/sync"
) )
// File represents a "File" that will be stored in store.Store - the contents and last modified time // File represents a "File" that will be stored in store.Store - the contents and last modified time
@ -26,16 +26,16 @@ type File struct {
// As certmagic storage expects a filesystem (with stat() abilities) we have to implement // As certmagic storage expects a filesystem (with stat() abilities) we have to implement
// the bare minimum of metadata. // the bare minimum of metadata.
type storage struct { type storage struct {
lock lock.Lock lock sync.Sync
store store.Store store store.Store
} }
func (s *storage) Lock(key string) error { func (s *storage) Lock(key string) error {
return s.lock.Acquire(key, lock.TTL(10*time.Minute)) return s.lock.Lock(key, sync.LockTTL(10*time.Minute))
} }
func (s *storage) Unlock(key string) error { func (s *storage) Unlock(key string) error {
return s.lock.Release(key) return s.lock.Unlock(key)
} }
func (s *storage) Store(key string, value []byte) error { func (s *storage) Store(key string, value []byte) error {
@ -139,7 +139,7 @@ func (s *storage) Stat(key string) (certmagic.KeyInfo, error) {
} }
// NewStorage returns a certmagic.Storage backed by a go-micro/lock and go-micro/store // NewStorage returns a certmagic.Storage backed by a go-micro/lock and go-micro/store
func NewStorage(lock lock.Lock, store store.Store) certmagic.Storage { func NewStorage(lock sync.Sync, store store.Store) certmagic.Storage {
return &storage{ return &storage{
lock: lock, lock: lock,
store: store, store: store,