Browse Source

leveldb: report not found entry

pull/1446/head
Chris Lu 4 years ago
parent
commit
aa40295f06
  1. 6
      weed/filer/leveldb/leveldb_store_kv.go

6
weed/filer/leveldb/leveldb_store_kv.go

@ -3,6 +3,8 @@ package leveldb
import ( import (
"context" "context"
"fmt" "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) { 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) value, err = store.db.Get(key, nil)
if err == leveldb.ErrNotFound {
return nil, filer.ErrKvNotFound
}
if err != nil { if err != nil {
return nil, fmt.Errorf("kv get: %v", err) return nil, fmt.Errorf("kv get: %v", err)
} }

Loading…
Cancel
Save