vendor: Update github.com/syndtr/goleveldb
This commit is contained in:
8
vendor/github.com/syndtr/goleveldb/leveldb/testutil/kv.go
generated
vendored
8
vendor/github.com/syndtr/goleveldb/leveldb/testutil/kv.go
generated
vendored
@@ -292,7 +292,7 @@ func KeyValue_MultipleKeyValue() *KeyValue {
|
||||
|
||||
var keymap = []byte("012345678ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxy")
|
||||
|
||||
func KeyValue_Generate(rnd *rand.Rand, n, minlen, maxlen, vminlen, vmaxlen int) *KeyValue {
|
||||
func KeyValue_Generate(rnd *rand.Rand, n, incr, minlen, maxlen, vminlen, vmaxlen int) *KeyValue {
|
||||
if rnd == nil {
|
||||
rnd = NewRand()
|
||||
}
|
||||
@@ -308,7 +308,7 @@ func KeyValue_Generate(rnd *rand.Rand, n, minlen, maxlen, vminlen, vmaxlen int)
|
||||
}
|
||||
|
||||
kv := &KeyValue{}
|
||||
endC := byte(len(keymap) - 1)
|
||||
endC := byte(len(keymap) - incr)
|
||||
gen := make([]byte, 0, maxlen)
|
||||
for i := 0; i < n; i++ {
|
||||
m := rrand(minlen, maxlen)
|
||||
@@ -325,8 +325,8 @@ func KeyValue_Generate(rnd *rand.Rand, n, minlen, maxlen, vminlen, vmaxlen int)
|
||||
if c == endC {
|
||||
continue
|
||||
}
|
||||
gen[j] = c + 1
|
||||
for j += 1; j < m; j++ {
|
||||
gen[j] = c + byte(incr)
|
||||
for j++; j < m; j++ {
|
||||
gen[j] = 0
|
||||
}
|
||||
goto ok
|
||||
|
||||
19
vendor/github.com/syndtr/goleveldb/leveldb/testutil/kvtest.go
generated
vendored
19
vendor/github.com/syndtr/goleveldb/leveldb/testutil/kvtest.go
generated
vendored
@@ -23,15 +23,15 @@ func TestFind(db Find, kv KeyValue) {
|
||||
|
||||
// Using exact key.
|
||||
rkey, rvalue, err := db.TestFind(key)
|
||||
Expect(err).ShouldNot(HaveOccurred(), "Error for key %q", key)
|
||||
Expect(err).ShouldNot(HaveOccurred(), "Error for exact key %q", key)
|
||||
Expect(rkey).Should(Equal(key), "Key")
|
||||
Expect(rvalue).Should(Equal(value), "Value for key %q", key)
|
||||
Expect(rvalue).Should(Equal(value), "Value for exact key %q", key)
|
||||
|
||||
// Using inexact key.
|
||||
rkey, rvalue, err = db.TestFind(key_)
|
||||
Expect(err).ShouldNot(HaveOccurred(), "Error for key %q (%q)", key_, key)
|
||||
Expect(rkey).Should(Equal(key))
|
||||
Expect(rvalue).Should(Equal(value), "Value for key %q (%q)", key_, key)
|
||||
Expect(err).ShouldNot(HaveOccurred(), "Error for inexact key %q (%q)", key_, key)
|
||||
Expect(rkey).Should(Equal(key), "Key for inexact key %q (%q)", key_, key)
|
||||
Expect(rvalue).Should(Equal(value), "Value for inexact key %q (%q)", key_, key)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ func KeyValueTesting(rnd *rand.Rand, kv KeyValue, p DB, setup func(KeyValue) DB,
|
||||
TestIter(db, nil, kv.Clone())
|
||||
}
|
||||
done <- true
|
||||
}, 3.0)
|
||||
}, 30.0)
|
||||
|
||||
It("Should iterates and seeks slice correctly", func(done Done) {
|
||||
if db, ok := p.(NewIterator); ok {
|
||||
@@ -162,7 +162,7 @@ func KeyValueTesting(rnd *rand.Rand, kv KeyValue, p DB, setup func(KeyValue) DB,
|
||||
})
|
||||
}
|
||||
done <- true
|
||||
}, 50.0)
|
||||
}, 200.0)
|
||||
|
||||
It("Should iterates and seeks slice correctly", func(done Done) {
|
||||
if db, ok := p.(NewIterator); ok {
|
||||
@@ -174,7 +174,7 @@ func KeyValueTesting(rnd *rand.Rand, kv KeyValue, p DB, setup func(KeyValue) DB,
|
||||
})
|
||||
}
|
||||
done <- true
|
||||
}, 50.0)
|
||||
}, 200.0)
|
||||
}
|
||||
|
||||
func AllKeyValueTesting(rnd *rand.Rand, body, setup func(KeyValue) DB, teardown func(DB)) {
|
||||
@@ -207,5 +207,6 @@ func AllKeyValueTesting(rnd *rand.Rand, body, setup func(KeyValue) DB, teardown
|
||||
Describe("with big value", Test(KeyValue_BigValue()))
|
||||
Describe("with special key", Test(KeyValue_SpecialKey()))
|
||||
Describe("with multiple key/value", Test(KeyValue_MultipleKeyValue()))
|
||||
Describe("with generated key/value", Test(KeyValue_Generate(nil, 120, 1, 50, 10, 120)))
|
||||
Describe("with generated key/value 2-incr", Test(KeyValue_Generate(nil, 120, 2, 1, 50, 10, 120)))
|
||||
Describe("with generated key/value 3-incr", Test(KeyValue_Generate(nil, 120, 3, 1, 50, 10, 120)))
|
||||
}
|
||||
|
||||
9
vendor/github.com/syndtr/goleveldb/leveldb/testutil/storage.go
generated
vendored
9
vendor/github.com/syndtr/goleveldb/leveldb/testutil/storage.go
generated
vendored
@@ -20,7 +20,6 @@ import (
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb/storage"
|
||||
"github.com/syndtr/goleveldb/leveldb/util"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -161,11 +160,11 @@ func (err emulatedError) Error() string {
|
||||
|
||||
type storageLock struct {
|
||||
s *Storage
|
||||
r util.Releaser
|
||||
l storage.Locker
|
||||
}
|
||||
|
||||
func (l storageLock) Release() {
|
||||
l.r.Release()
|
||||
func (l storageLock) Unlock() {
|
||||
l.l.Unlock()
|
||||
l.s.logI("storage lock released")
|
||||
}
|
||||
|
||||
@@ -332,7 +331,7 @@ func (s *Storage) Log(str string) {
|
||||
s.Storage.Log(str)
|
||||
}
|
||||
|
||||
func (s *Storage) Lock() (l storage.Lock, err error) {
|
||||
func (s *Storage) Lock() (l storage.Locker, err error) {
|
||||
l, err = s.Storage.Lock()
|
||||
if err != nil {
|
||||
s.logI("storage locking failed, err=%v", err)
|
||||
|
||||
Reference in New Issue
Block a user