adding etcd storage support for cluster meta data. Currently just
sequence. More to come...
This commit is contained in:
@@ -3,7 +3,6 @@ package metastore
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// store data on disk, enough for most cases
|
||||
@@ -11,21 +10,22 @@ import (
|
||||
type MetaStoreFileBacking struct {
|
||||
}
|
||||
|
||||
func NewMetaStoreFileBacking() MetaStoreFileBacking {
|
||||
mms := MetaStoreFileBacking{}
|
||||
func NewMetaStoreFileBacking() *MetaStoreFileBacking {
|
||||
mms := &MetaStoreFileBacking{}
|
||||
return mms
|
||||
}
|
||||
|
||||
func (mms MetaStoreFileBacking) Set(val []byte, elem ...string) error {
|
||||
return ioutil.WriteFile(path.Join(elem...), val, 0644)
|
||||
func (mms *MetaStoreFileBacking) Set(path, val string) error {
|
||||
return ioutil.WriteFile(path, []byte(val), 0644)
|
||||
}
|
||||
|
||||
func (mms MetaStoreFileBacking) Get(elem ...string) (val []byte, err error) {
|
||||
return ioutil.ReadFile(path.Join(elem...))
|
||||
func (mms *MetaStoreFileBacking) Get(path string) (string, error) {
|
||||
val, e := ioutil.ReadFile(path)
|
||||
return string(val), e
|
||||
}
|
||||
|
||||
func (mms MetaStoreFileBacking) Has(elem ...string) (ok bool) {
|
||||
seqFile, se := os.OpenFile(path.Join(elem...), os.O_RDONLY, 0644)
|
||||
func (mms *MetaStoreFileBacking) Has(path string) (ok bool) {
|
||||
seqFile, se := os.OpenFile(path, os.O_RDONLY, 0644)
|
||||
if se != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user