aboutsummaryrefslogtreecommitdiff
path: root/db_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-03-08 17:01:49 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-03-08 17:04:02 -0700
commit57376f090503d7ef5bc38f138e58e64bdea284a3 (patch)
treee215bb0cf8df72a53b662ff222c24a973e7faac3 /db_test.go
parentAdd benchmarks. (diff)
downloaddedo-57376f090503d7ef5bc38f138e58e64bdea284a3.tar.gz
dedo-57376f090503d7ef5bc38f138e58e64bdea284a3.tar.xz
Rename Transaction to Tx.
I changed the Transaction/RWTransaction types to Tx/RWTx, respectively. This makes the naming more consistent with other packages such as database/sql. The txnid is changed to txid as well.
Diffstat (limited to 'db_test.go')
-rw-r--r--db_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/db_test.go b/db_test.go
index c8a8267..029d248 100644
--- a/db_test.go
+++ b/db_test.go
@@ -156,9 +156,9 @@ func TestDBCorruptMeta0(t *testing.T) {
}
// Ensure that a database cannot open a transaction when it's not open.
-func TestDBTransactionErrDatabaseNotOpen(t *testing.T) {
+func TestDBTxErrDatabaseNotOpen(t *testing.T) {
withDB(func(db *DB, path string) {
- txn, err := db.Transaction()
+ txn, err := db.Tx()
assert.Nil(t, txn)
assert.Equal(t, err, ErrDatabaseNotOpen)
})
@@ -173,9 +173,9 @@ func TestDBDeleteFromMissingBucket(t *testing.T) {
}
// Ensure a database can provide a transactional block.
-func TestDBTransactionBlock(t *testing.T) {
+func TestDBTxBlock(t *testing.T) {
withOpenDB(func(db *DB, path string) {
- err := db.Do(func(txn *RWTransaction) error {
+ err := db.Do(func(txn *RWTx) error {
txn.CreateBucket("widgets")
b := txn.Bucket("widgets")
b.Put([]byte("foo"), []byte("bar"))
@@ -192,9 +192,9 @@ func TestDBTransactionBlock(t *testing.T) {
}
// Ensure a closed database returns an error while running a transaction block
-func TestDBTransactionBlockWhileClosed(t *testing.T) {
+func TestDBTxBlockWhileClosed(t *testing.T) {
withDB(func(db *DB, path string) {
- err := db.Do(func(txn *RWTransaction) error {
+ err := db.Do(func(txn *RWTx) error {
txn.CreateBucket("widgets")
return nil
})
@@ -276,7 +276,7 @@ func TestDBCopyFile(t *testing.T) {
// Ensure the database can return stats about itself.
func TestDBStat(t *testing.T) {
withOpenDB(func(db *DB, path string) {
- db.Do(func(txn *RWTransaction) error {
+ db.Do(func(txn *RWTx) error {
txn.CreateBucket("widgets")
b := txn.Bucket("widgets")
for i := 0; i < 10000; i++ {
@@ -290,9 +290,9 @@ func TestDBStat(t *testing.T) {
db.Delete("widgets", []byte("1000"))
// Open some readers.
- t0, _ := db.Transaction()
- t1, _ := db.Transaction()
- t2, _ := db.Transaction()
+ t0, _ := db.Tx()
+ t1, _ := db.Tx()
+ t2, _ := db.Tx()
t2.Close()
// Obtain stats.
@@ -302,7 +302,7 @@ func TestDBStat(t *testing.T) {
assert.Equal(t, stat.FreePageCount, 2)
assert.Equal(t, stat.PageSize, 4096)
assert.Equal(t, stat.MmapSize, 4194304)
- assert.Equal(t, stat.TransactionCount, 2)
+ assert.Equal(t, stat.TxCount, 2)
// Close readers.
t0.Close()