diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-01 09:13:59 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-01 09:13:59 -0700 |
commit | a1f43f4d60bf434baebf13b4810e5db4916baec5 (patch) | |
tree | 75850081fdb236f37c82d6e8fcd4cde5b81354d8 /db.go | |
parent | Merge branch 'master' of https://github.com/boltdb/bolt (diff) | |
download | dedo-a1f43f4d60bf434baebf13b4810e5db4916baec5.tar.gz dedo-a1f43f4d60bf434baebf13b4810e5db4916baec5.tar.xz |
Allow reads of unflushed nodes.
This commit allows cursors to read updated values from within the
RWTransaction.
Diffstat (limited to 'db.go')
-rw-r--r-- | db.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -304,7 +304,7 @@ func (db *DB) RWTransaction() (*RWTransaction, error) { } // Create a transaction associated with the database. - t := &RWTransaction{nodes: make(map[pgid]*node)} + t := &RWTransaction{} t.init(db) db.rwtransaction = t @@ -571,7 +571,8 @@ func (db *DB) Stat() (*Stat, error) { // page retrieves a page reference from the mmap based on the current page size. func (db *DB) page(id pgid) *page { - return (*page)(unsafe.Pointer(&db.data[id*pgid(db.pageSize)])) + pos := id*pgid(db.pageSize) + return (*page)(unsafe.Pointer(&db.data[pos])) } // pageInBuffer retrieves a page reference from a given byte array based on the current page size. |