0
0

Revert "+ make copies of the []bytes returned by goleveldb"

This reverts commit cb8c1741289a0f00b30733e0d52d9d81d1199603.

This commit is no longer desired. The KV store API has been changed to
better address this issue.

For more details, see the google group conversation thread at:

https://groups.google.com/forum/#!topic/bleve/aHZ8gmihLiY
This commit is contained in:
indraniel 2015-04-10 11:06:03 -05:00
parent 3a70401835
commit 81bef38cce
2 changed files with 4 additions and 14 deletions

View File

@ -59,17 +59,11 @@ func (ldi *Iterator) Current() ([]byte, []byte, bool) {
}
func (ldi *Iterator) Key() []byte {
k := ldi.iterator.Key()
rv := make([]byte, len(k))
copy(rv, k)
return rv
return ldi.iterator.Key()
}
func (ldi *Iterator) Value() []byte {
v := ldi.iterator.Value()
rv := make([]byte, len(v))
copy(rv, v)
return rv
return ldi.iterator.Value()
}
func (ldi *Iterator) Valid() bool {

View File

@ -52,9 +52,7 @@ func (ldbs *Store) get(key []byte) ([]byte, error) {
if err == leveldb.ErrNotFound {
return nil, nil
}
rv := make([]byte, len(b))
copy(rv, b)
return rv, err
return b, err
}
func (ldbs *Store) getWithSnapshot(key []byte, snapshot *leveldb.Snapshot) ([]byte, error) {
@ -63,9 +61,7 @@ func (ldbs *Store) getWithSnapshot(key []byte, snapshot *leveldb.Snapshot) ([]by
if err == leveldb.ErrNotFound {
return nil, nil
}
rv := make([]byte, len(b))
copy(rv, b)
return rv, err
return b, err
}
func (ldbs *Store) set(key, val []byte) error {