aboutsummaryrefslogtreecommitdiff
path: root/bucket_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-22 22:54:54 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-22 22:54:54 -0700
commit3b2fd8f2d3e376fa7a3f3b2ba665fcd4a5b5bb15 (patch)
treea2b7de98448c4ddd427449dfe85695fa5c7c9c22 /bucket_test.go
parentMerge pull request #50 from benbjohnson/api (diff)
downloaddedo-3b2fd8f2d3e376fa7a3f3b2ba665fcd4a5b5bb15.tar.gz
dedo-3b2fd8f2d3e376fa7a3f3b2ba665fcd4a5b5bb15.tar.xz
Revert "Refactor Transaction/Bucket API."
This reverts commit 1ad2b99f281d587b767b36f886401e81d17915a9.
Diffstat (limited to 'bucket_test.go')
-rw-r--r--bucket_test.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/bucket_test.go b/bucket_test.go
index 2778432..5e33189 100644
--- a/bucket_test.go
+++ b/bucket_test.go
@@ -11,26 +11,23 @@ import (
// Ensure a bucket can calculate stats.
func TestBucketStat(t *testing.T) {
withOpenDB(func(db *DB, path string) {
- db.Do(func(txn *Transaction) error {
+ db.Do(func(txn *RWTransaction) error {
// Add bucket with lots of keys.
txn.CreateBucket("widgets")
- b := txn.Bucket("widgets")
for i := 0; i < 100000; i++ {
- b.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))
+ txn.Put("widgets", []byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))
}
// Add bucket with fewer keys but one big value.
txn.CreateBucket("woojits")
- b = txn.Bucket("woojits")
for i := 0; i < 500; i++ {
- b.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))
+ txn.Put("woojits", []byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))
}
- b.Put([]byte("really-big-value"), []byte(strings.Repeat("*", 10000)))
+ txn.Put("woojits", []byte("really-big-value"), []byte(strings.Repeat("*", 10000)))
// Add a bucket that fits on a single root leaf.
txn.CreateBucket("whozawhats")
- b = txn.Bucket("whozawhats")
- b.Put([]byte("foo"), []byte("bar"))
+ txn.Put("whozawhats", []byte("foo"), []byte("bar"))
return nil
})