aboutsummaryrefslogtreecommitdiff
path: root/transaction.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-10 16:58:16 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-10 16:58:16 -0700
commita68bd301db09ef5465f12ff4242696799da5b14d (patch)
treeb6dc2efd0908df4ca7ff270181e46a1e4d85a77c /transaction.go
parentClean up. (diff)
parentAdd freelist. (diff)
downloaddedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.gz
dedo-a68bd301db09ef5465f12ff4242696799da5b14d.tar.xz
Merge pull request #20 from benbjohnson/freelist
Freelist
Diffstat (limited to 'transaction.go')
-rw-r--r--transaction.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/transaction.go b/transaction.go
index d21693a..1b940d6 100644
--- a/transaction.go
+++ b/transaction.go
@@ -10,7 +10,6 @@ const (
type txnid uint64
type Transaction struct {
- id int
db *DB
meta *meta
buckets *buckets
@@ -27,8 +26,13 @@ func (t *Transaction) init(db *DB) {
t.buckets.read(t.page(t.meta.buckets))
}
+// id returns the transaction id.
+func (t *Transaction) id() txnid {
+ return t.meta.txnid
+}
+
func (t *Transaction) Close() {
- // TODO: Close buckets.
+ t.db.removeTransaction(t)
}
func (t *Transaction) DB() *DB {
@@ -73,12 +77,6 @@ func (t *Transaction) Get(name string, key []byte) []byte {
return c.Get(key)
}
-// stat returns information about a bucket's internal structure.
-func (t *Transaction) stat(name string) *Stat {
- // TODO
- return nil
-}
-
// page returns a reference to the page with a given id.
// If page has been written to then a temporary bufferred page is returned.
func (t *Transaction) page(id pgid) *page {