Move out consul sync/lock and store. Move data/store to store

This commit is contained in:
Asim Aslam
2019-10-03 09:46:20 +01:00
parent b81bb07afc
commit b5ca40a91a
12 changed files with 213 additions and 209 deletions

34
store/store.go Normal file
View File

@@ -0,0 +1,34 @@
// Package store is an interface for distribute data storage.
package store
import (
"errors"
"time"
"github.com/micro/go-micro/config/options"
)
var (
ErrNotFound = errors.New("not found")
)
// Store is a data storage interface
type Store interface {
// embed options
options.Options
// Dump the known records
Dump() ([]*Record, error)
// Read a record with key
Read(key string) (*Record, error)
// Write a record
Write(r *Record) error
// Delete a record with key
Delete(key string) error
}
// Record represents a data record
type Record struct {
Key string
Value []byte
Expiry time.Duration
}