mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
1888d01fa0
sequence. More to come...
34 lines
599 B
Go
34 lines
599 B
Go
package metastore
|
|
|
|
import (
|
|
"errors"
|
|
"strconv"
|
|
)
|
|
|
|
type MetaStoreBacking interface {
|
|
Get(path string) (string, error)
|
|
Set(path, val string) error
|
|
Has(path string) bool
|
|
}
|
|
|
|
type MetaStore struct {
|
|
MetaStoreBacking
|
|
}
|
|
|
|
func (m *MetaStore) SetUint64(path string, val uint64) error {
|
|
return m.Set(path, strconv.FormatUint(val, 10))
|
|
}
|
|
|
|
func (m *MetaStore) GetUint64(path string) (val uint64, err error) {
|
|
if b, e := m.Get(path); e == nil {
|
|
val, err = strconv.ParseUint(b, 10, 64)
|
|
return
|
|
} else {
|
|
if e != nil {
|
|
return 0, e
|
|
}
|
|
err = errors.New("Not found value for " + path)
|
|
}
|
|
return
|
|
}
|