leveldb: report not found entry

This commit is contained in:
Chris Lu 2020-09-01 22:48:23 -07:00
parent 87d7312bf6
commit aa40295f06

View file

@ -3,6 +3,8 @@ package leveldb
import (
"context"
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/syndtr/goleveldb/leveldb"
)
func (store *LevelDBStore) KvPut(ctx context.Context, key []byte, value []byte) (err error) {
@ -20,6 +22,10 @@ func (store *LevelDBStore) KvGet(ctx context.Context, key []byte) (value []byte,
value, err = store.db.Get(key, nil)
if err == leveldb.ErrNotFound {
return nil, filer.ErrKvNotFound
}
if err != nil {
return nil, fmt.Errorf("kv get: %v", err)
}