From 509e93dff4cedf88d91ba2c99385da0b4e41eb6a Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sun, 9 Feb 2014 15:52:19 -0700 Subject: Add freelist. --- transaction.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'transaction.go') 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 { -- cgit v1.2.3