diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-08 19:44:10 -0800 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-08 19:44:10 -0800 |
commit | a32d0c5c5f7913f09e2489ba3545a9e2d4865698 (patch) | |
tree | e215bb0cf8df72a53b662ff222c24a973e7faac3 /freelist.go | |
parent | Add benchmarks. (diff) | |
parent | Rename Transaction to Tx. (diff) | |
download | dedo-a32d0c5c5f7913f09e2489ba3545a9e2d4865698.tar.gz dedo-a32d0c5c5f7913f09e2489ba3545a9e2d4865698.tar.xz |
Merge pull request #60 from benbjohnson/tx
Rename Transaction to Tx.
Diffstat (limited to 'freelist.go')
-rw-r--r-- | freelist.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/freelist.go b/freelist.go index 3f5cf1c..636ed22 100644 --- a/freelist.go +++ b/freelist.go @@ -9,7 +9,7 @@ import ( // It also tracks pages that have been freed but are still in use by open transactions. type freelist struct { ids []pgid - pending map[txnid][]pgid + pending map[txid][]pgid } // all returns a list of all free ids and all pending ids in one sorted list. @@ -50,19 +50,19 @@ func (f *freelist) allocate(n int) pgid { } // free releases a page and its overflow for a given transaction id. -func (f *freelist) free(txnid txnid, p *page) { - var ids = f.pending[txnid] +func (f *freelist) free(txid txid, p *page) { + var ids = f.pending[txid] _assert(p.id > 1, "cannot free page 0 or 1: %d", p.id) for i := 0; i < int(p.overflow+1); i++ { ids = append(ids, p.id+pgid(i)) } - f.pending[txnid] = ids + f.pending[txid] = ids } // release moves all page ids for a transaction id (or older) to the freelist. -func (f *freelist) release(txnid txnid) { +func (f *freelist) release(txid txid) { for tid, ids := range f.pending { - if tid <= txnid { + if tid <= txid { f.ids = append(f.ids, ids...) delete(f.pending, tid) } |