diff options
Diffstat (limited to 'tests/dedo.go')
-rw-r--r-- | tests/dedo.go | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/tests/dedo.go b/tests/dedo.go index 61ebca6..63cb64d 100644 --- a/tests/dedo.go +++ b/tests/dedo.go @@ -39,10 +39,10 @@ type pageInfoT struct{ overflowCount int } -/// Tx.copyFile() copies the entire database to file at the given path. A +/// transactionT.copyFile() copies the entire database to file at the given path. A /// reader transaction is maintained during the copy so it is safe to continue /// using the database while a copy is in progress. -func (tx *Tx) copyFile(path string, mode os.FileMode) error { +func (tx *transactionT) copyFile(path string, mode os.FileMode) error { f, err := os.OpenFile(path, os.O_RDWR | os.O_CREATE | os.O_TRUNC, mode) if err != nil { return err @@ -57,9 +57,9 @@ func (tx *Tx) copyFile(path string, mode os.FileMode) error { return f.Close() } -/// Tx.Page() returns page information for a given page number. This is only +/// transactionT.Page() returns page information for a given page number. This is only /// safe for concurrent use when used by a writable transaction. -func (tx *Tx) pageInfo(id int) (*pageInfoT, error) { +func (tx *transactionT) pageInfo(id int) (*pageInfoT, error) { if tx.db == nil { return nil, ErrTxClosed } else if pgid(id) >= tx.meta.pgid { @@ -2265,7 +2265,7 @@ func ExampleBucket_ForEach() { // A liger is awesome. } -// Ensure that a Tx cursor can seek to the appropriate keys. +// Ensure that a transactionT cursor can seek to the appropriate keys. func TestCursor_Seek(t *testing.T) { db := MustOpenDB() defer db.MustClose() @@ -2414,7 +2414,7 @@ func TestCursor_Delete(t *testing.T) { } } -// Ensure that a Tx cursor can seek to the appropriate keys when there are a +// Ensure that a transactionT cursor can seek to the appropriate keys when there are a // large number of keys. This test also checks that seek will always move // forward to the next key. // @@ -2516,7 +2516,7 @@ func TestCursor_EmptyBucket(t *testing.T) { } } -// Ensure that a Tx cursor can reverse iterate over an empty bucket without +// Ensure that a transactionT cursor can reverse iterate over an empty bucket without // error. func TestCursor_EmptyBucketReverse(t *testing.T) { db := MustOpenDB() @@ -2546,7 +2546,7 @@ func TestCursor_EmptyBucketReverse(t *testing.T) { } } -// Ensure that a Tx cursor can iterate over a single root with a couple +// Ensure that a transactionT cursor can iterate over a single root with a couple // elements. func TestCursor_Iterate_Leaf(t *testing.T) { db := MustOpenDB() @@ -2629,7 +2629,7 @@ func TestCursor_Iterate_Leaf(t *testing.T) { } } -// Ensure that a Tx cursor can iterate in reverse over a single root with a +// Ensure that a transactionT cursor can iterate in reverse over a single root with a // couple elements. func TestCursor_LeafRootReverse(t *testing.T) { db := MustOpenDB() @@ -2710,7 +2710,7 @@ func TestCursor_LeafRootReverse(t *testing.T) { } } -// Ensure that a Tx cursor can restart from the beginning. +// Ensure that a transactionT cursor can restart from the beginning. func TestCursor_Restart(t *testing.T) { db := MustOpenDB() defer db.MustClose() @@ -2822,7 +2822,7 @@ func TestCursor_First_EmptyPages(t *testing.T) { } } -// Ensure that a Tx can iterate over all elements in a bucket. +// Ensure that a transactionT can iterate over all elements in a bucket. func TestCursor_QuickCheck(t *testing.T) { f := func(items testdata) bool { db := MustOpenDB() @@ -2970,7 +2970,7 @@ func TestCursor_QuickCheck_Reverse(t *testing.T) { } } -// Ensure that a Tx cursor can iterate over subbuckets. +// Ensure that a transactionT cursor can iterate over subbuckets. func TestCursor_QuickCheck_BucketsOnly(t *testing.T) { db := MustOpenDB() defer db.MustClose() @@ -3024,7 +3024,7 @@ func TestCursor_QuickCheck_BucketsOnly(t *testing.T) { } } -// Ensure that a Tx cursor can reverse iterate over subbuckets. +// Ensure that a transactionT cursor can reverse iterate over subbuckets. func TestCursor_QuickCheck_BucketsOnly_Reverse(t *testing.T) { db := MustOpenDB() defer db.MustClose() @@ -3942,7 +3942,7 @@ func TestDB_Consistency(t *testing.T) { } err = db.Update(func(itx TransactionI) error { - tx := itx.(*Tx) + tx := itx.(*transactionT) p, _ := tx.pageInfo(0) if p == nil { t.Fatal("expected page") @@ -4630,7 +4630,7 @@ func (db *WDB) MustClose() { // are found. func (db *WDB) MustCheck() { err := db.Update(func(itx TransactionI) error { - tx := itx.(*Tx) + tx := itx.(*transactionT) // Collect all the errors. errors := []error{} for err := range tx.Check() { @@ -4676,7 +4676,7 @@ func (db *WDB) MustCheck() { func (db *WDB) CopyTempFile() { path := tempfile() err := db.View(func(snapshot SnapshotI) error { - tx := snapshot.(*Tx) + tx := snapshot.(*transactionT) return tx.copyFile(path, 0600) }) if err != nil { @@ -5013,7 +5013,7 @@ func TestNode_put(t *testing.T) { n := &node{ inodes: make(inodes, 0), bucket: &Bucket{ - tx: &Tx{ + tx: &transactionT{ meta: &meta{ pgid: 1, }, @@ -5102,7 +5102,7 @@ func TestNode_write_LeafPage(t *testing.T) { isLeaf: true, inodes: make(inodes, 0), bucket: &Bucket{ - tx: &Tx{ + tx: &transactionT{ db: &DB{}, meta: &meta{ pgid: 1, @@ -5150,7 +5150,7 @@ func TestNode_split(t *testing.T) { n := &node{ inodes: make(inodes, 0), bucket: &Bucket{ - tx: &Tx{ + tx: &transactionT{ db: &DB{}, meta: &meta{ pgid: 1, @@ -5186,7 +5186,7 @@ func TestNode_split_MinKeys(t *testing.T) { n := &node{ inodes: make(inodes, 0), bucket: &Bucket{ - tx: &Tx{ + tx: &transactionT{ db: &DB{}, meta: &meta{ pgid: 1, @@ -5211,7 +5211,7 @@ func TestNode_split_SinglePage(t *testing.T) { n := &node{ inodes: make(inodes, 0), bucket: &Bucket{ - tx: &Tx{ + tx: &transactionT{ db: &DB{}, meta: &meta{ pgid: 1, @@ -5515,7 +5515,7 @@ func testSimulate(t *testing.T, threadCount, parallelism int) { defer wg.Done() // Start transaction. - var tx *Tx + var tx *transactionT var err error if writable { tx, err = db.beginRWTx() @@ -5573,10 +5573,10 @@ func testSimulate(t *testing.T, threadCount, parallelism int) { wg.Wait() } -type simulateHandler func(tx *Tx, qdb *QuickDB) +type simulateHandler func(tx *transactionT, qdb *QuickDB) // Retrieves a key from the database and verifies that it is what is expected. -func simulateGetHandler(tx *Tx, qdb *QuickDB) { +func simulateGetHandler(tx *transactionT, qdb *QuickDB) { // Randomly retrieve an existing exist. keys := qdb.Rand() if len(keys) == 0 { @@ -5618,7 +5618,7 @@ func simulateGetHandler(tx *Tx, qdb *QuickDB) { } // Inserts a key into the database. -func simulatePutHandler(tx *Tx, qdb *QuickDB) { +func simulatePutHandler(tx *transactionT, qdb *QuickDB) { var err error keys, value := randKeys(), randValue() @@ -5919,7 +5919,7 @@ func TestTx_CreateBucket_ErrTxNotWritable(t *testing.T) { defer os.Remove(db.Path()) err := db.View(func(snapshot SnapshotI) error { - tx := snapshot.(*Tx) + tx := snapshot.(*transactionT) _, err := tx.CreateBucket([]byte("foo")) if err != ErrTxNotWritable { t.Fatalf("unexpected error: %s", err) @@ -5954,7 +5954,7 @@ func TestTx_CreateBucket_ErrTxClosed(t *testing.T) { } } -// Ensure that a Tx can retrieve a bucket. +// Ensure that a transactionT can retrieve a bucket. func TestTx_Bucket(t *testing.T) { db := MustOpenDB() defer db.MustClose() @@ -5977,7 +5977,7 @@ func TestTx_Bucket(t *testing.T) { } } -// Ensure that a Tx retrieving a non-existent key returns nil. +// Ensure that a transactionT retrieving a non-existent key returns nil. func TestTx_Get_NotFound(t *testing.T) { db := MustOpenDB() defer db.MustClose() @@ -6247,7 +6247,7 @@ func TestTx_DeleteBucket_ReadOnly(t *testing.T) { defer os.Remove(db.Path()) err := db.View(func(snapshot SnapshotI) error { - tx := snapshot.(*Tx) + tx := snapshot.(*transactionT) err := tx.DeleteBucket([]byte("foo")) if err != ErrTxNotWritable { t.Fatalf("unexpected error: %s", err) |