diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-08 17:01:49 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-08 17:04:02 -0700 |
commit | 57376f090503d7ef5bc38f138e58e64bdea284a3 (patch) | |
tree | e215bb0cf8df72a53b662ff222c24a973e7faac3 /bucket.go | |
parent | Add benchmarks. (diff) | |
download | dedo-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 'bucket.go')
-rw-r--r-- | bucket.go | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -7,9 +7,9 @@ import ( // Bucket represents a collection of key/value pairs inside the database. type Bucket struct { *bucket - name string - transaction *Transaction - rwtransaction *RWTransaction + name string + tx *Tx + rwtx *RWTx } // bucket represents the on-file representation of a bucket. @@ -25,17 +25,17 @@ func (b *Bucket) Name() string { // Writable returns whether the bucket is writable. func (b *Bucket) Writable() bool { - return (b.rwtransaction != nil) + return (b.rwtx != nil) } // Cursor creates a cursor associated with the bucket. -// The cursor is only valid as long as the Transaction is open. +// The cursor is only valid as long as the transaction is open. // Do not use a cursor after the transaction is closed. func (b *Bucket) Cursor() *Cursor { return &Cursor{ - transaction: b.transaction, - root: b.root, - stack: make([]elemRef, 0), + tx: b.tx, + root: b.root, + stack: make([]elemRef, 0), } } @@ -74,7 +74,7 @@ func (b *Bucket) Put(key []byte, value []byte) error { c.Seek(key) // Insert the key/value. - c.node(b.rwtransaction).put(key, key, value, 0) + c.node(b.rwtx).put(key, key, value, 0) return nil } @@ -92,7 +92,7 @@ func (b *Bucket) Delete(key []byte) error { c.Seek(key) // Delete the node if we have a matching key. - c.node(b.rwtransaction).del(key) + c.node(b.rwtx).del(key) return nil } @@ -130,7 +130,7 @@ func (b *Bucket) ForEach(fn func(k, v []byte) error) error { // Stat returns stats on a bucket. func (b *Bucket) Stat() *BucketStat { s := &BucketStat{} - b.transaction.forEachPage(b.root, 0, func(p *page, depth int) { + b.tx.forEachPage(b.root, 0, func(p *page, depth int) { if (p.flags & leafPageFlag) != 0 { s.LeafPageCount++ s.KeyCount += int(p.count) |