|
@ -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) |
|
|
} |
|
|
} |
|
|