diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-21 17:14:56 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-21 22:57:50 -0700 |
commit | 1ad2b99f281d587b767b36f886401e81d17915a9 (patch) | |
tree | 7b46bfc96689af14938a9f93aab732e3e46ee709 /bucket_test.go | |
parent | Merge pull request #49 from benbjohnson/stat (diff) | |
download | dedo-1ad2b99f281d587b767b36f886401e81d17915a9.tar.gz dedo-1ad2b99f281d587b767b36f886401e81d17915a9.tar.xz |
Refactor Transaction/Bucket API.
Diffstat (limited to 'bucket_test.go')
-rw-r--r-- | bucket_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bucket_test.go b/bucket_test.go index 5e33189..2778432 100644 --- a/bucket_test.go +++ b/bucket_test.go @@ -11,23 +11,26 @@ import ( // Ensure a bucket can calculate stats. func TestBucketStat(t *testing.T) { withOpenDB(func(db *DB, path string) { - db.Do(func(txn *RWTransaction) error { + db.Do(func(txn *Transaction) error { // Add bucket with lots of keys. txn.CreateBucket("widgets") + b := txn.Bucket("widgets") for i := 0; i < 100000; i++ { - txn.Put("widgets", []byte(strconv.Itoa(i)), []byte(strconv.Itoa(i))) + b.Put([]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++ { - txn.Put("woojits", []byte(strconv.Itoa(i)), []byte(strconv.Itoa(i))) + b.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i))) } - txn.Put("woojits", []byte("really-big-value"), []byte(strings.Repeat("*", 10000))) + b.Put([]byte("really-big-value"), []byte(strings.Repeat("*", 10000))) // Add a bucket that fits on a single root leaf. txn.CreateBucket("whozawhats") - txn.Put("whozawhats", []byte("foo"), []byte("bar")) + b = txn.Bucket("whozawhats") + b.Put([]byte("foo"), []byte("bar")) return nil }) |